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

SH10RT Master & Slave #43

Open
Matze5593 opened this issue Jan 14, 2023 · 18 comments
Open

SH10RT Master & Slave #43

Matze5593 opened this issue Jan 14, 2023 · 18 comments

Comments

@Matze5593
Copy link

Gibt es die Möglichkeit 2 Wechselrichter einzubinden wenn man die Konstellation im Master und Slave hat?

@elektrinis
Copy link

Good question. I will be installing a second one soon.

Can we keep this in English please.

@mkaiser
Copy link
Owner

mkaiser commented Jan 14, 2023

hey,

that should work. See #16

Recently, one guy in the home assistant forum confirmed that he got it working:
https://community.home-assistant.io/t/sungrow-sh10-rt-modbus-integration/361356/35

@Matze5593
Copy link
Author

Matze5593 commented Jan 16, 2023

Unfortunately, the method described in #16 does not work. i tried to avoid duplicate names by using the designation 2 or slave. but dying didn't help.
modbus_sungrow2.yaml.txt

@mkaiser
Copy link
Owner

mkaiser commented Jan 17, 2023

copied this together with just 2 sensors, but I obviously cannot check without a second inverter, so I need your help here :)

When this works, the next step is more or less copy / paste for the other sensors

  1. copy the file (modbus_sungrow_inv2.yaml) next to the existing file (modbus_sungrow.yaml) in the integrations folder
  2. update your secrets.yaml accordingly (see the comments of modbus_sungrow_inv2.yaml
  3. Check and restart HA

modbus_sungrow_inv2.yaml.txt

@mkaiser mkaiser mentioned this issue Jan 20, 2023
@leo4417
Copy link

leo4417 commented Jan 26, 2023

This works with my two SH10RT! I've completed the 2nd yaml, see below.

modbus_sungrow2.yaml.txt

I have an additional question: when I try to write a modbus register like this, it's not working. Do you have any idea? Actually the "Set battery SoC reserve" doesn't work either. Perhaps the same problem?

alias: Battery-SoC 17
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.battery_level
    above: 90
condition: []
action:
  - service: modbus.write_register
    data:
      address: 13100
      hub: SungrowSHx
      slave: 2
      value: 17
mode: single

@mkaiser
Copy link
Owner

mkaiser commented Jan 27, 2023

great to know that this is working.

I will put this on the "ToDo" list, but final integration and documentation will take some time.

If you want to write to modbus register 13100 (reserved soc for backup), you need to decrement the address to 13099

copied from modbus_sungrow.yaml (arount line 1470)

    alias: "sungrow inverter update reserved soc for backup"
    description: "Updates reserved SoC for backup register"
    trigger:
      - platform: state
        entity_id:
          - input_number.set_sg_reserved_soc_for_backup
    condition: []
    action:
      - service: modbus.write_register
        data_template:
          hub: SungrowSHx
          slave: !secret sungrow_modbus_slave
          address: 13099 # reg 13100
          value: "{{ states('input_number.set_sg_reserved_soc_for_backup') | int}}"
    mode: single```


Does this help?

@leo4417
Copy link

leo4417 commented Jan 27, 2023

Yes, it works! Thanks!!
But for example, if I enter value: "70" the Battery SoC reserve (sensor.battery_soc_reserve) displays 7%, with "90" this changes to 9%, values above 100 have no effect. Where is my mistake?

@leo4417
Copy link

leo4417 commented Jan 27, 2023

This is known, I haven't seen it..

      - name: Battery SoC reserve 2
        unique_id: sg_battery_soc_reserve_2
        slave: !secret sungrow_modbus_slave_inv2
        address: 13099 # reg 13100
        input_type: holding
        count: 1
        data_type: uint16
        swap: word
        unit_of_measurement: "%"
        device_class: battery
        state_class: measurement
        scale: 1 **# NOT 0.1**
        scan_interval: 10

@leo4417
Copy link

leo4417 commented Jan 28, 2023

I tried to adjust the max_charge_power because battery system SunGrow SBR265 supports up to 17.520 W
Unfortunately this doesn't work... Perhaps the register isn't correct?

  set_sg_battery_max_charge_power:
    name: Set max battery charge power in W
    #initial: 40
    min: 0
    max: 17520
    step: 100

  set_sg_battery_max_discharge_power:
    name: Set max battery discharge power in W
    #initial: 40
    min: 0
    max: 17520
    step: 100

@Matze5593
Copy link
Author

Matze5593 commented Feb 7, 2023

In the secret.yaml, the slave inverter must be set as a Modbus slave from 1 to 2 in order to be able to query data via the sh10rt's Modbus port

z.B

`
#first inverter Master
sungrow_modbus_host_ip: 192.168.178.xx
sungrow_modbus_port: 502
sungrow_modbus_slave: 1

########################################################################

#second inverter Slave
sungrow_modbus_host_ip_inv2: 192.168.178.xx
sungrow_modbus_port_inv2: 502
sungrow_modbus_slave_inv2: 2 `

@bleughb
Copy link

bleughb commented May 26, 2023

This works with my two SH10RT! I've completed the 2nd yaml, see below.

modbus_sungrow2.yaml.txt

I have an additional question: when I try to write a modbus register like this, it's not working. Do you have any idea? Actually the "Set battery SoC reserve" doesn't work either. Perhaps the same problem?

alias: Battery-SoC 17
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.battery_level
    above: 90
condition: []
action:
  - service: modbus.write_register
    data:
      address: 13100
      hub: SungrowSHx
      slave: 2
      value: 17
mode: single

Thankyou.
Your YAML file worked perfectly for my TWO SG5.0RS
I'd spent a couple of hours trying to create a second modbus_sungrow.yaml file to handle two inverters!
Now I can plot my 4 MPPT string currents

@bleughb
Copy link

bleughb commented May 28, 2023

Quick heads up RE the dual YAML files - reduce increase the scan_interval time ...the default will flood the Winet-s devices and knock them offline.
i've taken mine to 60s at the moment and will see how it goes

@Matze5593
Copy link
Author

hi, i have problems with the power mppt 1/2. I don't understand how the code works and my mistake lies. I just don't get any values ​​for the power. Could you please help me

`

  • name: MPPT1 voltage inv 2
    unique_id: sg_mppt1_voltage_inv2
    slave: !secret sungrow_modbus_slave_inv2
    address: 5010 # reg 5011
    input_type: input
    count: 1
    data_type: uint16
    swap: word
    precision: 1
    unit_of_measurement: V
    device_class: Voltage
    scale: 0.1
    scan_interval: 10

    • name: MPPT1 current inv 2
      unique_id: sg_mppt1_current_inv2
      slave: !secret sungrow_modbus_slave_inv2
      address: 5011 # reg 5012
      input_type: input
      count: 1
      data_type: uint16
      swap: word
      precision: 2
      unit_of_measurement: A
      device_class: Current
      scale: 0.1
      scan_interval: 10

    • name: MPPT2 voltage inv 2
      unique_id: sg_mppt2_voltage_inv2
      slave: !secret sungrow_modbus_slave_inv2
      address: 5012 # reg 5013
      input_type: input
      count: 1
      data_type: uint16
      swap: word
      precision: 1
      unit_of_measurement: V
      device_class: Voltage
      scale: 0.1
      scan_interval: 10

    • name: MPPT2 current inv 2
      unique_id: sg_mppt2_current_inv2
      slave: !secret sungrow_modbus_slave_inv2
      address: 5013 # reg 5014
      input_type: input
      count: 1
      data_type: uint16
      swap: word
      precision: 2
      unit_of_measurement: A
      device_class: Current
      scale: 0.1
      scan_interval: 10

    • name: Total DC power inv 2
      unique_id: sg_total_dc_power_inv2
      slave: !secret sungrow_modbus_slave_inv2
      address: 5016 # reg 5017
      input_type: input
      count: 2
      data_type: uint32
      swap: word
      precision: 0
      unit_of_measurement: W
      device_class: power
      state_class: measurement
      scale: 1
      scan_interval: 10
      sensor:
      name: MPPT1_inv2 power
      unique_id: sg_mppt1_power_inv2
      unit_of_measurement: W
      device_class: power
      availability: "{{states('sensor.mppt1_voltage_inv2')|is_number and states('sensor.mppt1_current_inv2')|is_number }}"
      state: "{{ (states('sensor.mppt1_voltage_inv2') | float * states('sensor.mppt1_current_inv2') | float) |int }}"

name: MPPT2_inv2 power
unique_id: sg_mppt2_power_inv2
unit_of_measurement: W
device_class: power
availability: "{{states('sensor.mppt2_voltage_inv2')|is_number and states('sensor.mppt2_current_inv2')|is_number }}"
state: "{{ (states('sensor.mppt2_voltage_inv2') | float * states('sensor.mppt2_current_inv2') | float) |int }}"

@leo4417
Copy link

leo4417 commented Sep 8, 2023

Since the last update i get no data from my second inverter... Does anybody have an idea?

@Wolkenstuermer
Copy link

Wolkenstuermer commented Sep 10, 2023

Last HA Update broke my complete Sungrow INtegration for SH and SG... Think there are some issues between Modbus in HA Core and the Code (there is something with regards to uint/int16 needs swap: none ... but this did not help...

I will get deeper into this during the next week.

@dylan09
Copy link
Contributor

dylan09 commented Sep 10, 2023

Are you using the latest version of modbus.yaml file? There the error with swap is fixed.

Since HA 2023.9.x there are some new, weird ModBus issues. See 158

There you will find a link to the HA issue regarding the problems with ModBus.

@roennieinator
Copy link

I created a .yaml config file for my second inverter that works with Home Assistant 10.1.
I only included the sensors I really need, so of you like, feel free to complete the file - I was too lazy :)

If you want to use this, please follow the instructions given earlier in this thread.
Thanks to @bleughb for the "inspiration" (I basically stole your way of doing the config).

second_inverter_version_10_1.yml.txt

@howi303
Copy link

howi303 commented May 1, 2024

Has anyone two SH10RT-V112 as Master/Slave working and both combined shown in a flow chart?

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

9 participants