Closed ThomasCr closed 1 year ago
okay, after all I add a debug log from the plugin.
2022-11-12 12:24:37 WARNING plugins.viessmann parsed datestring for given value 2022-11-12 12:24:32 as: 202211126122432
2022-11-12 12:24:37 WARNING plugins.viessmann modded datestring after insert weekday: 2022111206122432
2022-11-12 12:24:37 DEBUG plugins.viessmann Created value bytes for type datetime as bytes: b' "\x11\x12\x06\x12$2'
2022-11-12 12:24:37 DEBUG plugins.viessmann Payload length is: 8 bytes
2022-11-12 12:24:37 DEBUG plugins.viessmann Created command Systemtime to be sent as hexstring: 01f4088e082022111206122432 and as bytes: bytearray(b'\x01\xf4\x08\x8e\x08 "\x11\x12\x06\x12$2') with value 2022-11-12 12:24:32 (transf
ormed to value byte 2022111206122432)
2022-11-12 12:24:39 DEBUG plugins.viessmann Starting sync loop - attempt 2/5
2022-11-12 12:24:39 DEBUG plugins.viessmann Got sync. Commencing command send
2022-11-12 12:24:39 DEBUG plugins.viessmann Successfully sent packet: 01f7210808
2022-11-12 12:24:39 DEBUG plugins.viessmann Trying to receive 8 bytes of the response
2022-11-12 12:24:39 DEBUG plugins.viessmann Received 8 bytes chunk of response as hexstring 20233b48737888b0 and as bytes b' #;Hsx\x88\xb0'
2022-11-12 12:24:39 DEBUG plugins.viessmann Response decoded to: commandcode: 2108, responsedatacode: 1, valuebytecount: 8, responsetypecode: 1
2022-11-12 12:24:39 DEBUG plugins.viessmann Starting sync loop - attempt 1/5
2022-11-12 12:24:39 DEBUG plugins.viessmann Rawdatabytes formatted: 20233b48737888b0 and unformatted: bytearray(b' #;Hsx\x88\xb0')
2022-11-12 12:24:39 DEBUG plugins.viessmann Matched command Timer_Warmwasser_Di and read transformed timer [{'An': '04:00', 'Aus': '04:30'}, {'An': '07:30', 'Aus': '09:00'}, {'An': '14:30', 'Aus': '15:00'}, {'An': '17:00', 'Aus':
'22:00'}] and byte length 8
2022-11-12 12:24:39 DEBUG plugins.viessmann process_response_timer: 2108
2022-11-12 12:24:39 DEBUG plugins.viessmann Viessmann timer dict: {'Timer_Warmwasser': {'Timer_Warmwasser_Mo': [{'An': '04:00', 'Aus': '04:30'}, {'An': '07:30', 'Aus': '09:00'}, {'An': '14:30', 'Aus': '15:00'}, {'An': '17:00', 'Au
s': '22:00'}], 'Timer_Warmwasser_Di': [{'An': '04:00', 'Aus': '04:30'}, {'An': '07:30', 'Aus': '09:00'}, {'An': '14:30', 'Aus': '15:00'}, {'An': '17:00', 'Aus': '22:00'}]}}
2022-11-12 12:24:39 DEBUG plugins.viessmann send_timer_commands Timer_Warmwasser_Mi
2022-11-12 12:24:39 DEBUG plugins.viessmann Got a new read job: Command Timer_Warmwasser_Mi
2022-11-12 12:24:39 DEBUG plugins.viessmann Build read packet for command Timer_Warmwasser_Mi
2022-11-12 12:24:39 DEBUG plugins.viessmann Created command Timer_Warmwasser_Mi to be sent as hexstring: 01f7211008 and as bytes: bytearray(b'\x01\xf7!\x10\x08')
2022-11-12 12:24:41 DEBUG plugins.viessmann Starting sync loop - attempt 2/5
2022-11-12 12:24:41 DEBUG plugins.viessmann Got sync. Commencing command send
2022-11-12 12:24:41 DEBUG plugins.viessmann Successfully sent packet: 01f4088e082022111206122432
2022-11-12 12:24:41 DEBUG plugins.viessmann Trying to receive 1 bytes of the response
2022-11-12 12:24:41 DEBUG plugins.viessmann Received 1 bytes chunk of response as hexstring 00 and as bytes b'\x00'
2022-11-12 12:24:41 DEBUG plugins.viessmann Response decoded to: commandcode: 088e, responsedatacode: 1, valuebytecount: 1, responsetypecode: 1
2022-11-12 12:24:41 DEBUG plugins.viessmann Starting sync loop - attempt 1/5
2022-11-12 12:24:41 DEBUG plugins.viessmann Rawdatabytes formatted: 00 and unformatted: bytearray(b'\x00')
2022-11-12 12:24:41 ERROR logics.viess_fixTime In der Logik ist ein Fehler aufgetreten:
Logik 'viess_fixTime', Datei '/usr/lib/python3.9/_strptime.py', Zeile 349
function _strptime(), Exception: time data '00' does not match format '%Y%m%d%W%H%M%S'
Traceback (most recent call last):
File "/opt/smarthome/lib/scheduler.py", line 724, in _execute_logic_task
exec(logic._bytecode, logic_globals)
File "/opt/smarthome/logics/viess_fixtime.py", line 26, in <module>
plug.write_addr('088e', sys_cur_time)
File "/opt/smarthome/plugins/viessmann/__init__.py", line 488, in write_addr
return self._parse_response(response_packet, commandname)
File "/opt/smarthome/plugins/viessmann/__init__.py", line 1446, in _parse_response
value = datetime.strptime(rawdatabytes.hex(), '%Y%m%d%W%H%M%S').isoformat()
File "/usr/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/lib/python3.9/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '00' does not match format '%Y%m%d%W%H%M%S'
2022-11-12 12:24:43 DEBUG plugins.viessmann Starting sync loop - attempt 2/5
2022-11-12 12:24:43 DEBUG plugins.viessmann Got sync. Commencing command send
2022-11-12 12:24:43 DEBUG plugins.viessmann Successfully sent packet: 01f7211008
if i read the vcontrol documentation correctly, the return value 00 simply means ok So why the plugin try to parse the response to datetime.
The interpretation of 0x00 as "OK" seems plausible with the KW2 protocol.
Unfortunately, I can not test these formats myself as my device doesn't seem to have the timer functions.
Maybe @sisamiwe can help with the date/time-functions, afair he implemented these...?
Update: ich bekomme bei meiner Anlage 088e mit 8 Bytes ausgelesen, im Hex-Format liefert das Plugin ae0bae0b8f012f01. Daraus kann ich weder einen (durch strptime) parsebaren String noch eine vernünftige Datums-/Zeitangabe extrahieren.
Noch ein Nachtrag: dein Log ist irgendwie durcheinander - da werden mehrere Command gelesen, aber die Debug-Ausgaben davon, welches Kommando zusammengesetzt wird und welches gesendet und welches ggf. empfangen wird, sind ziemlich über kreuz.
Kannst du ggf. mal alle Scheduler bzw. cyclic Items deaktivieren und - manuell? - einmal 088e (Systemtime) und einman 2110 (Timer Mi) lesen? Idealerweise ist dann der gesamte Sende-/Lesevorgang jeder Adresse für sich zusammenhängend...
proposed fix in develop, please test it on KW protocol
@ThomasCr hast du Zeit gehabt mal zu prüfen, ob es jetzt geht?
Solange es kein negatives Feedback gibt, schließe ich das. Sollte aus meiner Sicht erledigt sein.
Hi,
these days, after updating shNG incl. updating python3.8 to python3.9 I saw the following error in the log.
At first I thought it was my logic. @Morg42 pointed me to relevant code part: https://github.com/smarthomeNG/plugins/blob/develop/viessmann/__init__.py#L1228
But after I manually ran the values at the Python shell, I saw that the values were actually correct and also the call in
_build_valuebytes_from_value
forvaluetype == 'datetime'
to do thestrftime
is good.So I was wondering, where the heck this happends... After missing a good old Stacktrace I was digging around to find how to add it. Which led to the following simple solution.
Now my log entry looked like this:
So the error is at the processing of the reply. Maybe we need first to replace the leading 0 from the weekday?
Oh, and my unit is a V200KW2 which uses KW protocol.