svdbeemt / domoticz-woonveilig

Woonveilig (alarmsystem) for Domoticz
1 stars 3 forks source link

Error: (woonveilig) 'onHeartbeat' failed 'KeyError' #6

Closed fvdijke closed 5 years ago

fvdijke commented 6 years ago

Hi and thanks for this great project. Whatever i tried, i keep the message: Error: (woonveilig) 'onHeartbeat' failed 'KeyError'

Am i missing something? Can you please help me?

Debug info: 2018-09-14 11:03:17.956 {no : "1", type : "IR Sensor", zone : "1", name : "Gang", attr : "Entry Zone", cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:17.956 {no : "2", type : "IR Sensor", zone : "2", name : "Woonkamer", attr : "Entry Zone", cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:17.956 {no : "3", type : "Remote Keypad", zone : "3", name : "Paneel", attr : "",cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:17.956 {no : "4", type : "Remote Keypad", zone : "4", name : "Paneel", attr : "",cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:17.956 {no : "5", type : "Door Contact", zone : "5", name : "Berging", attr : "Entry Zone", cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:17.956 {no : "6", type : "Smoke Sensor", zone : "6", name : "Rookmelder", attr : "",cond : "", battery : "", tamp : "", bypass : "No"}] 2018-09-14 11:03:17.956 } 2018-09-14 11:03:17.956 / 2018-09-14 11:03:17.821 Status: (woonveilig) Entering work loop. 2018-09-14 11:03:17.821 Status: (woonveilig) Initialized version 1.1.0, author 'Steven van den Beemt' 2018-09-14 11:03:17.862 Status: RFLink: Controller Initialized!... 2018-09-14 11:03:17.938 Status: RFLink Detected, Version: 1.1 Revision: 48 Build: 4 2018-09-14 11:03:17.963 Status: AppLamp: Bridge found!... 2018-09-14 11:03:18.152 (woonveilig) Devices initialized. 2018-09-14 11:03:18.152 (woonveilig) 'Version':'1.1.0' 2018-09-14 11:03:18.152 (woonveilig) 'DomoticzHash':'93c187f2' 2018-09-14 11:03:18.152 (woonveilig) 'Port':'0' 2018-09-14 11:03:18.152 (woonveilig) 'Username':’xxxxxxx’ 2018-09-14 11:03:18.152 (woonveilig) 'Name':'woonveilig' 2018-09-14 11:03:18.152 (woonveilig) 'Key':'Woonveilig' 2018-09-14 11:03:18.152 (woonveilig) 'Mode6':'Debug' 2018-09-14 11:03:18.152 (woonveilig) 'HardwareID':'17' 2018-09-14 11:03:18.152 (woonveilig) 'HomeFolder':'/home/pi/domoticz/plugins/domoticz-woonveilig/' 2018-09-14 11:03:18.152 (woonveilig) 'DomoticzBuildTime':'2018-08-22 11:09:19' 2018-09-14 11:03:18.152 (woonveilig) 'Author':'Steven van den Beemt' 2018-09-14 11:03:18.152 (woonveilig) 'Password':’xxxxxxxx’ 2018-09-14 11:03:18.153 (woonveilig) 'Address':'10.0.0.208' 2018-09-14 11:03:18.153 (woonveilig) 'DomoticzVersion':'4.9921' 2018-09-14 11:03:18.153 (woonveilig) Device count: 4 2018-09-14 11:03:18.153 (woonveilig) Device: 1 - ID: 1398, Name: 'woonveilig - Gang', nValue: 0, sValue: 'False' 2018-09-14 11:03:18.153 (woonveilig) Device ID: '1398' 2018-09-14 11:03:18.153 (woonveilig) Device Name: 'woonveilig - Gang' 2018-09-14 11:03:18.153 (woonveilig) Device nValue: 0 2018-09-14 11:03:18.153 (woonveilig) Device sValue: 'False' 2018-09-14 11:03:18.153 (woonveilig) Device LastLevel: 0 2018-09-14 11:03:18.153 (woonveilig) Device: 2 - ID: 1399, Name: 'woonveilig - Woonkamer', nValue: 0, sValue: 'False' 2018-09-14 11:03:18.153 (woonveilig) Device ID: '1399' 2018-09-14 11:03:18.153 (woonveilig) Device Name: 'woonveilig - Woonkamer' 2018-09-14 11:03:18.153 (woonveilig) Device nValue: 0 2018-09-14 11:03:18.153 (woonveilig) Device sValue: 'False' 2018-09-14 11:03:18.153 (woonveilig) Device LastLevel: 0 2018-09-14 11:03:18.154 (woonveilig) Device: 99 - ID: 1400, Name: 'woonveilig - Paneel', nValue: 0, sValue: '' 2018-09-14 11:03:18.154 (woonveilig) Device ID: '1400' 2018-09-14 11:03:18.154 (woonveilig) Device Name: 'woonveilig - Paneel' 2018-09-14 11:03:18.154 (woonveilig) Device nValue: 0 2018-09-14 11:03:18.154 (woonveilig) Device sValue: '' 2018-09-14 11:03:18.154 (woonveilig) Device LastLevel: 0 2018-09-14 11:03:18.154 (woonveilig) Device: 5 - ID: 1401, Name: 'woonveilig - Berging', nValue: 0, sValue: 'False' 2018-09-14 11:03:18.154 (woonveilig) Device ID: '1401' 2018-09-14 11:03:18.154 (woonveilig) Device Name: 'woonveilig - Berging' 2018-09-14 11:03:18.154 (woonveilig) Device nValue: 0 2018-09-14 11:03:18.154 (woonveilig) Device sValue: 'False' 2018-09-14 11:03:18.154 (woonveilig) Device LastLevel: 0 2018-09-14 11:03:21.468 Status: P1 Smart Meter: Meter reports as DSMR 4.2 2018-09-14 11:03:22.686 (Smartmeter P1) P1 Smart Meter (Stroom) 2018-09-14 11:03:22.688 (Smartmeter P1) P1 Smart Meter (Gas) 2018-09-14 11:03:22.523 Status: P1 Smart Meter: Found gas meter on M-Bus channel 1 2018-09-14 11:03:26.955 (Weather Underground) Temp + Humidity + Baro (Weer) 2018-09-14 11:03:26.957 (Weather Underground) Wind (Wind) 2018-09-14 11:03:26.960 (Weather Underground) UV (UV) 2018-09-14 11:03:26.962 (Weather Underground) Rain (Regen) 2018-09-14 11:03:26.964 (Weather Underground) General/Visibility (Zicht) 2018-09-14 11:03:26.966 (Weather Underground) General/Solar Radiation (Solar Radiation) 2018-09-14 11:03:27.656 (woonveilig) Pushing 'onHeartbeatCallback' on to queue 2018-09-14 11:03:27.684 (woonveilig) Processing 'onHeartbeatCallback' message 2018-09-14 11:03:27.684 (woonveilig) Calling message handler 'onHeartbeat'. 2018-09-14 11:03:27.684 (woonveilig) onHeartbeat called 2018-09-14 11:03:27.779 (woonveilig) /-secure- 2018-09-14 11:03:27.779 { senrows : [ 2018-09-14 11:03:27.779 {no : "1", type : "IR Sensor", zone : "1", name : "Gang", attr : "Entry Zone", cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:27.779 {no : "2", type : "IR Sensor", zone : "2", name : "Woonkamer", attr : "Entry Zone", cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:27.779 {no : "3", type : "Remote Keypad", zone : "3", name : "Paneel", attr : "",cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:27.779 {no : "4", type : "Remote Keypad", zone : "4", name : "Paneel", attr : "",cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:27.779 {no : "5", type : "Door Contact", zone : "5", name : "Berging", attr : "Entry Zone", cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:27.779 {no : "6", type : "Smoke Sensor", zone : "6", name : "Rookmelder", attr : "",cond : "", battery : "", tamp : "", bypass : "No"}] 2018-09-14 11:03:27.779 } 2018-09-14 11:03:27.779 / 2018-09-14 11:03:28.020 (woonveilig) /-secure- 2018-09-14 11:03:28.020 { updates : { 2018-09-14 11:03:28.020 mode_st : "Disarm", 2018-09-14 11:03:28.020 battery : "Normal", 2018-09-14 11:03:28.020 tamper : "Close", 2018-09-14 11:03:28.020 interference : "Normal", 2018-09-14 11:03:28.020 ac_activation : "Normal", 2018-09-14 11:03:28.020 rssi : "28" 2018-09-14 11:03:28.020 }, 2018-09-14 11:03:28.020 forms : { 2018-09-14 11:03:28.020 pcondform : { 2018-09-14 11:03:28.020 mode : "2" 2018-09-14 11:03:28.020 } 2018-09-14 11:03:28.020 } 2018-09-14 11:03:28.020 } 2018-09-14 11:03:28.020 / 2018-09-14 11:03:28.068 Error: (woonveilig) 'onHeartbeat' failed 'KeyError'. 2018-09-14 11:03:28.068 Error: (woonveilig) ----> Line 165 in '/home/pi/domoticz/plugins/domoticz-woonveilig/plugin.py', function onHeartbeat 2018-09-14 11:03:28.068 Error: (woonveilig) ----> Line 125 in '/home/pi/domoticz/plugins/domoticz-woonveilig/plugin.py', function onHeartbeat 2018-09-14 11:03:37.658 (woonveilig) Pushing 'onHeartbeatCallback' on to queue 2018-09-14 11:03:37.689 (woonveilig) Processing 'onHeartbeatCallback' message 2018-09-14 11:03:37.690 (woonveilig) Calling message handler 'onHeartbeat'. 2018-09-14 11:03:37.690 (woonveilig) onHeartbeat called 2018-09-14 11:03:37.784 (woonveilig) /-secure- 2018-09-14 11:03:37.784 { senrows : [ 2018-09-14 11:03:37.784 {no : "1", type : "IR Sensor", zone : "1", name : "Gang", attr : "Entry Zone", cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:37.784 {no : "2", type : "IR Sensor", zone : "2", name : "Woonkamer", attr : "Entry Zone", cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:37.784 {no : "3", type : "Remote Keypad", zone : "3", name : "Paneel", attr : "",cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:37.784 {no : "4", type : "Remote Keypad", zone : "4", name : "Paneel", attr : "",cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:37.784 {no : "5", type : "Door Contact", zone : "5", name : "Berging", attr : "Entry Zone", cond : "", battery : "", tamp : "", bypass : "No"}, 2018-09-14 11:03:37.784 {no : "6", type : "Smoke Sensor", zone : "6", name : "Rookmelder", attr : "",cond : "", battery : "", tamp : "", bypass : "No"}] 2018-09-14 11:03:37.784 } 2018-09-14 11:03:37.784 / 2018-09-14 11:03:38.045 (woonveilig) /-secure- 2018-09-14 11:03:38.045 { updates : { 2018-09-14 11:03:38.045 mode_st : "Disarm", 2018-09-14 11:03:38.045 battery : "Normal", 2018-09-14 11:03:38.045 tamper : "Close", 2018-09-14 11:03:38.045 interference : "Normal", 2018-09-14 11:03:38.045 ac_activation : "Normal", 2018-09-14 11:03:38.045 rssi : "27" 2018-09-14 11:03:38.045 }, 2018-09-14 11:03:38.045 forms : { 2018-09-14 11:03:38.045 pcondform : { 2018-09-14 11:03:38.045 mode : "2" 2018-09-14 11:03:38.045 } 2018-09-14 11:03:38.045 } 2018-09-14 11:03:38.045 } 2018-09-14 11:03:38.045 */ 2018-09-14 11:03:38.093 Error: (woonveilig) 'onHeartbeat' failed 'KeyError'. 2018-09-14 11:03:38.093 Error: (woonveilig) ----> Line 165 in '/home/pi/domoticz/plugins/domoticz-woonveilig/plugin.py', function onHeartbeat 2018-09-14 11:03:38.093 Error: (woonveilig) ----> Line 125 in '/home/pi/domoticz/plugins/domoticz-woonveilig/plugin.py', function onHeartbeat

Thanks in advance!!

imdos commented 5 years ago

I have modified the Makerequest code with this addition: tries = 3 for i in range(tries): try: do_the_thing() except KeyError as e: if i < tries - 1: # starts @ zero continue else: raise break

According to this post:
https://stackoverflow.com/a/34885906

My version is available here: https://github.com/imdos/domoticz_scripts/blob/master/woonveilig-plugin.py

I'm not that experienced with github to create a pull request or something smarter. Will try to do that if I have the time.

svdbeemt commented 5 years ago

@imdos, thanks for your contribution. I updated the code.