Skip to content

Identity read (regs 0-7) ignores READ_ATTEMPTS, so one dropped reply aborts the add-on #686

Description

@heinrich321

Issue related to

Sunsynk Home Assistant Add-On

Describe the issue/bug

AInverter.read_identity() builds an Identity Component over self.inv.unit and calls
async_update(). That reads holding registers 0-7 directly off the unit, so it never goes through
Sunsynk.read_holding_registers() — the only place READ_ATTEMPTS is applied. There is no retry
anywhere in modbus_connection.model, so the identity read gets exactly one attempt no matter what
READ_ATTEMPTS is set to.

Because main_loop() turns any ConnectionError out of ist.connect() into return 2, one
dropped reply on one inverter aborts the whole add-on.

The asymmetry is visible in the log — every other read failure carries [attempt n/3], the fatal
one does not:

[11:33:14] ERROR   Read register 552 x7: ModbusTimeoutError: read_holding_registers(552, 7): Response timeout after 2 seconds [attempt 1/3]
[11:33:19] INFO    No response on the Modbus interface /dev/ttyACM1: read_holding_registers(0, 8): Response timeout after 2 seconds
[11:33:19] CRITICAL This Add-On will terminate in 30 seconds, use the Supervisor Watchdog to restart automatically.

With three inverters this becomes a restart loop: whichever port was left mid-transaction by the
previous SIGKILL is the one that misses next, and the ~6 s watchdog restart never gives the port
time to settle. Ports rotate between runs — 11:33:02 /dev/ttyACM2, 11:33:19 /dev/ttyACM1.

Lowering TIMEOUT makes it much more likely, since the single-shot read has no retries to absorb a
miss, but it also happens at TIMEOUT: 3.

Expected behavior The identity read honours READ_ATTEMPTS like every other holding-register
read, including the serial flush between attempts.

Your environment

  • Addon:
    • Name: sunsynk-edge
    • Version: 246721b
  • Inverter:
    • Make: Sunsynk
    • Model: high-voltage three-phase hybrid, 3 x 50 kW (identity reports device type 0x6,
      protocol 1.4)
  • Adaptor details:
    • RS485 over USB CDC, /dev/ttyACM0 .. /dev/ttyACM2, one adaptor per inverter

Your configuration

INVERTERS:
  - SERIAL_NR: "**********"
    HA_PREFIX: SS1
    MODBUS_ID: 1
    PORT: /dev/ttyACM0
  - SERIAL_NR: "**********"
    HA_PREFIX: SS2
    MODBUS_ID: 2
    PORT: /dev/ttyACM1
  - SERIAL_NR: "**********"
    HA_PREFIX: SS3
    MODBUS_ID: 3
    PORT: /dev/ttyACM2
SENSOR_DEFINITIONS: three-phase-hv
READ_ALLOW_GAP: 2
READ_SENSORS_BATCH_SIZE: 20
READ_MESSAGE_SPACING: 0.05
READ_ATTEMPTS: 3
TIMEOUT: 2

Logs

[11:33:10] INFO    sunsynk library - commit 246721b - last stable version 1.2.0
[11:33:10] INFO    Connecting to /dev/ttyACM0
[11:33:11] INFO    Identity: device_type=High-voltage three-phase hybrid (0x6) protocol=1.4 serial=****18594
[11:33:14] ERROR   Read register 552 x7: ModbusTimeoutError: read_holding_registers(552, 7): Response timeout after 2 seconds [attempt 1/3]
[11:33:17] INFO    Connecting to /dev/ttyACM1
[11:33:17] INFO    Reading inverter identity (registers 0-7)
[11:33:19] INFO    No response on the Modbus interface /dev/ttyACM1: read_holding_registers(0, 8): Response timeout after 2 seconds
[11:33:19] CRITICAL This Add-On will terminate in 30 seconds, use the Supervisor Watchdog to restart automatically.
[09:33:19] WARNING: Addon resource not ready 2
s6-supervise sunsynk: warning: finish script lifetime reached maximum value - sending it a SIGKILL
[11:33:25] INFO: Starting the Sunsynk add-on

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions