Open Kawobei opened 1 year ago
Should still work. Those are different types. If you look at "Inverter start stop" and "System state" it's the same thing.
You are correct, I got it working last night (very happy) my guess was the holding ones are different even though same numbers. Not sure if you want the code? I dont know how do pull/push stuff.
You can Post it here. Maybe someone will also find it useful. I might Do a pullrequest.
modbus:
name: SungrowSHx type: tcp host: !secret sungrow_modbus_host_ip port: !secret sungrow_modbus_port retry_on_empty: true retries: 10 close_comm_on_error: true delay: 5
sensors:
name: Sungrow device type code unique_id: sg_dev_code slave: !secret sungrow_modbus_slave address: 4999 # reg 5000 input_type: input count: 1 data_type: uint16 swap: word scan_interval: 600
name: Daily PV generation & battery discharge unique_id: sg_daily_pv_gen_battery_discharge slave: !secret sungrow_modbus_slave address: 5002 # reg 5003 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Total PV generation & battery discharge unique_id: sg_total_pv_gen_battery_discharge slave: !secret sungrow_modbus_slave address: 5003 # reg 5004 input_type: input count: 2 data_type: uint32 swap: word unit_of_measurement: kWh precision: 1 device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Inverter temperature unique_id: sg_inverter_temperature slave: !secret sungrow_modbus_slave address: 5007 # reg 5008 input_type: input count: 1 data_type: int16 precision: 1 unit_of_measurement: °C device_class: Temperature scale: 0.1 scan_interval: 10
name: MPPT1 voltage unique_id: sg_mppt1_voltage slave: !secret sungrow_modbus_slave 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 unique_id: sg_mppt1_current slave: !secret sungrow_modbus_slave 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 unique_id: sg_mppt2_voltage slave: !secret sungrow_modbus_slave 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 unique_id: sg_mppt2_current slave: !secret sungrow_modbus_slave 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 unique_id: sg_total_dc_power slave: !secret sungrow_modbus_slave 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
name: Phase A voltage unique_id: sg_phase_a_voltage slave: !secret sungrow_modbus_slave address: 5018 # reg: 5019 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: V device_class: Voltage state_class: measurement scale: 0.1 scan_interval: 10
name: Phase B voltage unique_id: sg_phase_b_voltage slave: !secret sungrow_modbus_slave address: 5019 # reg: 5020 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: V device_class: Voltage state_class: measurement scale: 0.1 scan_interval: 10
name: Phase C voltage unique_id: sg_phase_c_voltage slave: !secret sungrow_modbus_slave address: 5020 # reg: 5021 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: V device_class: Voltage state_class: measurement scale: 0.1 scan_interval: 10
name: Grid frequency unique_id: sg_grid_frequency slave: !secret sungrow_modbus_slave address: 5035 # reg 5036 input_type: input count: 1 data_type: uint16 swap: word precision: 2 unit_of_measurement: "Hz" device_class: frequency state_class: measurement scale: 0.1 scan_interval: 10
name: Reactive power unique_id: sg_reactive_power slave: !secret sungrow_modbus_slave address: 5032 # reg 5033 input_type: input count: 2 data_type: int32 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Power factor unique_id: sg_power_factor slave: !secret sungrow_modbus_slave address: 5034 # reg 5035 input_type: input count: 1 data_type: int16 swap: word precision: 3 unit_of_measurement: "%" device_class: power_factor state_class: measurement scale: 0.001 scan_interval: 10
name: Meter active power raw unique_id: sg_meter_active_power_raw slave: !secret sungrow_modbus_slave address: 5600 # reg 5601 input_type: input count: 2 data_type: int32 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Meter phase A active power raw unique_id: sg_meter_phase_a_active_power_raw slave: !secret sungrow_modbus_slave address: 5602 # reg 5603 input_type: input count: 2 data_type: int32 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Meter phase B active power raw unique_id: sg_meter_phase_b_active_power_raw slave: !secret sungrow_modbus_slave address: 5604 # reg 5605 input_type: input count: 2 data_type: int32 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Meter phase C active power raw unique_id: sg_meter_phase_c_active_power_raw slave: !secret sungrow_modbus_slave address: 5606 # reg 5607 input_type: input count: 2 data_type: int32 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: BDC rated power unique_id: sg_bdc_rated_power slave: !secret sungrow_modbus_slave address: 5627 # reg 5628 input_type: input count: 1 data_type: uint16 swap: word unit_of_measurement: "W" device_class: power state_class: measurement scale: 100 scan_interval: 10
name: BMS max. charging current unique_id: sg_bms_max_charging_current slave: !secret sungrow_modbus_slave address: 5634 # reg 5635 input_type: input count: 1 data_type: uint16 swap: word precision: 0 unit_of_measurement: A device_class: Current scale: 1 scan_interval: 60
name: BMS max. discharging current unique_id: sg_bms_max_discharging_current slave: !secret sungrow_modbus_slave address: 5635 # reg 5636 input_type: input count: 1 data_type: uint16 swap: word precision: 0 unit_of_measurement: A device_class: Current scale: 1 scan_interval: 60
name: Total backup power slave: !secret sungrow_modbus_slave unique_id: sg_total_backup_power address: 5725 # reg 5726 input_type: input count: 1 data_type: int16 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Backup phase A power unique_id: sg_backup_phase_a_power slave: !secret sungrow_modbus_slave address: 5722 # reg 5723 input_type: input count: 1 data_type: int16 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Backup phase B power unique_id: sg_backup_phase_b_power slave: !secret sungrow_modbus_slave address: 5723 # reg 5724 input_type: input count: 1 data_type: int16 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Backup phase C power unique_id: sg_backup_phase_c_power slave: !secret sungrow_modbus_slave address: 5724 # reg 5725 input_type: input count: 1 data_type: int16 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Monthly PV generation (01 January) unique_id: sg_monthly_pv_generation_01_january slave: !secret sungrow_modbus_slave address: 6226 # reg 6227 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (02 February) unique_id: sg_monthly_pv_generation_02_february slave: !secret sungrow_modbus_slave address: 6227 # reg 6228 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (03 March) unique_id: sg_monthly_pv_generation_03_march slave: !secret sungrow_modbus_slave address: 6228 # reg 6229 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (04 April) unique_id: sg_monthly_pv_generation_04_april slave: !secret sungrow_modbus_slave address: 6229 # reg 6230 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (05 May) unique_id: sg_monthly_pv_generation_05_may slave: !secret sungrow_modbus_slave address: 6230 # reg 6231 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (06 June) unique_id: sg_monthly_pv_generation_06_june slave: !secret sungrow_modbus_slave address: 6231 # reg 6232 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (07 July) unique_id: sg_monthly_pv_generation_07_july slave: !secret sungrow_modbus_slave address: 6232 # reg 6233 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (08 August) unique_id: sg_monthly_pv_generation_08_august slave: !secret sungrow_modbus_slave address: 6233 # reg 6234 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (09 September) unique_id: sg_monthly_pv_generation_09_september slave: !secret sungrow_modbus_slave address: 6234 # reg 6235 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (10 October) unique_id: sg_monthly_pv_generation_10_october slave: !secret sungrow_modbus_slave address: 6235 # reg 6236 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (11 November) unique_id: sg_monthly_pv_generation_11_november slave: !secret sungrow_modbus_slave address: 6236 # reg 6237 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly PV generation (12 December) unique_id: sg_monthly_pv_generation_12_december slave: !secret sungrow_modbus_slave address: 6237 # reg 6238 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2019) unique_id: sg_yearly_pv_generation_2019 slave: !secret sungrow_modbus_slave address: 6257 # reg 6258 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2020) unique_id: sg_yearly_pv_generation_2020 slave: !secret sungrow_modbus_slave address: 6259 # reg 6260 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2021) unique_id: sg_yearly_pv_generation_2021 slave: !secret sungrow_modbus_slave address: 6261 # reg 6262 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2022) unique_id: sg_yearly_pv_generation_2022 slave: !secret sungrow_modbus_slave address: 6263 # reg 6264 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2023) unique_id: sg_yearly_pv_generation_2023 slave: !secret sungrow_modbus_slave address: 6265 # reg 6266 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2024) unique_id: sg_yearly_pv_generation_2024 slave: !secret sungrow_modbus_slave address: 6267 # reg 6268 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2025) unique_id: sg_yearly_pv_generation_2025 slave: !secret sungrow_modbus_slave address: 6269 # reg 6270 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2026) unique_id: sg_yearly_pv_generation_2026 slave: !secret sungrow_modbus_slave address: 6271 # reg 6272 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2027) unique_id: sg_yearly_pv_generation_2027 slave: !secret sungrow_modbus_slave address: 6273 # reg 6274 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2028) unique_id: sg_yearly_pv_generation_2028 slave: !secret sungrow_modbus_slave address: 6275 # reg 6276 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly PV generation (2029) unique_id: sg_yearly_pv_generation_2029 slave: !secret sungrow_modbus_slave address: 6277 # reg 6278 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (01 January) unique_id: sg_monthly_export_01_january slave: !secret sungrow_modbus_slave address: 6595 # reg 6596 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (02 February) unique_id: sg_monthly_export_02_february slave: !secret sungrow_modbus_slave address: 6596 # reg 6597 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (03 March) unique_id: sg_monthly_export_03_march slave: !secret sungrow_modbus_slave address: 6597 # reg 6598 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (04 April) unique_id: sg_monthly_export_04_april slave: !secret sungrow_modbus_slave address: 6598 # reg 6599 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (05 May) unique_id: sg_monthly_export_05_may slave: !secret sungrow_modbus_slave address: 6599 # reg 6600 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (06 June) unique_id: sg_monthly_export_06_june slave: !secret sungrow_modbus_slave address: 6600 # reg 6601 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (07 July) unique_id: sg_monthly_export_07_july slave: !secret sungrow_modbus_slave address: 6601 # reg 6602 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (08 August) unique_id: sg_monthly_export_08_august slave: !secret sungrow_modbus_slave address: 6602 # reg 6603 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (09 September) unique_id: sg_monthly_export_09_september slave: !secret sungrow_modbus_slave address: 6603 # reg 6604 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (10 October) unique_id: sg_monthly_export_10_october slave: !secret sungrow_modbus_slave address: 6604 # reg 6605 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (11 November) unique_id: sg_monthly_export_11_november slave: !secret sungrow_modbus_slave address: 6605 # reg 6606 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Monthly export (12 December) unique_id: sg_monthly_export_12_december slave: !secret sungrow_modbus_slave address: 6606 # reg 6607 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2019) unique_id: sg_yearly_export_2019 slave: !secret sungrow_modbus_slave address: 6615 # reg 6616 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2020) unique_id: sg_yearly_export_2020 slave: !secret sungrow_modbus_slave address: 6617 # reg 6618 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2021) unique_id: sg_yearly_export_2021 slave: !secret sungrow_modbus_slave address: 6619 # reg 6620 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2022) unique_id: sg_yearly_export_2022 slave: !secret sungrow_modbus_slave address: 6621 # reg 6622 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2023) unique_id: sg_yearly_export_2023 slave: !secret sungrow_modbus_slave address: 6623 # reg 6624 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2024) unique_id: sg_yearly_export_2024 slave: !secret sungrow_modbus_slave address: 6625 # reg 6626 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2025) unique_id: sg_yearly_export_2025 slave: !secret sungrow_modbus_slave address: 6627 # reg 6628 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2026) unique_id: sg_yearly_export_2026 slave: !secret sungrow_modbus_slave address: 6629 # reg 6630 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2027) unique_id: sg_yearly_export_2027 slave: !secret sungrow_modbus_slave address: 6631 # reg 6632 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Yearly Export (2028) unique_id: sg_yearly_export_2028 slave: !secret sungrow_modbus_slave address: 6633 # reg 6634 input_type: input data_type: uint32 swap: word count: 2 precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: System state unique_id: sg_system_state slave: !secret sungrow_modbus_slave address: 12999 # reg 13000 input_type: input count: 1 data_type: uint16 swap: word precision: 0 scale: 1 scan_interval: 10
name: Running state unique_id: sg_running_state slave: !secret sungrow_modbus_slave address: 13000 # reg 13001 input_type: input count: 1 data_type: uint16 swap: word precision: 0 scale: 1 scan_interval: 10
name: Daily PV generation unique_id: sg_daily_pv_generation slave: !secret sungrow_modbus_slave address: 13001 # reg 13002 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Total PV generation unique_id: sg_total_pv_generation slave: !secret sungrow_modbus_slave address: 13002 # reg 13003 input_type: input count: 2 data_type: uint32 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total scale: 0.1 scan_interval: 600
name: Daily exported energy from PV unique_id: sg_daily_exported_energy_from_PV slave: !secret sungrow_modbus_slave address: 13004 # reg 13005 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Total exported energy from PV unique_id: sg_total_exported_energy_from_pv slave: !secret sungrow_modbus_slave address: 13005 # reg 13006 input_type: input count: 2 data_type: uint32 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total scale: 0.1 scan_interval: 600
name: Load power unique_id: sg_load_power slave: !secret sungrow_modbus_slave address: 13007 # reg 13008 input_type: input count: 2 data_type: int32 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Export power raw unique_id: sg_battery_export_power_raw slave: !secret sungrow_modbus_slave address: 13009 # reg 13010 input_type: input count: 2 data_type: int32 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Daily battery charge from PV unique_id: sg_daily_battery_charge_from_pv slave: !secret sungrow_modbus_slave address: 13011 # reg 13012 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Total battery charge from PV unique_id: sg_total_battery_charge_from_pv slave: !secret sungrow_modbus_slave address: 13012 # reg 13013 input_type: input count: 2 data_type: uint32 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Daily direct energy consumption unique_id: sg_daily_direct_energy_consumption slave: !secret sungrow_modbus_slave address: 13016 # reg 13017 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Total direct energy consumption unique_id: sg_total_direct_energy_consumption slave: !secret sungrow_modbus_slave address: 13017 # reg 13018 input_type: input count: 2 data_type: uint32 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Battery voltage unique_id: sg_battery_voltage slave: !secret sungrow_modbus_slave address: 13019 # reg 13020 input_type: input count: 1 data_type: uint16 swap: word precision: 0 unit_of_measurement: V device_class: Voltage scale: 0.1 scan_interval: 10
name: Battery current unique_id: sg_battery_current slave: !secret sungrow_modbus_slave address: 13020 # reg 13021 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: A device_class: Current scale: 0.1 scan_interval: 10
name: Battery power raw unique_id: sg_battery_power_raw slave: !secret sungrow_modbus_slave address: 13021 # reg 13022 input_type: input count: 1 data_type: uint16 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Battery level unique_id: sg_battery_level slave: !secret sungrow_modbus_slave address: 13022 # reg 13023 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: "%" device_class: battery state_class: measurement scale: 0.1 scan_interval: 60
name: Battery state of health unique_id: sg_battery_state_of_health slave: !secret sungrow_modbus_slave address: 13023 # reg 13024 input_type: input count: 1 data_type: uint16 swap: word precision: 0 unit_of_measurement: "%" state_class: measurement scale: 0.1 scan_interval: 10
name: Battery temperature unique_id: sg_battery_temperature slave: !secret sungrow_modbus_slave address: 13024 # reg 13025 input_type: input count: 1 data_type: int16 precision: 1 unit_of_measurement: °C device_class: Temperature scale: 0.1 scan_interval: 60
name: Daily battery discharge unique_id: sg_daily_battery_discharge slave: !secret sungrow_modbus_slave address: 13025 # reg 13026 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Total battery discharge unique_id: sg_total_battery_discharge slave: !secret sungrow_modbus_slave address: 13026 # reg 13027 input_type: input count: 2 data_type: uint32 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 10
name: Phase A current unique_id: sg_phase_a_current slave: !secret sungrow_modbus_slave address: 13030 # reg 13031 input_type: input count: 1 data_type: int16 swap: word precision: 1 unit_of_measurement: A device_class: current state_class: measurement scale: 0.1 scan_interval: 10
name: Phase B current unique_id: sg_phase_b_current slave: !secret sungrow_modbus_slave address: 13031 # reg 13032 input_type: input count: 1 data_type: int16 swap: word precision: 1 unit_of_measurement: A device_class: current state_class: measurement scale: 0.1 scan_interval: 10
name: Phase C current unique_id: sg_phase_c_current slave: !secret sungrow_modbus_slave address: 13032 # reg 13033 input_type: input count: 1 data_type: int16 swap: word precision: 1 unit_of_measurement: A device_class: current state_class: measurement scale: 0.1 scan_interval: 10
name: Total active power unique_id: sg_total_active_power slave: !secret sungrow_modbus_slave address: 13033 # reg 13034 input_type: input count: 2 data_type: int32 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 1 scan_interval: 10
name: Daily imported energy unique_id: sg_daily_imported_energy slave: !secret sungrow_modbus_slave address: 13035 # reg 13036 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Total imported energy unique_id: sg_total_imported_energy slave: !secret sungrow_modbus_slave address: 13036 # reg 13037 input_type: input count: 2 data_type: uint32 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Daily battery charge unique_id: sg_daily_battery_charge slave: !secret sungrow_modbus_slave address: 13039 # reg 13040 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Total battery charge unique_id: sg_total_battery_charge slave: !secret sungrow_modbus_slave address: 13040 # reg 13041 input_type: input count: 2 data_type: uint32 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Daily exported energy unique_id: sg_daily_exported_energy slave: !secret sungrow_modbus_slave address: 13044 # reg 13045 input_type: input count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
name: Total exported energy unique_id: sg_total_exported_energy slave: !secret sungrow_modbus_slave address: 13045 # reg 13046 input_type: input count: 2 data_type: uint32 swap: word precision: 1 unit_of_measurement: kWh device_class: energy state_class: total_increasing scale: 0.1 scan_interval: 600
#####################
#####################
name: Inverter start stop unique_id: sg_inverter_start_stop slave: !secret sungrow_modbus_slave address: 12999 # reg 13000 input_type: holding count: 1 data_type: uint16 swap: word precision: 0 scan_interval: 10
name: EMS mode selection raw unique_id: sg_ems_mode_selection_raw slave: !secret sungrow_modbus_slave address: 13049 # reg 13050 input_type: holding count: 1 data_type: uint16 swap: word scan_interval: 10
name: load Mode DO relay raw unique_id: sg_do_relay_raw slave: !secret sungrow_modbus_slave address: 13001 # reg 13002 input_type: holding count: 1 data_type: uint16 swap: word scan_interval: 10
name: load Mode ONOFF DO relay raw unique_id: sg_do_relay_onoff_raw slave: !secret sungrow_modbus_slave address: 13010 # reg 13011 input_type: holding count: 1 data_type: uint16 swap: word scan_interval: 10
name: Battery forced charge discharge cmd raw unique_id: sg_battery_forced_charge_discharge_cmd_raw slave: !secret sungrow_modbus_slave address: 13050 # reg 13051 input_type: holding count: 1 data_type: uint16 swap: word precision: 0 scan_interval: 10
name: Battery forced charge discharge power unique_id: sg_battery_forced_charge_discharge_power slave: !secret sungrow_modbus_slave address: 13051 # reg 13052 input_type: holding count: 1 data_type: uint16 swap: word precision: 0
unit_of_measurement: W device_class: power state_class: measurement scan_interval: 10
name: Max SoC unique_id: sg_max_soc slave: !secret sungrow_modbus_slave address: 13057 # reg 13058 input_type: holding count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: "%" device_class: battery state_class: measurement scale: 0.1 scan_interval: 10
name: Min SoC unique_id: sg_min_soc slave: !secret sungrow_modbus_slave address: 13058 # reg 13059 input_type: holding count: 1 data_type: uint16 swap: word precision: 1 unit_of_measurement: "%" device_class: battery state_class: measurement scale: 0.1 scan_interval: 10
name: Reserved SoC for backup unique_id: sg_reserved_soc_for_backup slave: !secret sungrow_modbus_slave 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 scan_interval: 10
name: Battery max charge power unique_id: sg_battery_max_charge_power slave: !secret sungrow_modbus_slave address: 33046 # reg 33047 input_type: holding count: 1 data_type: uint16 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 10 scan_interval: 10
name: Battery max discharge power unique_id: sg_battery_max_discharge_power slave: !secret sungrow_modbus_slave address: 33047 # reg 33048 input_type: holding count: 1 data_type: uint16 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 10 scan_interval: 10
name: Battery capacity unique_id: sg_battery_capacity slave: !secret sungrow_modbus_slave address: 33048 # reg 33049 input_type: holding count: 1 data_type: uint16 swap: word unit_of_measurement: kWh device_class: energy scale: 0.01 scan_interval: 600
name: Battery charging start power unique_id: sg_battery_charging_start_power slave: !secret sungrow_modbus_slave address: 33148 # reg 33149 input_type: holding count: 1 data_type: uint16 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 10 scan_interval: 10
name: Battery discharging start power unique_id: sg_battery_discharging_start_power slave: !secret sungrow_modbus_slave address: 33149 # reg 33150 input_type: holding count: 1 data_type: uint16 swap: word precision: 0 unit_of_measurement: W device_class: power state_class: measurement scale: 10 scan_interval: 10
template:
binary_sensor:
name: PV generating unique_id: sg_pv_generating availability: >- {{states('sensor.running_state')|is_number or states('sensor.total_dc_power')|is_number }} state: >- {% if states('sensor.running_state')|is_number %} {# use available sensor running_state #} {{ states('sensor.running_state')|int(default=0)|bitwise_and(0x1) > 0 }} {% else %} {# workaround for SH*RS inverters without working running_state #} {% if states('sensor.total_dc_power')|int > 0 %} 1 {% else %} 0 {% endif %} {% endif %}
name: Battery charging unique_id: sg_battery_charging availability: >- {{states('sensor.running_state')|is_number or (states('sensor.ems_mode_selection_raw')|is_number and states('sensor.battery_forced_charge_discharge_cmd_raw')|is_number and states('sensor.battery_power_raw')|is_number and states('sensor.total_dc_power')|is_number and states('sensor.load_power')|is_number ) }} state: >- {% if states('sensor.running_state')|is_number %} {# use available sensor running_state #} {{ states('sensor.running_state')|int(default=0)|bitwise_and(0x2) > 0 }} {% else %} {# workaround for SH*RS inverters without working running_state #} {% if (states('sensor.ems_mode_selection') ) == "Forced mode" %} {# EMS forced mode #} {% if (states('sensor.battery_forced_charge_discharge_cmd') == "Forced charge") %} {# in mode Forced charge #} {% if (states('sensor.battery_power_raw')|int > 0 ) %} {# power flow from/to battery #} On {% else %} {# no power flow from/to battery #} Off {% endif %} {% else %} {# in EMS mode, but not in mode Forced charge #} Off {% endif %} {% else %} {# not in EMS forced mode, assuming self consumption mode #} {% if states('sensor.total_dc_power')|int > states('sensor.load_power')|int %} {# more power generated than consumed. assuming battery charging #} On {% else %} Off {% endif %} {% endif %} {% endif %}
name: Battery discharging unique_id: sg_battery_discharging availability: >- {{states('sensor.running_state')|is_number or (states('sensor.ems_mode_selection_raw')|is_number and states('sensor.battery_forced_charge_discharge_cmd_raw')|is_number and states('sensor.battery_power_raw')|is_number and states('sensor.total_dc_power')|is_number and states('sensor.load_power')|is_number ) }} state: >- {% if states('sensor.running_state')|is_number %} {# use available sensor running_state #} {{ states('sensor.running_state')|int(default=0)|bitwise_and(0x4) > 0 }} {% else %} {# workaround for SH*RS inverters without working running_state #} {% if (states('sensor.ems_mode_selection') ) == "Forced mode" %} {# EMS forced mode #} {% if (states('sensor.battery_forced_charge_discharge_cmd') == "Forced discharge") %} {# in mode Forced discharge #} {% if (states('sensor.battery_power_raw')|int > 0 ) %} {# power flow from/to battery #} On {% else %} {# no power flow from/to battery #} Off {% endif %} {% else %} {# in EMS mode, but not in mode Forced charge #} Off {% endif %} {% else %} {# not in EMS forced mode, assuming self consumption mode #} {% if ( ( states('sensor.total_dc_power')|int < states('sensor.load_power')|int ) ) and states('sensor.battery_power_raw')|int > 0 %} {# more power consumed than generated and some battery power --> assuming battery discharging #} On {% else %} Off {% endif %} {% endif %} {% endif %}
name: Exporting power unique_id: sg_exporting_power availability: "{{states('sensor.running_state')|is_number or states('sensor.export_power_raw')|is_number }}" state: >- {% if states('sensor.running_state')|is_number %} {# use available sensor running_state #} {{ states('sensor.running_state')|int(default=0)|bitwise_and(0x10) > 0 }} {% else %} {# workaround for SH*RS inverters without working running_state #} {% if states('sensor.export_power_raw')|int > 0 %} 1 {% else %} 0 {% endif %} {% endif %}
name: Importing power unique_id: sg_importing_power availability: "{{states('sensor.running_state')|is_number or states('sensor.export_power_raw')|is_number }}" state: >- {% if states('sensor.running_state')|is_number %} {# use available sensor running_state #} {{ states('sensor.running_state')|int(default=0)|bitwise_and(0x20) > 0 }} {% else %} {# workaround for SH*RS inverters without working running_state #} {% if states('sensor.export_power_raw')|int < 0 %} 1 {% else %} 0 {% endif %} {% endif %}
sensor:
name: MPPT1 power unique_id: sg_mppt1_power unit_of_measurement: W device_class: power availability: "{{states('sensor.mppt1_voltage')|is_number and states('sensor.mppt1_current')|is_number }}" state: "{{ (states('sensor.mppt1_voltage') | float * states('sensor.mppt1_current') | float) |int }}"
name: MPPT2 power unique_id: sg_mppt2_power unit_of_measurement: W device_class: power availability: "{{states('sensor.mppt2_voltage')|is_number and states('sensor.mppt2_current')|is_number }}" state: "{{ (states('sensor.mppt2_voltage') | float * states('sensor.mppt2_current') | float) |int }}"
name: Phase A power unique_id: sg_phase_a_power unit_of_measurement: W device_class: power availability: "{{states('sensor.phase_a_voltage')|is_number and states('sensor.phase_a_current')|is_number }}" state: "{{ (states('sensor.phase_a_voltage') | float * states('sensor.phase_a_current') | float) |int }}"
name: Phase B power unique_id: sg_phase_b_power unit_of_measurement: W device_class: power availability: "{{states('sensor.phase_b_voltage')|is_number and states('sensor.phase_b_current')|is_number }}" state: "{{ (states('sensor.phase_b_voltage') | float * states('sensor.phase_b_current') | float) |int }}"
name: Phase C power unique_id: sg_phase_c_power unit_of_measurement: W device_class: power availability: "{{states('sensor.phase_c_voltage')|is_number and states('sensor.phase_c_current')|is_number }}" state: "{{ (states('sensor.phase_c_voltage') | float * states('sensor.phase_c_current') | float) |int }}"
name: Meter active power unique_id: sg_meter_active_power unit_of_measurement: W device_class: power state_class: measurement availability: "{{ states('sensor.meter_active_power_raw')|is_number and states('sensor.meter_active_power_raw')|int != 0x7FFFFFFF}}" state: "{{ states('sensor.meter_active_power_raw') }}"
name: Meter Phase A active power unique_id: sg_meter_phase_a_active_power unit_of_measurement: W device_class: power state_class: measurement availability: "{{ states('sensor.meter_phase_a_active_power_raw')|is_number and states('sensor.meter_phase_a_active_power_raw')|int != 0x7FFFFFFF}}" state: "{{ states('sensor.meter_phase_a_active_power_raw') }}"
name: Meter Phase B active power unique_id: sg_meter_phase_b_active_power unit_of_measurement: W device_class: power state_class: measurement availability: "{{ states('sensor.meter_phase_b_active_power_raw')|is_number and states('sensor.meter_phase_b_active_power_raw')|int != 0x7FFFFFFF}}" state: "{{ states('sensor.meter_phase_b_active_power_raw') }}"
name: Meter Phase C active power unique_id: sg_meter_phase_c_active_power unit_of_measurement: W device_class: power state_class: measurement availability: "{{ states('sensor.meter_phase_c_active_power_raw')|is_number and states('sensor.meter_phase_c_active_power_raw')|int != 0x7FFFFFFF}}" state: "{{ states('sensor.meter_phase_c_active_power_raw') }}"
name: Sungrow inverter state unique_id: sg_inverter_state state: >- {% if ((states('sensor.system_state') | int(default=0)) == 0x0002) %} Stop {% elif ((states('sensor.system_state') | int(default=0)) == 0x0008) %} Standby {% elif ((states('sensor.system_state') | int(default=0)) == 0x0010) %} Initial Standby {% elif ((states('sensor.system_state') | int(default=0)) == 0x0020) %} Startup {% elif ((states('sensor.system_state') | int(default=0)) == 0x0040) %} Running {% elif ((states('sensor.system_state') | int(default=0)) == 0x0100) %} Fault {% elif ((states('sensor.system_state') | int(default=0)) == 0x0400) %} Maintain mode {% elif ((states('sensor.system_state') | int(default=0)) == 0x0800) %} Forced mode {% elif ((states('sensor.system_state') | int(default=0)) == 0x1000) %} Off-grid mode {% elif ((states('sensor.system_state') | int(default=0)) == 0x2501) %} Restarting {% elif ((states('sensor.system_state') | int(default=0)) == 0x4000) %} External EMS mode {% else %} Unknown - should not see me! {% endif %}
name: Sungrow device type
unique_id: sg_device_type
state: >-
{% if ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D06) %}
SH3K6
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D07) %}
SH4K6
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D09) %}
SH5K-20
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D06) %}
SH3K6
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D07) %}
SH4K6
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D03) %}
SH5K-V13
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D0C) %}
SH5K-30
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D0A) %}
SH3K6-30
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D0B) %}
SH4K6-30
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D0F) %}
SH5.0RS
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D0D) %}
SH3.6RS
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D0E) %}
SH4.6RS
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0D10) %}
SH6.0RS
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0E01) %}
SH6.0RT
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0E02) %}
SH8.0RT
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0E03) %}
SH10RT
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0E0E) %}
SH8.0RT-V112
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0E0F) %}
SH10RT-V112
{% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0E00) %}
SH5.0RT
{% else %}
Unknown device code!
{% endif %}
name: Battery forced charge discharge cmd unique_id: sg_battery_forced_charge_discharge_cmd state: >- {% if ((states('sensor.battery_forced_charge_discharge_cmd_raw') | int(default=0)) == 0x00AA) %} Forced charge {% elif ((states('sensor.battery_forced_charge_discharge_cmd_raw') | int(default=0)) == 0x00BB) %} Forced discharge {% elif ((states('sensor.battery_forced_charge_discharge_cmd_raw') | int(default=0)) == 0x00CC) %} Stop (Default) {% else %} Unknown - should not see me! {% endif %}
name: Load Mode ONOFF Do relay unique_id: sg_do_relay_ONOFF_cmd state: >- {% if ((states('sensor.load_mode_onoff_do_relay_raw') | int(default=0)) == 0x00AA) %} ON {% elif ((states('sensor.load_mode_onoff_do_relay_raw') | int(default=0)) == 0x0055) %} OFF {% else %} Unknown - should not see me!!! {% endif %}
name: Load Mode Do relay State unique_id: set_sg_do_relay_cmd state: >- {% if ((states('sensor.load_mode_do_relay_raw') | int(default=0)) == 0) %} Timed {% elif ((states('sensor.load_mode_do_relay_raw') | int(default=0)) == 1) %} ONOFF {% elif ((states('sensor.load_mode_do_relay_raw') | int(default=0)) == 2) %} Power Optimised {% else %} Unknown - should not see me!!! {% endif %}
name: EMS mode selection unique_id: sg_ems_mode_selection state: >- {% if ((states('sensor.ems_mode_selection_raw') | int(default=0)) == 0) %} Self-consumption mode (default) {% elif ((states('sensor.ems_mode_selection_raw') | int(default=0)) == 2) %} Forced mode {% elif ((states('sensor.ems_mode_selection_raw') | int(default=0)) == 3) %} External EMS {% elif ((states('sensor.ems_mode_selection_raw') | int(default=0)) == 4) %} VPP {% elif ((states('sensor.ems_mode_selection_raw') | int(default=0)) == 8) %} MicroGrid {% else %} Unknown - should not see me! {% endif %}
name: Signed battery power # positive if charging and negative if discharging unique_id: sg_signed_battery_power unit_of_measurement: W device_class: power state_class: measurement availability: >- {{ states('binary_sensor.battery_charging') and states('binary_sensor.battery_discharging') and states('sensor.battery_power_raw')|is_number }} state: >- {% if is_state('binary_sensor.battery_charging', 'on') %} {{ (states('sensor.battery_power_raw') | float)}} {% elif is_state('binary_sensor.battery_discharging', 'on') %} {{ (states('sensor.battery_power_raw') | float * -1)}} {% else %} 0 {% endif %}
name: Battery charging power # positive if charging else zero unique_id: sg_battery_charging_power unit_of_measurement: W device_class: power state_class: measurement availability: >- {{ states('binary_sensor.battery_charging') and states('sensor.battery_power_raw')|is_number }} state: >- {% if is_state('binary_sensor.battery_charging', 'on') %} {{ states('sensor.battery_power_raw') }} {% else %} 0 {% endif %}
name: Battery discharging power # positive if discharging else zero unique_id: sg_battery_discharging_power unit_of_measurement: W device_class: power state_class: measurement availability: >- {{ states('binary_sensor.battery_charging') and states('sensor.battery_power_raw')|is_number }} state: >- {% if is_state('binary_sensor.battery_discharging', 'on') %} {{ states('sensor.battery_power_raw') }} {% else %} 0 {% endif %}
name: Import power # power from grid: positive if importing, else zero unique_id: sg_import_power unit_of_measurement: W device_class: power state_class: measurement availability: "{{states('sensor.export_power_raw')|is_number }}" state: >- {% if states('sensor.export_power_raw')|int < 0 %} {{ states('sensor.export_power_raw')|int *-1 }} {% else %} 0 {% endif %}
name: Export power # power to grid: positive if exporting, else zero unique_id: sg_export_power unit_of_measurement: W device_class: power state_class: measurement availability: "{{states('sensor.export_power_raw')|is_number }}" state: >- {% if states('sensor.export_power_raw')|int > 0 %} {{ states('sensor.export_power_raw') }} {% else %} 0 {% endif %}
name: "Monthly PV generation (current)" unique_id: sg_monthly_pv_generation_current unit_of_measurement: kWh device_class: energy state_class: total_increasing state: "{{ states('sensor.' ~ 'monthly_pvgeneration' ~ '%0.2d' % now().month ~ '_' ~ now().timestamp() | timestamp_custom('%B') | lower ) }}"
name: "Yearly PV generation (current)" unique_id: sg_yearly_pv_generation_current unit_of_measurement: kWh device_class: energy state_class: total_increasing state: "{{ states('sensor.' ~ 'yearly_pvgeneration' ~ now().year ) }}"
name: "Monthly export (current)" unique_id: sg_monthly_export_current unit_of_measurement: kWh device_class: energy state_class: total_increasing state: "{{ states('sensor.' ~ 'monthlyexport' ~ '%0.2d' % now().month ~ '_' ~ now().timestamp() | timestamp_custom('%B') | lower ) }}"
name: "Yearly export (current)" unique_id: sg_yearly_export_current unit_of_measurement: kWh device_class: energy state_class: total_increasing state: "{{ states('sensor.' ~ 'yearlyexport' ~ now().year ) }}"
name: "Battery level (nominal)" unique_id: sg_battery_level_nom unit_of_measurement: "%" device_class: battery state_class: measurement availability: >- {{ states('sensor.battery_level') | is_number and states('sensor.min_soc') | is_number and states('sensor.max_soc') | is_number }} state: >- {% set soc_min = states('sensor.min_soc') | float %} {% set soc_max = states('sensor.max_soc') | float %} {% set soc_cur = states('sensor.battery_level') | float %} {{ (soc_min) + (soc_max - soc_min) * (soc_cur / 100) | round(1) }}
name: "Battery charge (nominal)" unique_id: sg_battery_charge_nom unit_of_measurement: kWh device_class: energy availability: >- {{ states('sensor.battery_capacity') | is_number and states('sensor.sg_battery_level_nom') | is_number }} state: >- {{ ( states('sensor.battery_capacity') | float * states('sensor.sg_battery_level_nom') | float / 100 )| round(1) }}
name: "Battery charge"
unique_id: sg_battery_charge
unit_of_measurement: kWh
device_class: energy
availability: >-
{{
states('sensor.battery_capacity') | is_number and
states('sensor.battery_level') | is_number and
states('sensor.min_soc') | is_number and
states('sensor.max_soc') | is_number
}}
state: >-
{{
states('sensor.battery_capacity') | float
((states('sensor.max_soc') | float - states('sensor.min_soc') | float)
states('sensor.battery_level') | float / 10000) | round(1)
}}
input_number: set_sg_min_soc: name: Set min SoC min: 0 max: 50 step: 1
set_sg_max_soc: name: Set max SoC min: 50 max: 100 step: 1
set_sg_reserved_soc_for_backup: name: Set reserved SoC for backup min: 0 max: 75 step: 1
set_sg_forced_charge_discharge_power: name: Set forced charge discharge power in W min: 0 max: 5000 step: 100
set_sg_battery_max_charge_power: name: Set max battery charge power in W min: 100 max: 5000 step: 100
set_sg_battery_max_discharge_power: name: Set max battery discharge power in W
min: 100
max: 5000
step: 100
set_sg_battery_charging_start_power: name: Set battery charging start power in W min: 0 max: 1000 step: 10
set_sg_battery_discharging_start_power: name: Set battery discharging start power in W min: 0 max: 1000 step: 10
input_select: set_sg_start_stop_mode: name: Inverter mode options:
"Stop"
set_sg_ems_mode: name: EMS mode options:
"Forced mode"
icon: mdi:battery-unknown
set_sg_battery_forced_charge_discharge_cmd: name: Battery forced charge discharge cmd options:
"Forced discharge" icon: mdi:battery-unknown
set_sg_do_relay_cmd: name: Load Mode DO Relay cmd options:
"Power Optimised Mode" icon: mdi:battery-unknown
set_sg_do_relay_onoff_cmd: name: set_sg_do_relay_onoff_cmd options:
automation:
id: "automation_sungrow_inverter_start_stop" alias: "sungrow inverter start stop" description: "Starts/ Stops the inverter" trigger:
id: "automation_sungrow_inverter_update_max_soc" alias: "sungrow inverter update max SoC" description: "Updates Sungrow max Soc holding register" trigger:
id: "automation_sungrow_inverter_update_min_soc" alias: "sungrow inverter update min SoC" description: "Updates Sungrow min Soc holding register" trigger:
id: "automation_sungrow_inverter_update_reserved_soc_for_backup" alias: "sungrow inverter update reserved soc for backup" description: "Updates reserved SoC for backup register" trigger:
id: "automation_sungrow_inverter_update_battery_forced_charge_discharge_cmd" alias: "sungrow inverter update battery forced charge discharge cmd" description: "Updates Sungrow holding register for battery forced charge discharge command" trigger:
id: "automation_sungrow_inverter_update_ems_mode" alias: "sungrow inverter update EMS mode" description: "Updates EMS mode" trigger:
id: "automation_sungrow_inverter_update_battery_forced_charge_discharge_power" alias: "sungrow inverter update battery forced charge discharge power" description: "Sets battery forced charge discharge power" trigger:
id: "automation_sungrow_inverter_update_battery_max_charge_power" alias: "sungrow inverter update battery max charge power" description: "Sets battery max charge power" trigger:
id: "automation_sungrow_inverter_update_battery_max_discharge_power" alias: "sungrow inverter update battery max discharge power" description: "Sets battery max discharge power" trigger:
id: "automation_sungrow_inverter_update_battery_charging_start_power" alias: "sungrow inverter update battery charging start power" description: "Sets battery charging start power" trigger:
id: "automation_sungrow_inverter_update_battery_discharging_start_power" alias: "sungrow inverter update battery discharging start power" description: "Sets battery discharging start power" trigger:
id: "34323313553543" # random number alias: "update DO Relay" description: "update DO Relay" trigger:
id: "44321413553544" # random number alias: update DO relay ONOFF cmd description: "update DO relay ONOFF cmd" trigger:
Would you mind checking this for me, since I don't have anything connected to my DO relay? just copy the content of modbus_sungrow.yaml
OFFICIAL
I did try today and it didn’t work. I am in the process of trying to identify which line is the issue. Looking at the changes in a compare I don’t really see what is the problem. I’ll spend some more time over the weekend.
Get Outlook for iOShttps://aka.ms/o0ukef
From: Louis @.> Sent: Friday, March 31, 2023 5:37:48 AM To: mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant @.> Cc: Brenton Arnold @.>; Author @.> Subject: EXTERNAL: Re: [mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant] Turn on Load Relay (DO relay) (Issue #80)
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Would you mind checking this for me, since I don't have anything connected to my DO relay? just copy the content of modbus_sungrow.yamlhttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FLouis712%2FSungrow-SHx-Inverter-Modbus-Home-Assistant-fork&data=05%7C01%7Cbarnold%40sunitafe.edu.au%7C773dd42fc0df45fec7c908db314de1b4%7Cf561ef0fae55424d82afb039b9522053%7C1%7C0%7C638157982816089818%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=4dW%2FHxDk0nlEgJU5ydpAxGsQ82BmLTrc9BHsl0IxbJ4%3D&reserved=0
— Reply to this email directly, view it on GitHubhttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmkaiser%2FSungrow-SHx-Inverter-Modbus-Home-Assistant%2Fissues%2F80%23issuecomment-1490752510&data=05%7C01%7Cbarnold%40sunitafe.edu.au%7C773dd42fc0df45fec7c908db314de1b4%7Cf561ef0fae55424d82afb039b9522053%7C1%7C0%7C638157982816089818%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=toayv6g7cWfFIejmrSqXujZi7%2BWwKaXH1JaYTzi4%2BiE%3D&reserved=0, or unsubscribehttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABUH37OXKWLOAJDZ3VWLYCLW6XHHZANCNFSM6AAAAAAWJ33MEE&data=05%7C01%7Cbarnold%40sunitafe.edu.au%7C773dd42fc0df45fec7c908db314de1b4%7Cf561ef0fae55424d82afb039b9522053%7C1%7C0%7C638157982816089818%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=EII80gzPPjuj5ivBnzNCodzuoYEwnPuY45zgGGodmXY%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>
OFFICIAL
RTO Code: 4693 CRICOS no. 01985A This email and any attachments may contain privileged and confidential information. If you are not the intended recipient, you may not distribute reproduce this e-mail or the attachments. If you have received this message in error, please notify us by return e-mail.
Please consider the environment before printing this email.
Hi, I do not understand something from the documentation. Both addresses for Total PV generation 13002 and Load Adjustment 13002 10 Load 1 adjustment mode 13002 U16 0: Timing mode; 1: ON/OFF mode; 2: Power optimized mode
How can I add this as a switch? I have my hot water hooked up but I would like more complex automation rules than the inverter allows. Regards, Brenton