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

Multi Version - Direct serial interface #131

Open
cakuhn opened this issue Apr 21, 2023 · 29 comments
Open

Multi Version - Direct serial interface #131

cakuhn opened this issue Apr 21, 2023 · 29 comments
Labels
documentation Improvements or additions to documentation multi addon Issues related to the MULTI addon

Comments

@cakuhn
Copy link

cakuhn commented Apr 21, 2023

HI

On the latest version, installed this morning (Sunsynk Inverter Add-on (multi): Current version: 2023.04.20b-0.3.2 (Changelog)) I get the below errors as reported in the log. The application then crash. Any ideas on a possible fix and the reason for these?

Thanks

2023-04-21 07:32:39,121 ERROR Read Error: <class 'Exception'>: (1,59,1) 'Serial' object has no attribute 'host'
2023-04-21 07:32:52,742 ERROR Read Error: <class 'Exception'>: (1,268,6) 'Serial' object has no attribute 'host'
2023-04-21 07:33:03,835 ERROR Read Error: <class 'Exception'>: (1,59,1) 'Serial' object has no attribute 'host'
2023-04-21 07:33:18,948 ERROR Read Error: <class 'Exception'>: (1,59,1) 'Serial' object has no attribute 'host'
2023-04-21 07:34:38,121 ERROR Read Error: <class 'Exception'>: (1,78,1) 'Serial' object has no attribute 'host'

@kellerza
Copy link
Owner

kellerza commented Apr 21, 2023

@cakuhn can you try these options?

  1. pymodbus - Using the device selected in DEBUG_DEVICE (at the bottom of the settings)

    DRIVER: pymodbus
    INVERTERS:
      - PORT: ""
  2. Direct Serial + pymodbus

    DRIVER: pymodbus
    INVERTERS:
      - PORT: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A9007CPR-if00-port0
  3. Direct serial + umodbus

    DRIVER: umodbus
    INVERTERS:
      - PORT: serial:///dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A9007CPR-if00-port0
  4. umodbus via mbusd (and mbusd to serial)
    This will work, but won't help me to test the serial implementation.

@kellerza kellerza changed the title Multi Version - Read Errors - Crash Multi Version - Direct serial interface Apr 21, 2023
@kellerza kellerza added the multi addon Issues related to the MULTI addon label Apr 21, 2023
@Ko7Ad
Copy link

Ko7Ad commented Apr 24, 2023

I had the exact same issue after migrating to the new release. I am glad I came across this thread as, touch wood, Direct Serial + pymodbus seemed to have resolved it. I am using a RS485 to usb converter direct to my HA server.

There was a thread on powerforum with a user with the same issue, I will link them here for resolution. Update: See you already responded there.

PS. thanks for your work on this addon!

@hakonnissen
Copy link

Same failure on my side since upgrading to HassOS 10.1. I've tried all 3 methods above to no avail.

  • When using Direct Serial + pymodbus I get no errors, but also no sensors available:
    2023-05-01 17:01:07,796 INFO ############################################################
    2023-05-01 17:01:07,796 INFO Inverter serial number '2209272082'
    2023-05-01 17:01:07,796 INFO ############################################################
    2023-05-01 17:01:07,798 INFO MQTT: Connecting to [email protected]:1883

  • When using Direct serial + umodbus I get similar error as above:
    2023-05-01 17:06:40,723 ERROR Read Error: <class 'Exception'>: (1,16,2) 'Serial' object has no attribute 'host'
    2023-05-01 17:06:40,744 INFO ############################################################
    2023-05-01 17:06:40,744 INFO No response on the Modbus interface serial:///dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0, try checking the wiring to the Inverter, the USB-to-RS485 converter, etc

Any help would be appreciated. Thnx

@kellerza
Copy link
Owner

kellerza commented May 1, 2023

  • When using Direct Serial + pymodbus I get no errors, but also no sensors available:
    2023-05-01 17:01:07,796 INFO ############################################################
    2023-05-01 17:01:07,796 INFO Inverter serial number '2209272082'
    2023-05-01 17:01:07,796 INFO ############################################################
    2023-05-01 17:01:07,798 INFO MQTT: Connecting to [email protected]:1883

This is good. You either have no sensors in the addon config, or no auto-discovery enabled in HA

@hakonnissen
Copy link

Thnx for responding. I definitely haven't turned off auto-discovery in HA and my addon config lists the following sensors:

  • total_pv_energy
  • total_battery_charge
  • total_battery_discharge
  • total_grid_export
  • total_grid_import
  • battery_soc
    However on starting the addon with pymodbus, show me:
    2023-05-01 20:30:08,423 INFO Filter *last used for battery_soc, total_battery_charge, total_battery_discharge, total_grid_export, total_grid_import, total_pv_energy

I'm not a complete newb, but I must admit, this has had me pulling my hair out the last week! Any help would be appreciated. Thnx

@cakuhn
Copy link
Author

cakuhn commented May 2, 2023

DRIVER: pymodbus
INVERTERS:
  - PORT: ""

Thanks so much, This one worked for me "pymodbus - Using the device selected in DEBUG_DEVICE (at the bottom of the settings)".

All time out errors experienced on the original version is also gone now. Using the NOW sensors, it also updates almost instantly by the second. AWESOMENESS

@kellerza
Copy link
Owner

kellerza commented May 2, 2023

Thnx for responding. I definitely haven't turned off auto-discovery in HA and my addon config lists the following sensors:

  • total_pv_energy
  • total_battery_charge
  • total_battery_discharge
  • total_grid_export
  • total_grid_import
  • battery_soc
    However on starting the addon with pymodbus, show me:
    2023-05-01 20:30:08,423 INFO Filter *last used for battery_soc, total_battery_charge, total_battery_discharge, total_grid_export, total_grid_import, total_pv_energy

I'm not a complete newb, but I must admit, this has had me pulling my hair out the last week! Any help would be appreciated. Thnx

Best to open your own issue, as the driver seems to only be one of your problems. Please include all detail there including your mqtt server info

@hakonnissen
Copy link

Thnx guys. After much struggling, the problem was the connection to the MQTT server! Prior to HassOS 10.1, connecting to HA internal MQTT server on 127.0.0.1 was working fine, but fails for some reason in 10.1.
FINALLY working again. Thanks for a great addon!

@kellerza
Copy link
Owner

kellerza commented May 2, 2023

Thnx guys. After much struggling, the problem was the connection to the MQTT server! Prior to HassOS 10.1, connecting to HA internal MQTT server on 127.0.0.1 was working fine, but fails for some reason in 10.1.

in most cases core-mosquitto (the default) should work fine. 127.0.0.1 is not expected to work in standard Docker, as this points to the addon container itself

FINALLY working again. Thanks for a great addon!

👍🏼

@NeillHerbst
Copy link

NeillHerbst commented Aug 15, 2023

@cakuhn can you try these options?

  1. pymodbus - Using the device selected in DEBUG_DEVICE (at the bottom of the settings)
    DRIVER: pymodbus
    INVERTERS:
      - PORT: ""
  2. Direct Serial + pymodbus
    DRIVER: pymodbus
    INVERTERS:
      - PORT: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A9007CPR-if00-port0
  3. Direct serial + umodbus
    DRIVER: umodbus
    INVERTERS:
      - PORT: serial:///dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A9007CPR-if00-port0
  4. umodbus via mbusd (and mbusd to serial)
    This will work, but won't help me to test the serial implementation.

I have a similar issue as reported at the opening of the issue. All pymodbus options give me the following error:

2023-08-15 19:28:56,497 INFO    Loading HASS OS configuration
2023-08-15 19:28:56,736 INFO    Using Single phase sensor definitions.
2023-08-15 19:28:56,740 INFO    Connecting to /dev/serial/by-id/usb-Exar_Corp._XR21B1411_E5019832061-if00
2023-08-15 19:28:56,741 INFO    PyModbus 3.2.2 Serial: /dev/serial/by-id/usb-Exar_Corp._XR21B1411_E5019832061-if00
2023-08-15 19:28:56,745 INFO    Serial connected.
2023-08-15 19:28:56,747 INFO    Connected to /dev/serial/by-id/usb-Exar_Corp._XR21B1411_E5019832061-if00
2023-08-15 19:28:56,747 INFO    Reading startup sensors rated_power, serial
2023-08-15 19:28:59,756 INFO    Serial lost connection.
2023-08-15 19:28:59,758 INFO    Serial lost connection.
2023-08-15 19:28:59,759 WARNING Ignoring launch of delayed reconnection, another is in progress
2023-08-15 19:28:59,766 ERROR   timeout reading register 3 (5)
2023-08-15 19:28:59,767 INFO    ############################################################
2023-08-15 19:28:59,768 INFO    No response on the Modbus interface /dev/serial/by-id/usb-Exar_Corp._XR21B1411_E5019832061-if00, try checking the wiring to the Inverter, the USB-to-RS485 converter, etc
2023-08-15 19:28:59,768 INFO    ############################################################
2023-08-15 19:28:59,769 CRITICAL This Add-On will terminate in 30 seconds, use the Supervisor Watchdog to restart automatically.
2023-08-15 19:28:59,869 INFO    Serial connected.
2023-08-15 19:28:59,871 INFO    Connected to /dev/serial/by-id/usb-Exar_Corp._XR21B1411_E5019832061-if00

The umodbus options gives me the same error: 'Serial' object has no attribute 'host'

The cable should work as I have tested it with a SolarAssitant setup, however, that was on a Deye 5kw inverter. I'm trying to install this add-on on a Sunsynk 8kW,

mbusb does not seem to connect.

@kellerza Any ideas?

@kellerza
Copy link
Owner

Try the faul finding guide & make sure you plug it into the correct port - see the adaptors & wiring page. Maybe this is a newer model with a shared port?

https://kellerza.github.io/sunsynk/guide/fault-finding

@kellerza kellerza added the documentation Improvements or additions to documentation label Aug 18, 2023
@NeillHerbst
Copy link

I've tried both ports to test whether it is a combined port. I've also checked everything on the fault finding page.

As stated previously the cable wiring is definitely correct as it work on a previous SolarAssistant setup. Is there a way to check the port on the Inverter, i.e. that it is actually working.

@kellerza
Copy link
Owner

Try from your laptop with modbuspoll/modbus CLI

If still not working ~R100 will get you a different RS485 adaptor & run a short wire while standing next to the inverter.

Personally, I would just redo the wire since you changed the Inverter

@Leecavturbo
Copy link

Leecavturbo commented Sep 3, 2023

Ok I preserved ( 11hrs solid lol ) .
I got a connection after entering the inverter serial number and changing port to “ “.
So the log went further than before but stopped at seemingly waiting for mqtt ? So I added mqtt broker and now it works except I’m missing some data like pv2 and total solar ( pv1+pv2 ). How can I add the sensor ?
also power flow card doesn’t show data.
09:10:04 INFO Inverter serial number '****6757'
09:10:04 INFO ############################################################
09:10:04 INFO MQTT: Connecting to Home@core-mosquitto:1883

Then after broker install

09:10:08 INFO MQTT: Connection successful
09:10:08 INFO Read every (inverter 1)
+-----+---------------------------------------------------------------------------------+
| s | Sensors |
+-----+---------------------------------------------------------------------------------+
| 2 | grid_ct_power, inverter_power, grid_power, pv1_power, battery_power, aux_power, |
| | non_essential_power, essential_power |
| 5 | prog1_power, prog5_capacity, prog3_charge, prog3_time, prog4_capacity, |
| | prog1_time, prog1_charge, prog6_capacity, use_timer, load_limit, prog5_time, |
| | prog3_capacity, prog6_power, prog2_time, battery_low_capacity, prog2_capacity, |
| | prog4_charge, priority_load, prog5_charge, prog1_capacity, prog2_power, |
| | prog6_time, prog5_power, prog2_charge, prog4_power, prog6_charge, prog4_time, |
| | prog3_power |
| 15 | grid_frequency, overall_state, battery_soc, battery_voltage, grid_voltage, |
| | pv1_current, grid_connected, battery_current, inverter_current, pv1_voltage, |
| | load_frequency |
| 300 | total_grid_import, day_battery_discharge, total_pv_energy, |
| | total_battery_discharge, day_battery_charge, total_battery_charge, |
| | day_pv_energy, day_grid_export, total_grid_export, day_grid_import, |
| | day_load_energy |
+-----+---------------------------------------------------------------------------------+
09:10:09 INFO Report every (inverter 1)
+-----+----------------------------------------------------------------------------------+
| s | Sensors |
+-----+----------------------------------------------------------------------------------+
| 2 | grid_ct_power, inverter_power, grid_power, pv1_power, battery_power, aux_power, |
| | non_essential_power, essential_power |
| 300 | overall_state, prog1_power, day_pv_energy, battery_soc, prog3_charge, |
| | prog3_time, prog4_capacity, prog5_capacity, prog1_time, day_grid_import, |
| | prog1_charge, day_load_energy, prog6_capacity, use_timer, load_limit, |
| | total_battery_charge, prog5_time, day_grid_export, load_frequency, |
| | prog3_capacity, prog6_power, day_battery_discharge, prog2_time, |
| | battery_low_capacity, total_pv_energy, prog2_capacity, day_battery_charge, |
| | priority_load, prog4_charge, battery_voltage, prog5_charge, prog1_capacity, |
| | battery_current, inverter_current, total_grid_export, pv1_voltage, prog2_power, |
| | prog6_time, prog5_power, prog2_charge, total_grid_import, grid_frequency, |
| | total_battery_discharge, grid_voltage, pv1_current, grid_connected, prog4_power, |
| | prog6_charge, prog4_time, prog3_power |
+-----+----------------------------------------------------------------------------------+

@kellerza
Copy link
Owner

kellerza commented Sep 3, 2023

@Leecavturbo nice!

The docs will show you that pv2_power is another sensor. There is no combined sensor for pv1+pv2 today, but you can build one with mysensors or a template (mysensors is probably more accurate)

If power flow card shows nothing you probably have incorrect entity names. Check these under devices/dev tools- state

@Leecavturbo
Copy link

@Leecavturbo nice!

The docs will show you that pv2_power is another sensor. There is no combined sensor for pv1+pv2 today, but you can build one with mysensors or a template (mysensors is probably more accurate)

If power flow card shows nothing you probably have incorrect entity names. Check these under devices/dev tools- state

Thanks any / all help pointers appreciated for a novice 👍

@N1c084
Copy link
Contributor

N1c084 commented Sep 3, 2023

You can use total PV energy sensor for the flow chart .
System do the calcul automatically and show only the day prod .

@Leecavturbo
Copy link

You can use total PV energy sensor for the flow chart .
System do the calcul automatically and show only the day prod .

Does that give Pv1+Pv2 power ? Not Kwh

@N1c084
Copy link
Contributor

N1c084 commented Sep 3, 2023 via email

@Leecavturbo
Copy link

Leecavturbo commented Sep 3, 2023

Yes kWh but the HA flow chart only use kWh or you talking about other flow chart? Le dim. 3 sept. 2023 à 17:23, Leecavturbo @.***> a écrit :

Pv1 power shows the instantaneous KW of that mppt ( string ). pv2 and the combined is what I’m after in kw

@kellerza kellerza pinned this issue Sep 13, 2023
@ech0-py
Copy link

ech0-py commented Sep 15, 2023

You can use total PV energy sensor for the flow chart .
System do the calcul automatically and show only the day prod .

Does that give Pv1+Pv2 power ? Not Kwh

SENSORS += MathSensor((186, 187), "PV power sum", WATT, factors=(1, 1))
That works for me, in case you wanna sum of pv1+pv2 in a single sensor
(see this for details, it requires a some hand work)

@Leecavturbo
Copy link

Leecavturbo commented Sep 16, 2023

You can use total PV energy sensor for the flow chart .
System do the calcul automatically and show only the day prod .

Does that give Pv1+Pv2 power ? Not Kwh

SENSORS += MathSensor((186, 187), "PV power sum", WATT, factors=(1, 1)) That works for me, in case you wanna sum of pv1+pv2 in a single sensor (see this for details, it requires a some hand work)

Wouldn’t even know where to start and I’ve never seen pv2 (187) as a sensor so suspect more work before your math sensor 👍

@kellerza
Copy link
Owner

I've been wondering if I should not simply add an all group? (especially for people not reading the docs 😉)

pv2_power is now part of the defaults just to show people you can add other sensors. here - do we need to add more defaults?

@kellerza
Copy link
Owner

SENSORS += MathSensor((186, 187), "PV power sum", WATT, factors=(1, 1)) That works for me, in case you wanna sum of pv1+pv2 in a single sensor (see this for details, it requires a some hand work)

Nice solution.

If you use the power flow card you can also visualize two separate sensors and see the total in the UI -

@Leecavturbo
Copy link

You can use total PV energy sensor for the flow chart .
System do the calcul automatically and show only the day prod .

Does that give Pv1+Pv2 power ? Not Kwh

SENSORS += MathSensor((186, 187), "PV power sum", WATT, factors=(1, 1)) That works for me, in case you wanna sum of pv1+pv2 in a single sensor (see this for details, it requires a some hand work)

got samba working and established i can create the .py from windows as notepad save as > in the share/hass-addon . but the code from 'here' link doesn't give your example. just add text below to the code ?

@Leecavturbo
Copy link

to update pv1 +pv2 sum is now working with SS add-on. Sensor = pv lowercase.

@Leecavturbo
Copy link

Leecavturbo commented Sep 19, 2023

Anyone know what the sensor for UPS load is ? load_2 or output_2 eg ?

@ech0-py
Copy link

ech0-py commented Sep 20, 2023

Anyone know what the sensor for UPS load is ? load_2 or output_2 eg ?

If you meant backup power output I guess you should read issues about all that sensors ("essentials" is a load on backup output):
https://github.com/kellerza/sunsynk/blob/main/src/sunsynk/definitions.py#L91-L104

@RenierBoshoff
Copy link

RenierBoshoff commented Nov 29, 2024

Hallo good people.

With Direct Serial interface, how can I get two inverters to detect?
I have two SunSynk 8kW inverters in parallel as single phase, and when I can get read outs from each separately (the MQTT detects two devices) (ie. comms working) but not together.

Any ideas what I can do?
Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation multi addon Issues related to the MULTI addon
Projects
None yet
Development

No branches or pull requests

9 participants