Failed to write registers error

Post Reply
rw
Posts: 7
Joined: Fri Sep 13, 2024 1:51 pm

Hello,

Most days I see an error in my HA logs from the modbus integration. The time doesn't seem to coincide with any of my automations and I can't find the modbus map so I'm not sure which register this is trying to write?

The "Failed to write registers" error is then immediately followed with a "Error doing job: Task exception was never retrieved (None)". Output from both are below.

It doesn't seem to actually have had any effect on my inverter functioning normally that I can see. In fact its been flawless since the force charge whilst seeing solar bug was fixed, so I'm not too concerned about it but I guess would like to understand what's going on and fix it if possible.

Am running FoxESS - Modbus v1.12.2

Code: Select all

This error originated from a custom integration.

Logger: custom_components.foxess_modbus.modbus_controller
Source: custom_components/foxess_modbus/modbus_controller.py:222
integration: FoxESS - Modbus (documentation, issues)
First occurred: 5:09:47 AM (1 occurrences)
Last logged: 5:09:47 AM

Failed to write registers
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Modbus Error: [Connection] CustomModbusTcpClient 192.168.4.73:502: Connection unexpectedly closed 0.002 seconds into read of 8 bytes without response from slave before it closed connection

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/foxess_modbus/modbus_controller.py", line 222, in write_registers
    await self._client.write_registers(start_address, values, self._slave)
  File "/config/custom_components/foxess_modbus/client/modbus_client.py", line 180, in write_registers
    raise ModbusClientFailedError(message, self, response) from response
custom_components.foxess_modbus.client.modbus_client.ModbusClientFailedError: Error writing registers. Start: 44002; values: [61536]; slave: 247 from tcp://192.168.4.73:502: Modbus Error: [Input/Output] Modbus Error: [Connection] CustomModbusTcpClient 192.168.4.73:502: Connection unexpectedly closed 0.002 seconds into read of 8 bytes without response from slave before it closed connection

Code: Select all

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/foxess_modbus/client/modbus_client.py:180
integration: FoxESS - Modbus (documentation, issues)
First occurred: 5:09:47 AM (1 occurrences)
Last logged: 5:09:47 AM

Error doing job: Task exception was never retrieved (None)
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Modbus Error: [Connection] CustomModbusTcpClient 192.168.4.73:502: Connection unexpectedly closed 0.002 seconds into read of 8 bytes without response from slave before it closed connection

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/foxess_modbus/modbus_controller.py", line 373, in _refresh
    await self._remote_control_manager.poll_complete_callback()
  File "/config/custom_components/foxess_modbus/remote_control_manager.py", line 324, in poll_complete_callback
    await self._update()
  File "/config/custom_components/foxess_modbus/remote_control_manager.py", line 85, in _update
    await self._update_charge()
  File "/config/custom_components/foxess_modbus/remote_control_manager.py", line 182, in _update_charge
    await self._write_active_power(-max_import_power)
  File "/config/custom_components/foxess_modbus/remote_control_manager.py", line 121, in _write_active_power
    await self._controller.write_registers(self._addresses.active_power[-1], values)
  File "/config/custom_components/foxess_modbus/modbus_controller.py", line 238, in write_registers
    raise ex
  File "/config/custom_components/foxess_modbus/modbus_controller.py", line 222, in write_registers
    await self._client.write_registers(start_address, values, self._slave)
  File "/config/custom_components/foxess_modbus/client/modbus_client.py", line 180, in write_registers
    raise ModbusClientFailedError(message, self, response) from response
custom_components.foxess_modbus.client.modbus_client.ModbusClientFailedError: Error writing registers. Start: 44002; values: [61536]; slave: 247 from tcp://192.168.4.73:502: Modbus Error: [Input/Output] Modbus Error: [Connection] CustomModbusTcpClient 192.168.4.73:502: Connection unexpectedly closed 0.002 seconds into read of 8 bytes without response from slave before it closed connection
FoxESS H1-6.0-E-G2
4 x ECS2900 (11.5kWh)
16 x 455 across two strings
Dave Foster
Posts: 1294
Joined: Thu Oct 13, 2022 7:21 pm

44002 is the active power register used when you have selected the Force Discharge or Force Charge work modes.

The integration writes regularly to this register when in either of those modes so it suggests that your connection to the modbus adaptor may occasionally be being disrupted or you have your polling speed set slightly too fast for your infrastructure.

You can easily adjust your polling speed in Devices & Services, into the Foxess Modbus integration and select configure, advanced and add a couple of seconds to the poll rate you see there.
Monitor that for a couple of days and see whether you still see errors.
rw
Posts: 7
Joined: Fri Sep 13, 2024 1:51 pm

Thanks, and yes this is typically during a Force Charge period overnight. I've increased the poll rate to 12 seconds and will watch!
FoxESS H1-6.0-E-G2
4 x ECS2900 (11.5kWh)
16 x 455 across two strings
Post Reply