mkaiser / Sungrow-SHx-Inverter-Modbus-Home-Assistant

Sungrow SH Integration for Home Assistant for SH3K6, SH4K6, SH5K-20, SH5K-V13, SH3K6-30, SH4K6-30, SH5K-30, SH3.RS, SH3.6RS, SH4.0RS, SH5.0RS, SH6.0RS, SH5.0RT, SH6.0RT, SH8.0RT, SH10RT, SH5.0RT-20, SH6.0RT-20, SH8.0RT-20, SH10RT-20, SH5.0RT-V112, SH6.0RT-V112, SH8.0RT-V112, SH10RT-V112, SH5.0RT-V122, SH6.0RT-V122, SH8.0RT-V122, SH10RT-V122, SH4.6R
378 stars 95 forks source link

Meter voltage #185

Closed kalaws closed 1 week ago

kalaws commented 1 year ago

Through the Local access function one can see volt and ampere for each phase being reported at the point of the smart meter. Might these values be available in the modbus register? I have a SH10RT myself.

1D55FA4E-A171-4F63-ABA5-7B9EEC0DE8AF_1_105_c

mkaiser commented 1 year ago

Was really happy to find some registers here: https://www.photovoltaikforum.com/thread/166134-daten-lesen-vom-sungrow-wechselrichtern-modbus/?postID=3324464#post3324464

... but it does not work as expected :/

image

I don't have much time to debug... Can someone try it and give me a feedback, what the readback values are and additionally what happens, if the grid is off?

I assume that template sensors similar to "Meter active power raw" are needed. But I have no backup stuff here :)

add to the sensors section

      # https://www.photovoltaikforum.com/thread/166134-daten-lesen-vom-sungrow-wechselrichtern-modbus/?postID=3324464#post3324464

      # https://www.photovoltaikforum.com/thread/166134-daten-lesen-vom-sungrow-wechselrichtern-modbus/?postID=3324464#post3324464
      - name: Meter voltage phase A
        unique_id: sg_meter_voltage_phase_a
        device_address: !secret sungrow_modbus_slave
        address: 5742 # reg 5741
        input_type: input
        data_type: int16
        precision: 0
        unit_of_measurement: V
        device_class: voltage
        state_class: measurement
        scale: 0.1
        scan_interval: 10

      - name: Meter voltage phase B
        unique_id: sg_meter_voltage_phase_b
        device_address: !secret sungrow_modbus_slave
        address: 5743 # reg 5742
        input_type: input
        data_type: int16
        precision: 0
        unit_of_measurement: V
        device_class: voltage
        state_class: measurement
        scale: 0.1
        scan_interval: 10

      - name: Meter voltage phase C
        unique_id: sg_meter_voltage_phase_c
        device_address: !secret sungrow_modbus_slave
        address: 5744 # reg 5743
        input_type: input
        data_type: int16
        precision: 0
        unit_of_measurement: V
        device_class: voltage
        state_class: measurement
        scale: 0.1
        scan_interval: 10

      - name: Meter current phase A
        unique_id: sg_meter_current_phase_a
        device_address: !secret sungrow_modbus_slave
        address: 5745 # reg 5744
        input_type: input
        data_type: int16
        precision: 0
        unit_of_measurement: A
        device_class: current
        state_class: measurement
        scale: 0.01
        scan_interval: 10

      - name: Meter current phase B
        unique_id: sg_meter_current_phase_b
        device_address: !secret sungrow_modbus_slave
        address: 5746 # reg 5745
        input_type: input
        data_type: int16
        precision: 0
        unit_of_measurement: A
        device_class: current
        state_class: measurement
        scale: 0.01
        scan_interval: 10

      - name: Meter current phase C
        unique_id: sg_meter_current_phase_c
        device_address: !secret sungrow_modbus_slave
        address: 5747 # reg 5746
        input_type: input
        data_type: int16
        precision: 0
        unit_of_measurement: A
        device_class: current
        state_class: measurement
        scale: 0.01
        scan_interval: 10
kalaws commented 1 year ago

All I get is "unavailable". But then I'm using WiNet. "Meter phase A active power" etc work however.

dylan09 commented 1 year ago

Maybe the newly added registers in documentation depends on a newer firmware from SunGrow?

mkaiser commented 1 year ago

These registers are currently not documented, so it is more guessing :)

However I was able so get some more reasonable data. But they still don't add up very well, because the current values are not signed. So you don't know if "phase x" is importing or exporting power

Importing ~800W image

almost no im/export (battery charging) image

Exporting power (set to forced discharge battery) image

      - name: Meter voltage phase A
        unique_id: sg_meter_voltage_phase_a
        device_address: !secret sungrow_modbus_slave
        address: 5740 # reg 5741
        input_type: input
        data_type: int16
        precision: 1
        unit_of_measurement: V
        device_class: voltage
        state_class: measurement
        scale: 0.1
        scan_interval: 10

      - name: Meter voltage phase B
        unique_id: sg_meter_voltage_phase_b
        device_address: !secret sungrow_modbus_slave
        address: 5741 # reg 5742
        input_type: input
        data_type: int16
        precision: 1
        unit_of_measurement: V
        device_class: voltage
        state_class: measurement
        scale: 0.1
        scan_interval: 10

      - name: Meter voltage phase C
        unique_id: sg_meter_voltage_phase_c
        device_address: !secret sungrow_modbus_slave
        address: 5742 # reg 5743
        input_type: input
        data_type: int16
        precision: 1
        unit_of_measurement: V
        device_class: voltage
        state_class: measurement
        scale: 0.1
        scan_interval: 10

      - name: Meter current phase A
        unique_id: sg_meter_current_phase_a
        device_address: !secret sungrow_modbus_slave
        address: 5743 # reg 5744
        input_type: input
        data_type: int16
        precision: 0
        unit_of_measurement: A
        device_class: current
        state_class: measurement
        scale: 0.01
        scan_interval: 10

      - name: Meter current phase B
        unique_id: sg_meter_current_phase_b
        device_address: !secret sungrow_modbus_slave
        address: 5744 # reg 5745
        input_type: input
        data_type: int16
        precision: 0
        unit_of_measurement: A
        device_class: current
        state_class: measurement
        scale: 0.01
        scan_interval: 10

      - name: Meter current phase C
        unique_id: sg_meter_current_phase_c
        device_address: !secret sungrow_modbus_slave
        address: 5745 # reg 5746
        input_type: input
        data_type: int16
        precision: 0
        unit_of_measurement: A
        device_class: current
        state_class: measurement
        scale: 0.01
        scan_interval: 10
mkaiser commented 1 year ago

hmm just thinking out loud here:

We could take the sign of phase x active power and split up the unsigned phase x current into two template sensors: phase x import current and phase x export current

Any thoughts?

mkaiser commented 1 year ago

One other thing on the availability of these sensors, I cannot test

if the power from the grid is down, the sensor Meter active power returned 7FFF FFFF, so a template sensor took this into account

        unique_id: sg_meter_active_power
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        availability: >-
          {{ 
          not is_state('sensor.meter_active_power_raw', 'unavailable')
          and states('sensor.meter_active_power_raw')|int != 0x7FFFFFFF
          }}
        state: "{{ states('sensor.meter_active_power_raw') }}"

Can someone test, what happens to the phase x current and voltage values?

kalaws commented 1 year ago

Maybe the newly added registers in documentation depends on a newer firmware from SunGrow?

Just updated to the latest firmware. No difference, unfortunately. I find it very, very strange that meter active powerworks over WiNet-S, but not meter current or meter voltage! Such an odd implementation.

dylan09 commented 1 year ago

Can someone test, what happens to the phase x current and voltage values?

Maybe I could implement the changes to registers and test what happened in case of grid blackout.

dylan09 commented 1 year ago

I did some tests today. Switched off mains and forced inverter to off-grid mode.

All 6 new sensors showed valid values during my test. So there seems to be no need for template sensors.

mkaiser commented 1 year ago

I did some tests today. Switched off mains and forced inverter to off-grid mode.

All 6 new sensors showed valid values during my test. So there seems to be no need for template sensors.

great, thank your for testing!

so this is my last open concern:

We could take the sign of phase x active power and split up the unsigned phase x current into two template sensors: phase x import current and phase x export current

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 week ago

This issue was closed because it has been inactive for 14 days since being marked as stale.