Sunsynk + Home Assistant

V1.4.3
Update - Please note the breaking change, show_solar has been moved to the root config.
  • Optimizes the card configuration and includes smarter attribute error checking.
  • README updated to show required/optional attributes and their default values.
  • Card configuration examples have been updated
 
Ok, I've updated as follows:

Code:
type: custom:sunsynk-power-flow-card
cardstyle: lite
panel_mode: 'no'
inverter:
  modern: 'yes'
  colour: '#959595'
battery:
  energy: 9600
  shutdown_soc: 10
  invert_power: 'no'
  colour: pink
  show_daily: 'yes'
solar:
  show_solar: 'yes'
  colour: orange
  show_daily: 'yes'
  mppts: two
load:
  colour: '#5fb6ad'
  show_daily: 'yes'
  show_aux: 'no'
  invert_aux: 'no'
grid:
  colour: '#5490c2'
  no_grid_colour: '#a40013'
  show_daily_buy: 'yes'
  show_daily_sell: 'yes'
  show_nonessential: 'no'
entities:
  use_timer_248: 'no'
  priority_load_243: 'no'
  batchargeday_70: sensor.solarman_daily_battery_charge
  batdischargeday_71: sensor.solarman_daily_battery_discharge
  loadday_84: sensor.solarman_daily_load_consumption
  grid_buy_day_76: sensor.solarman_daily_energy_bought
  grid_sell_day_77: sensor.solarman_daily_energy_sold
  solarday_108: sensor.solarman_daily_production
  inverter_grid_voltage_154: sensor.solarman_grid_voltage_l1
  inverter_load_freq_192: sensor.solarman_load_frequency
  inverter_out_164: sensor.solarman_current_l1
  inverter_out_175: sensor.solarman_total_power
  inverter_load_grid_169: sensor.solarman_total_load_power
  pv1_power_186: sensor.solarman_pv1_power
  pv2_power_187: sensor.solarman_pv2_power
  pv3_power_188: sensor.pv3_power
  pv4_power_189: sensor.pv4_power
  battery_voltage_183: sensor.solarman_battery_voltage
  battery_soc_184: sensor.solarman_battery_soc
  battery_out_190: sensor.solarman_battery_power
  essential_power: sensor.solarman_total_load_power
  nonessential_power: none
  grid_external_power_172: sensor.solarman_total_grid_power
  pv1_v_109: sensor.solarman_pv1_voltage
  pv1_i_110: sensor.solarman_pv1_current
  pv2_v_111: sensor.solarman_pv2_voltage
  pv2_i_112: sensor.solarman_pv2_current
  pv3_v_113: sensor.dc3_voltage
  pv3_i_114: sensor.dc3_current
  pv4_v_115: sensor.dc4_voltage
  pv4_i_116: sensor.dc4_current
  grid_status_194: sensor.sunsynkcard_gridstatus
  inverter_status_59: sensor.solarman_running_status
  aux_power_166: sensor.aux_output_power

View attachment 1523237
Added to GitHub. Also thanks @Kosmik for the template sensors and Solarman inverter definitions
 
@Kosmik I was busy working through the Solarman sensor mappings https://github.com/slipx06/sunsynk-power-flow-card/wiki/Sensor-Mappings and noticed that it does not have a sensor Grid External Total Power. You might want to add it to your pull request as it is not the same as 169 - Total Grid Power that Solarman uses

172
Grid external Total Power
R1Wint Signed int
External ct1 is the equivalent. External ct1 - internal ct1 gives the non-essential.

I have a custom calculation for essential as well as there isntba dedicated sensore. For that I created a helper.


Screenshot_20230513-150616_Home Assistant.jpg
 
The revised cards from 1.20 altered my calculations a bit.

This is my card, for the version just prior to your latest. It does show a negative on the inverter when charging from grid.

YAML:
type: custom:sunsynk-power-flow-card
cardstyle: full
panel_mode: 'no'
inverter:
  modern: 'yes'
  colour: '#959595'
