kellerza / sunsynk

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

Standalone, where do I define the USB device? #230

Closed gurmukhp closed 6 months ago

gurmukhp commented 6 months ago

Issue related to

Sunsynk / mbusd Home Assistant Add-On

Describe the issue/bug

I've copied over options.yaml and the error I'm getting is: sunsynk-multi-1 | 17:57:45 INFO No response on the Modbus interface tcp://mbusd:502, see https://kellerza.github.io/sunsynk/guide/fault-finding

I haven't defined the dev/USB** device anywhere, I've just used the bundled mbus.

Do I need to define the USB device anywhere or should it 'just work'? I'm using the WAVE to USB adaptor.

Expected behavior Connect successfullly

Your environment

Your configuration

---
DRIVER: umodbus
INVERTERS:
- SERIAL_NR: '007'
  HA_PREFIX: SS
  MODBUS_ID: 1
  PORT: tcp://mbusd:502
SENSOR_DEFINITIONS: single-phase
SENSORS:
- total_pv_energy
- total_battery_charge
- total_battery_discharge
- total_grid_export
- total_grid_import
- battery_soc
SENSORS_FIRST_INVERTER: []
MANUFACTURER: Sunsynk
READ_SENSORS_BATCH_SIZE: 60
NUMBER_ENTITY_MODE: auto
MQTT_HOST: 192.168.68.53
MQTT_PORT: 1883
MQTT_USERNAME: ''
MQTT_PASSWORD: ''
DEBUG: 0
DEBUG_DEVICE: "/dev/ttyAMA0"

Logs


sunsynk-multi-1  | 17:57:44 INFO    Using Single phase sensor definitions.
sunsynk-multi-1  | 17:57:44 INFO    Added hidden sensors as other sensors depend on it: Rated power, Serial
sunsynk-multi-1  | 17:57:44 INFO    Connecting to tcp://mbusd:502
sunsynk-multi-1  | 17:57:44 INFO    Reading startup sensors Serial, Rated power
sunsynk-multi-1  | 17:57:44 ERROR   gaierror reading 15 registers from 3: [Errno -2] Name does not resolve
sunsynk-multi-1  | 17:57:44 ERROR   gaierror reading 15 registers from 3: [Errno -2] Name does not resolve
sunsynk-multi-1  | 17:57:44 ERROR   gaierror reading 15 registers from 3: [Errno -2] Name does not resolve
sunsynk-multi-1  | 17:57:44 WARNING Retrying individual sensors: ['serial', 'rated_power']
sunsynk-multi-1  | 17:57:45 ERROR   gaierror reading 5 registers from 3: [Errno -2] Name does not resolve Serial
sunsynk-multi-1  | 17:57:45 ERROR   gaierror reading 2 registers from 16: [Errno -2] Name does not resolve Rated power
sunsynk-multi-1  | 17:57:45 CRITICAL Could not read sensors: ['Serial', 'Rated power']
sunsynk-multi-1  | 17:57:45 INFO    ############################################################
sunsynk-multi-1  | 17:57:45 INFO    No response on the Modbus interface tcp://mbusd:502, see https://kellerza.github.io/sunsynk/guide/fault-finding
sunsynk-multi-1  | 17:57:45 INFO    ############################################################
sunsynk-multi-1  | 17:57:45 CRITICAL This Add-On will terminate in 30 seconds, use the Supervisor Watchdog to restart automatically.
kellerza commented 6 months ago

The USB port should be configured where you have the USB device plugged in.

If you refer to mbusd, you have to either run mbusd natively or on Docker. In this case you specify the USB config in mbusd

Otherwise you need to identify, and configure the USB port in the options.yaml

gurmukhp commented 6 months ago

Thanks for the quick reply, I'm not running any additional services for mbus, just the hass-addon-sunsynk-multi image. Should it be something like this?

DRIVER: umodbus
INVERTERS:
  - PORT: serial:///dev/ttyUSB0
kellerza commented 6 months ago

Yes, that looks better. I would use the pymodbus driver though, not umodbus

gurmukhp commented 6 months ago

Thanks, do I need to run any additional services in Docker or is just the main Sunsynk one enough?

DRIVER: pymodbus
INVERTERS:
  - PORT: /dev/ttyUSB0
gurmukhp commented 6 months ago

I got it working, I had to pass in the device to the docker compose file too::

services:
  sunsynk-multi:
    restart: unless-stopped
    image: ghcr.io/kellerza/hass-addon-sunsynk-multi/aarch64:stable
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
    volumes:
      - ./options.yaml:/data/options.yaml
---
DRIVER: pymodbus
INVERTERS:
- SERIAL_NR: '007'
  HA_PREFIX: SS
  MODBUS_ID: 1
  PORT: /dev/ttyUSB0

I could document this and raise a PR if you want?

kellerza commented 6 months ago

A PR would be welcome & help people in the future. Thanks!

gurmukhp commented 6 months ago

PErfect, I'll do that! thanks

championc commented 6 months ago

That fixed my issue too. I was resorting to using TCP access via the Logger, but I wanted to use a cable.