kellerza / sunsynk

Deye/Sunsynk Inverter Python library and Home Assistant OS Addon
https://kellerza.github.io/sunsynk/
MIT License
218 stars 91 forks source link

Modbus to Sunsynk inverter communication stops working after a while #359

Open HeinPi opened 19 hours ago

HeinPi commented 19 hours ago

Issue related to

Sunsynk / pymodbus with Home Assistant Add-On, modbus communication stops working after a while.

Describe the issue/bug

My modbus link to Sunsynk Inverter with HA addon was working perfectly for 6 months, until recently I started to get errors (see logs: nonzero urb status: -71) and the communication freezes (readings stay constant). Plugging the USB to RS485 adapter out and back in fixes the comms again. Happens again within 12 to 24 hours after restoring comms.

Your environment

You configuration

INVERTERS:
  - SERIAL_NR: "2xxxxxxx5"
    HA_PREFIX: SS
    MODBUS_ID: 1
    DONGLE_SERIAL_NUMBER: "0"
    PORT: /dev/ttyUSB0
SENSOR_DEFINITIONS: single-phase
SENSORS:
  - energy_management
  - power_flow_card
  - pv2_power
  - pv2_voltage
  - pv2_current
  - settings
SENSORS_FIRST_INVERTER: []
MANUFACTURER: Sunsynk
READ_ALLOW_GAP: 2
READ_SENSORS_BATCH_SIZE: 20
SCHEDULES:
  - KEY: W
    READ_EVERY: 5
    REPORT_EVERY: 5
    CHANGE_ANY: false
    CHANGE_BY: 50
    CHANGE_PERCENT: 0
NUMBER_ENTITY_MODE: box
PROG_TIME_INTERVAL: 15
MQTT_HOST: core-mosquitto
MQTT_PORT: 1883
MQTT_USERNAME: mosquitto_user
MQTT_PASSWORD: xxxx
DEBUG_DEVICE: /dev/ttyS0

Logs

From HA CLI:

[25228.851791] ftdi_sio ttyUSB0: error from flowcontrol urb
[25256.895267] ftdi_sio ttyUSB0: usb_serial_generic_write_bukl_callback - nonzero urb status: -71
[25256.949869] ftdi_sio ttyUSB0: error from flowcontrol urb
[63756.152281] ftdi_sio ttyUSB0: usb_serial_generic_write_bulk_callback - nonzero urb status: -71
kellerza commented 18 hours ago

Since you have direct serial, try adding the mbusd addon.

Then the sunsynk addon uses IP to mbusd adn mbusd connects to the serial interface. Mine is rock solid, and I run mbusd on an old Rpi 1B

HeinPi commented 18 hours ago

Thanks, will try it. PS. You're an absolute legend for creating and supporting this add-on so well! Thank you!

HeinPi commented 18 hours ago

I have it running with the mbusd now. So still using pymodbus with port tcp://homeassistant.local:502, is that the best way? Lets see if it resolves my issue.