battery:
  energy: 11000
  shutdown_soc: 20
  invert_power: 'no'
  colour: pink
  show_daily: 'yes'
solar:
  show_solar: 'yes'
  colour: orange
  show_daily: 'yes'
  mppts: two
load:
  colour: '#5fb6ad'
  show_daily: 'yes'
  show_aux: 'no'
  invert_aux: 'no'
grid:
  colour: '#5490c2'
  show_daily: 'yes'
  show_daily_buy: 'yes'
  show_daily_sell: 'no'
  show_nonessential: 'yes'
  no_grid_colour: red
entities:
  use_timer_248: 'no'
  priority_load_243: 'no'
  batchargeday_70: sensor.solarman_daily_battery_charge
  batdischargeday_71: sensor.solarman_daily_battery_discharge
  loadday_84: sensor.solarman_daily_load_consumption
  grid_buy_day_76: sensor.solarman_daily_energy_bought
  grid_sell_day_77: sensor.solarman_daily_energy_sold
  solarday_108: sensor.solarman_daily_production
  inverter_grid_voltage_154: sensor.solarman_grid_voltage_l1
  inverter_load_freq_192: sensor.solarman_load_frequency
  inverter_out_164: sensor.solarman_current_l1
  inverter_out_175: sensor.solarman_inverter_l1_power
  inverter_load_grid_169: sensor.solarman_internal_ct_l1_power
  pv2_power_187: sensor.solarman_pv2_power
  pv1_power_186: sensor.solarman_pv1_power
  pv3_power_188: sensor.solarman_pv3_power
  pv4_power_189: sensor.solarman_pv4_power
  battery_voltage_183: sensor.solarman_battery_voltage
  battery_soc_184: sensor.solarman_battery_soc
  battery_out_190: sensor.solarman_battery_power
  essential_power: none
  nonessential_power: none
  grid_external_power_172: sensor.solarman_external_ct_l1_power
  pv1_v_109: sensor.solarman_pv1_voltage
  pv1_i_110: sensor.solarman_pv1_current
  pv2_v_111: sensor.solarman_pv2_voltage
  pv2_i_112: sensor.solarman_pv2_current
  pv3_v_113: sensor.solarman_pv3_voltage
  pv3_i_114: sensor.solarman_pv3_current
  pv4_v_115: sensor.solarman_pv4_voltage
  pv4_i_116: sensor.solarman_pv4_current
  grid_status_194: sensor.sunsynkcard_gridstatus
  inverter_status_59: sensor.sunsynkcard_inverterstatus
  aux_power_166: 'no'

Screenshot_20230513-151500_Home Assistant.jpg
 
Last edited:
It might work for your setup but you may need to sum External CT L1 Power (170) and External CT L2 Power (171) to get Total External Power = 172
Internal CT L1 Power (167) + Internal CT L2 Power (168) should equal Total Grid Power (169)

So you should use 172-169 for nonessential.
 
It might work for your setup but you may need to sum External CT L1 Power (170) and External CT L2 Power (171) to get Total External Power = 172
Internal CT L1 Power (167) + Internal CT L2 Power (168) should equal Total Grid Power (169)

So you should use 172-169 for nonessential.
Yeah basically take both external internal cts into account ( 4 in total , 2 ex 2 in ). But one can create straight helpers to sum each of those to get the same outputs. There is likely the same codes available ( registers ) , just they aren't exposed in the solarman integration. When I got a gap I'll do a proper cross check. I think one issue was that one was a reverse negative so couldn't apply like for like. Otherwise can do another pr to the solarman integration team for missing ones like I did for the battery and frequancy.
 
v1.4.4
Updates
  • Adds sensor for battery current
  • Adjustments to battery layout to accommodate battery current

1684081242290.png
 
Im using the kellerza addon to get my stats from my sunsynk.
However, i cant seem to find an entry for the inverter current. (inverter_out_164)

