Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HeinPi opened this issue Nov 4, 2024 · 5 comments
Open

Comments

@HeinPi
Copy link

HeinPi commented Nov 4, 2024

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

  • HA running in a VM (VM Workstation Player) on Windows host.
  • Home Assistant Core 2024.9.1, Home Assistant OS 13.1
  • Addon:
    • Name: sunsynk-multi
    • Version: 0.7.0 (Was on 0.7.4, reverted back to 0.7.0 to see if it was breaking change, but was not the cause)
  • Inverter:
    • Make: Sunsynk
    • Model: 8kW Inverter 1-phase
    • Firmware: TBD
  • Adaptor details:
    • Wave USB to RS485 W17286 (Plugged into Windows host pc, usb routed to HA VM)

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
Copy link
Owner

kellerza commented Nov 4, 2024

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
Copy link
Author

HeinPi commented Nov 4, 2024

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

@HeinPi
Copy link
Author

HeinPi commented Nov 4, 2024

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.

@HeinPi
Copy link
Author

HeinPi commented Nov 26, 2024

Issue still persists with mbusd, I tried to eliminate a couple of environmental variables like different usb port, possible emf interference from other hardware, redoing wire connections. Any suggestions would be welcome.

@kellerza
Copy link
Owner

What happens if you restart the addon once in this state? Or do you have to unplug it?

Seems this can happen with dodgy & fakes serial devices, but in your case you mentioned that it worked for 6 months. see here

Might be worth trying a new USB to RS485 adapter, maybe you had a surge/lightning?
The Waveshare one I use has surge protection + GND, so should be ok to use fairly long twisted pair cable. (For fault finding you can try make it as short as possible to eliminate the cable/interference)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants