Browse Source

Merge pull request #578 from PaeserBastelstube/RPI-simplify-and-extend-some-debug-messages

Rpi simplify and extend some debug messages
pull/583/head
Lukas Pusch 2 years ago
committed by GitHub
parent
commit
4c5a01fe2d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      tools/rpi/hoymiles/__main__.py
  2. 8
      tools/rpi/hoymiles/decoders/__init__.py

13
tools/rpi/hoymiles/__main__.py

@ -168,18 +168,7 @@ def poll_inverter(inverter, dtu_ser, do_init, retries):
data = result.__dict__()
if hoymiles.HOYMILES_DEBUG_LOGGING:
dbg = f'{c_datetime} Decoded: temp={data["temperature"]}, total={data["energy_total"]/1000:.3f}'
if data['powerfactor'] is not None:
dbg += f', pf={data["powerfactor"]}'
phase_id = 0
for phase in data['phases']:
dbg += f' phase{phase_id}=voltage:{phase["voltage"]}, current:{phase["current"]}, power:{phase["power"]}, frequency:{data["frequency"]}'
phase_id = phase_id + 1
string_id = 0
for string in data['strings']:
dbg += f' string{string_id}=voltage:{string["voltage"]}, current:{string["current"]}, power:{string["power"]}, total:{string["energy_total"]/1000}, daily:{string["energy_daily"]}'
string_id = string_id + 1
logging.debug(dbg)
logging.debug(f'{c_datetime} Decoded: {result.__dict__()}')
if 'event_count' in data:
if event_message_index[inv_str] < data['event_count']:

8
tools/rpi/hoymiles/decoders/__init__.py

@ -333,7 +333,11 @@ class HardwareInfoResponse(UnknownResponse):
{ FLD_FW_VERSION, UNIT_NONE, CH0, 0, 2, 1 },
{ FLD_FW_BUILD_YEAR, UNIT_NONE, CH0, 2, 2, 1 },
{ FLD_FW_BUILD_MONTH_DAY, UNIT_NONE, CH0, 4, 2, 1 },
{ FLD_HW_ID, UNIT_NONE, CH0, 8, 2, 1 }
{ FLD_unknown, UNIT_NONE, CH0, 6, 2, 1 },
{ FLD_HW_ID, UNIT_NONE, CH0, 8, 2, 1 },
{ FLD_unknown, UNIT_NONE, CH0, 10, 2, 1 },
{ FLD_unknown, UNIT_NONE, CH0, 12, 2, 1 },
{ FLD_CRC-M, UNIT_NONE, CH0, 14, 2, 1 }
};
self.response = bytes('\x27\x1a\x07\xe5\x04\x4d\x03\x4a\x00\x68\x00\x00\x00\x00\xe6\xfb', 'latin1')
"""
@ -345,6 +349,8 @@ class HardwareInfoResponse(UnknownResponse):
fw_build_mm = int(fw_build_mmdd / 100)
fw_build_dd = int(fw_build_mmdd % 100)
logging.debug(f'Firmware: {fw_version_maj}.{fw_version_min}.{fw_version_pat} build at {fw_build_dd}/{fw_build_mm}/{fw_build_yyyy}, HW revision {hw_id}')
responce_info = self.response
logging.debug(f'HardwareInfoResponse: {struct.unpack(">HHHHHHHH", responce_info)}')
class DebugDecodeAny(UnknownResponse):
"""Default decoder"""

Loading…
Cancel
Save