wasilukm / hoymiles-mqtt

Send data from Hoymiles PV plant to Home Assistant without cloud
MIT License
46 stars 8 forks source link

[Input/Output] Modbus Error: [Invalid Message] No response received #3

Closed kris-lwks closed 2 years ago

kris-lwks commented 2 years ago

Upon disconnecting the PV installation Hoymiles microinverters shut down and most of the MQQT parameters should change as the power production ceases.

What actually happens is that Home Assistant continues displaying the last known value (as on attached screenshot) and the modbus error appears in hoymiles-mqtt. I would expect that some of parameters, like temperature, are still valid and some should be either 0 or "no data" (like power production).

development-hoymiles_mqtt-1  | Exception in thread Thread-124:
development-hoymiles_mqtt-1  | Traceback (most recent call last):
development-hoymiles_mqtt-1  |   File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
development-hoymiles_mqtt-1  |     self.run()
development-hoymiles_mqtt-1  |   File "/usr/local/lib/python3.9/threading.py", line 917, in run
development-hoymiles_mqtt-1  |     self._target(*self._args, **self._kwargs)
development-hoymiles_mqtt-1  |   File "/hoymiles-mqtt/hoymiles_mqtt/runners.py", line 40, in execute
development-hoymiles_mqtt-1  |     plant_data = self._modbus_client.plant_data
development-hoymiles_mqtt-1  |   File "/usr/local/lib/python3.9/site-packages/hoymiles_modbus/client.py", line 111, in plant_data
development-hoymiles_mqtt-1  |     microinverter_data = self.microinverter_data
development-hoymiles_mqtt-1  |   File "/usr/local/lib/python3.9/site-packages/hoymiles_modbus/client.py", line 88, in microinverter_data
development-hoymiles_mqtt-1  |     result = self._read_registers(client, start_address, 20, self._unit_id)
development-hoymiles_mqtt-1  |   File "/usr/local/lib/python3.9/site-packages/hoymiles_modbus/client.py", line 74, in _read_registers
development-hoymiles_mqtt-1  |     raise result
development-hoymiles_mqtt-1  | pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)

Let me know if there is anything else I can try to test. I am very new to modbus but it got my interest and I can dig into this problem some more as I intend to connect these metrics with power consumption metrics (for instance from Zamel MEW-01).

Screenshot 2022-06-25 at 14 24 38
wasilukm commented 2 years ago

I could set a custom value for expire_after to most of the sensors. This should result in an unavailable state in case of communication issues. Is this what you are looking for?

kris-lwks commented 2 years ago

That should work I think. If we can't request data from the DTU it is safe to assume the data is unavailable.

wasilukm commented 2 years ago

In 0.2.0 I've added option expire-after. With it you can specify time when entities shall become unavailable in case of communication issues (no updates sent to Home Assistant). Here is an example chart for some entity with communication loss: obraz