Hello, I finally moved from 2.5 to latest 3.2.0, using the official openwebnet binding. I have two gateways installed, the MHS1 for automation/lights, ecc, fully woking as expect, and one unofficial LN4890 used by domoticz and still connected
I’m trying to control a 3486 alarm through the LN4890 because MHS1 filters who=5 messages from network to bus, and I achieved to use a set of scripts downloaded from https://github.com/francesco-re-1107/openwebnet-alarm and adapted to actual syntax of exec binding. They work quite well to engage/disengage alarm via AUX commands, but one of scripts fails to check the actual status of alarm.
It is very simple:
from OpenWebNet import OpenWebNet
server = OpenWebNet(“192.168.1.50”,“20000”,“12345”)
res = server.stato_allarme()#check result
if res == “58*##”: alarm is enabled
print “1”
if res == “59*##”: alarm is disabled
print “0”
if res == “”:
print “N”
I added the last if because most times the scripts does not receive all the message from bus, so it does not return 0 or 1 (here 3 different results fom execution with output of the received message and the script return code):
root@mhw:/usr/local/src/openwebnet-alarm-master # /usr/bin/python /usr/local/src/openwebnet-alarm-master/fm_status.py
(‘message’, ‘51*##59*##55*##’)
[‘51*##’, ‘59*##’, ‘55*##’, ‘’]
51*##59*##55*##
0
root@mhw:/usr/local/src/openwebnet-alarm-master # /usr/bin/python /usr/local/src/openwebnet-alarm-master/fm_status.py
(‘message’, ‘51*##59*##55*##57*##511*#1##511*#2##511*#3##’)
[‘51*##’, ‘59*##’, ‘55*##’, ‘57*##’, ‘511*#1##’, ‘511*#2##’, ‘511*#3##’, ‘’]
51*##59*##55*##57*##511*#1##511*#2##511*#3##
0
root@mhw:/usr/local/src/openwebnet-alarm-master # /usr/bin/python /usr/local/src/openwebnet-alarm-master/fm_status.py
(‘message’, ‘51*##’)
[‘51*##’, ‘’]
51*##
N
Naturally this problem causes the state of the item continously changing and a difficult managing:
2021-09-19 12:23:16.305 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Stato_allarme’ changed from 0 to N
2021-09-19 12:23:32.573 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Stato_allarme’ changed from N to 0
2021-09-19 12:23:59.695 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Stato_allarme’ changed from 0 to N
2021-09-19 12:24:05.208 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Stato_allarme’ changed from N to 0
I do not know python, is there someone good enough to help me?
TY in advance