These are the only Inverter sensors i have access to.
1684134615207.png

Any advise?
 
Im using the kellerza addon to get my stats from my sunsynk.
However, i cant seem to find an entry for the inverter current. (inverter_out_164)

These are the only Inverter sensors i have access to.
View attachment 1524181

Any advise?
Don't see a total but these are the individual sensors. 166 jumps to Generator stuff.

164L1
Inverter output current L1
R0.01Aint Signed int
165L2
Inverter output current L2
R0.01Aint Signed int

also 154 is L1 specific, 155 is L2 and 156 is Total Voltage.

154L1-N
inverter output voltage L1-N
R0.1V
155L2-N
inverter output voltage L2-N
R0.1V
156L1-L2 inverter output voltage L1-L2R0.1V

*Disclaimer* This is from the sunsynk modbus doc ( appears similar for Deye as well, tested on mine )
 
Last edited:
Im using the kellerza addon to get my stats from my sunsynk.
However, i cant seem to find an entry for the inverter current. (inverter_out_164)

These are the only Inverter sensors i have access to.
View attachment 1524181

Any advise?
Not sure if this might help, but I created a template sensor

YAML:
sensor:
  - platform: template
    sensors:
       ss_inverter_current:
          friendly_name: "Inverter Current"
          value_template: "{{ (states('sensor.ss_inverter_power') |float(0) / states('sensor.ss_inverter_voltage') |float(0) ) | round(0)}}"
          unit_of_measurement: 'A'
          device_class: current
 
Don't see a total but these are the individual sensors. 166 jumps to Generator stuff.

164L1
Inverter output current L1
R0.01Aint Signed int
165L2
Inverter output current L2
R0.01Aint Signed int

also 154 is L1 specific, 155 is L2 and 156 is Total Voltage.

154L1-N
inverter output voltage L1-N
R0.1V
155L2-N
inverter output voltage L2-N
R0.1V
156L1-L2 inverter output voltage L1-L2R0.1V

*Disclaimer* This is from the sunsynk modbus doc ( appears similar for Deye as well, tested on mine )
This was a big help.

Added the custom sensor file to the addon, with the fetch of those values and all sorted.

thanks a mil
 
Not sure if this might help, but I created a template sensor

YAML:
sensor:
  - platform: template
    sensors:
       ss_inverter_current:
          friendly_name: "Inverter Current"
          value_template: "{{ (states('sensor.ss_inverter_power') |float(0) / states('sensor.ss_inverter_voltage') |float(0) ) | round(0)}}"
          unit_of_measurement: 'A'
          device_class: current
Was considering this route, but eventually decided to go the custom sensor route to pull the value directly from the inverter so less math for my HASS to do. Thanks for taking the time to respond
 
Was considering this route, but eventually decided to go the custom sensor route to pull the value directly from the inverter so less math for my HASS to do. Thanks for taking the time to respond
No worries.

Mind sharing the custom sensor ? Would like to compare the 2 ?
 
Hmmm, what if you shifted the SOC out of the "box" to a larger bolder font like the Daily Stuff under the battery? Not sure what others thoughts are on that? TBH I have a gauge under mine to highlight the SOC.

1684137677228.png

1684137703375.png
 
No worries.

Mind sharing the custom sensor ? Would like to compare the 2 ?
Certainly.

I only used L1 as L2 returned zero consistently.

Python:
from sunsynk import AMPS, CELSIUS, KWH, VOLT, WATT
from sunsynk.rwsensors import NumberRWSensor, SelectRWSensor, TimeRWSensor
from sunsynk.sensors import (
    MathSensor,
    Sensor,
    SensorDefinitions,
    TempSensor,
)

SENSORS = SensorDefinitions()

SENSORS += Sensor(164, "Inverter Current", AMPS, -0.1)
 
Last edited:
@Slip how can I make it bigger? I'd love for it to consume an entire panel all by itself as a quick view of what's going on.
 
Top
Sign up to the MyBroadband newsletter
X