Open rezzalex opened 1 year ago
I think I would like to add some additional debug-logging for this, because I do wonder what the VTO is sending in that case.
The received message does not contain a "{" and "}". Therefore "parse_response" returns None. The on_message does not handle this case when parse_response returns None. I can definitely handle None messages in parse_response.
@rezzalex, can you check out the latest commit and see if that helps out? And can you find any logs messages: "Unparseable data message received: " followed by data when using that version? If so, could you post those here.
Just add it and here some messages intercepted at start-up :
2023-09-14 11:14:09.158 Visiophone: Failed to read data: b' \x00\x00\x00DHIP\xc3DU\x13\r\x00\x00\x00f\x10\x00\x00\x00\x00\x00\x00f\x10\x00\x00\x00\x00\x00\x00{"id":13,"params":{"table":[{"AccessProtocol":"Local","AutoRemoteCheck":{"Enable":false,"Time":255},"BreakInAlarmEnable":false,"CardNoConvert":0,"CloseAlwaysTime":255,"CloseTimeout":60,"CustomPasswordEnable":false,"DoorNotClosedAlarmEnable":false,"DuressAlarmEnable":true,"Enable":true,"FirstEnter":{"Enable":false,"Status":"Normal","Time":1},"HelmetEnable":false,"HolidayTime":255,"LockMode":2,"Method":42,"Name":"Door1","OpenAlwaysTime":255,"ProtocolType":0,"ReadCardState":0,"RemoteCheck":false,"RemoteDetail":{"TimeOut":0,"TimeOutDoorStatus":"Close"},"RepeatEnterAlarm":false,"RepeatEnterTime":0,"SensorEnable":false,"State":"Normal","TimeSchedule":[[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}]],"UnlockHoldInterval":2,"UnlockReloadInterval":15},{"AccessProtocol":"Dahua","AutoRemoteCheck":{"Enable":false,"Time":255},"BreakInAlarmEnable":false,"CardNoConvert":0,"CloseAlwaysTime":255,"CloseTimeout":60,"CustomPasswordEnable":false,"DoorNotClosedAlarmEnable":false,"DuressAlarmEnable":true,"Enable":true,"FirstEnter":{"Enable":false,"Status":"Normal","Time":1},"HelmetEnable":false,"HolidayTime":255,"LockMode":2,"Method":42,"Name":"Door2","OpenAlwaysTime":255,"ProtocolType":0,"ReadCardState":0,"RemoteCheck":false,"RemoteDetail":{"TimeOut":0,"TimeOutDoorStatus":"Close"},"RepeatEnterAlarm":false,"RepeatEnterTime":0,"SensorEnable":false,"State":"Normal","TimeSchedule":[[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}]],"UnlockHoldInter', error: Expecting ',' delimiter: line 1 column 4046 (char 4045), Line: 588
and also
2023-09-14 11:13:59.089 Error: Visiophone: Initialization not completed; Retrying failed calls.
I got it. onMessage gets only a partial message from Domoticz or VTO (not sure which), therefore parsing those 2 partial messages that will give invalid messages and/or json twice. I've modified the plugin to attempt to prepend the previous unreadable message to the next one and attempt to parse it then.
This seems to fix this issue.
error message just after restart after update :
2023-09-14 16:19:11.113 Error: Visiophone: Unparseable data message received: b' \x00\x00\x00DHIP\xa2$BZ\x07\x00\x00\x00f\x10\x00\x00\x00\x00\x00\x00f\x10\x00\x00\x00\x00\x00\x00{"id":7,"params":{"table":[{"AccessProtocol":"Local","AutoRemoteCheck":{"Enable":false,"Time":255},"BreakInAlarmEnable":false,"CardNoConvert":0,"CloseAlwaysTime":255,"CloseTimeout":60,"CustomPasswordEnable":false,"DoorNotClosedAlarmEnable":false,"DuressAlarmEnable":true,"Enable":true,"FirstEnter":{"Enable":false,"Status":"Normal","Time":1},"HelmetEnable":false,"HolidayTime":255,"LockMode":2,"Method":42,"Name":"Door1","OpenAlwaysTime":255,"ProtocolType":0,"ReadCardState":0,"RemoteCheck":false,"RemoteDetail":{"TimeOut":0,"TimeOutDoorStatus":"Close"},"RepeatEnterAlarm":false,"RepeatEnterTime":0,"SensorEnable":false,"State":"Normal","TimeSchedule":[[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00' 2023-09-14 16:19:15.062 Error: Visiophone: Initialization not completed; Retrying failed calls. 2023-09-14 16:19:15.062 Error: Visiophone: Reloading access control factory instance.
Then everything seems fine
I believe the exceptions towards Domoticz are now handled. As long as it logs: "Initialized successfully" sooner or later, it is happy. Those "Errors" are errors, but no real issue. As the last one says: It just retries.
it happens 3 to 4 times / day :