Sunsynk + Home Assistant

Have a look here: https://github.com/kellerza/sunsynk/issues/122

Energy dashboard is best way, but it doesn't create the daily sensors to use with the sunsynk card. That is why creating the sensors with utility meter to display in the card, is needed. If you want it there

But the card doesn’t use monthly anyway.

And the daily sensors come directly from inverter.

And yes, Energy Dashboard is the right answer, no faffing with other kak required.
 
But the card doesn’t use monthly anyway.

And the daily sensors come directly from inverter.

And yes, Energy Dashboard is the right answer, no faffing with other kak required.
Which integration/addon are you using for your setup ?

I use the monthly sensors for something else, just copied it from my configuration and didn't take it out.
 
Thanks @w1tw0lf.

I had tried originally to built the utility meter using PV energy and PV Power from solar assistant , with a daily reset (using the delta option too) and the value is just nuts .. tried again yesterday with same output.

I need to make a request again to the solar assistant team to expose the daily values via MQTT, so that ou's like me , can just get on with it. Don't know why they only expose weekly values

Though on the other hand, I already see now that I use Slips card, I am not going into Solar assistant so much. Screenshot_20230520_084336_Home%20Assistant.jpgScreenshot_20230520_084654_Home%20Assistant.jpg
 
@TedLasso It seems like you using the wrong sensor on the 1st screenshot.

This might be easier, go to settings, devices & services, helpers and click on "+ creater helper" in the bottom right. Scroll down and select utility meter. Give it a name, the input sensor must have measurement in kwh, like on your second screen "Grid energy in". Set reset cycle to daily. Switch off, "Periodically resetting" and click submit. That should do it then.
 
Ah okay. As per the issue from github shared, the monthly one gave issues, most likely why I ended up using both daily and monthly sensors created with utility meter.

Yeah that was my confusion since the card only uses daily.

Since Energy Dashboard I have no need for utility meters at all.
 
Yeah that was my confusion since the card only uses daily.

Since Energy Dashboard I have no need for utility meters at all.
No worries...

Have it on this card on mobile to keep the minister of finance happy, where I use it.

1684578382741.png
Now she can she on her phone what the energy cost would have been if we didn't go solar and "skip" loadshedding with it. Planning on adding 2 more battries to take us "off grid" most of the time.
 
No worries...

Have it on this card on mobile to keep the minister of finance happy, where I use it.

View attachment 1527163
Now she can she on her phone what the energy cost would have been if we didn't go solar and "skip" loadshedding with it. Planning on adding 2 more battries to take us "off grid" most of the time.

Would be nice if energy Dashboard exposed its values for that use case.
 
@TedLasso It seems like you using the wrong sensor on the 1st screenshot.

This might be easier, go to settings, devices & services, helpers and click on "+ creater helper" in the bottom right. Scroll down and select utility meter. Give it a name, the input sensor must have measurement in kwh, like on your second screen "Grid energy in". Set reset cycle to daily. Switch off, "Periodically resetting" and click submit. That should do it then.
So that was my mistake. Using a W/V sensor and not a kWh sensor. I've created them all as you suggested and now will wait for tomorrow to see what they generate. The fact that 5 minutes later none of them show a value - I think is a very good sign :)
 
So that was my mistake. Using a W/V sensor and not a kWh sensor. I've created them all as you suggested and now will wait for tomorrow to see what they generate. The fact that 5 minutes later none of them show a value - I think is a very good sign :)
It should start showing values in about an hour and will update once an hour.
 
No worries...

Have it on this card on mobile to keep the minister of finance happy, where I use it.

View attachment 1527163
Now she can she on her phone what the energy cost would have been if we didn't go solar and "skip" loadshedding with it. Planning on adding 2 more battries to take us "off grid" most of the time.
That is a cool page. Thanks to your help - mine 'Slip' card is now fully populated too. Thanks Sir!!

Note: Daily values off as they only started populating from 2pm onwards

1684608812763.png
 
I'm actually struggled with accessing the custom sensors that are created using kellerza's docs.

Code:
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(186, "PV1 power", WATT, -1),
        Sensor(187, "PV2 power", WATT, -1),
        MathSensor((175, 169, 166), "Essential power", WATT, factors=(1, 1, -1), absolute=True),
        Sensor(172, "Grid Ct Power", WATT, -1),
        Sensor(178, "Load power", WATT, -1),
        Sensor(190, "Battery power", WATT, -1),
        MathSensor((172, 167), "Non-Essential power", WATT, factors=(1, -1), no_negative=True),
        )

I used the above code. When starting the add-on, it shows that the custom sensors have been imported, however they do no appear in under Develop tools in HA.
 
No worries...

Have it on this card on mobile to keep the minister of finance happy, where I use it.

View attachment 1527163
Now she can she on her phone what the energy cost would have been if we didn't go solar and "skip" loadshedding with it. Planning on adding 2 more battries to take us "off grid" most of the time.
Nice card, mind sharing the config? I am the minister of finance in my house but this would be useful for the KwH impaired at home.
 
I'm actually struggled with accessing the custom sensors that are created using kellerza's docs.

Code:
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(186, "PV1 power", WATT, -1),
        Sensor(187, "PV2 power", WATT, -1),
        MathSensor((175, 169, 166), "Essential power", WATT, factors=(1, 1, -1), absolute=True),
        Sensor(172, "Grid Ct Power", WATT, -1),
        Sensor(178, "Load power", WATT, -1),
        Sensor(190, "Battery power", WATT, -1),
        MathSensor((172, 167), "Non-Essential power", WATT, factors=(1, -1), no_negative=True),
        )

I used the above code. When starting the add-on, it shows that the custom sensors have been imported, however they do no appear in under Develop tools in HA.
You don't necessarily need to add them to mysensors.py. You need to add the ones you want from here in the configuration section of the add-on: 1684765933824.png
You can just type in the relevant sensor name in `SENSORS` and hit then enter. Repeat for each sensor then hit save and restart.

EDIT: adding sensors to the mysensors.py file just makes them available to add as described above, you still need to follow the same process to get them into Home Assistant.
 
Nice card, mind sharing the config? I am the minister of finance in my house but this would be useful for the KwH impaired at home.
Here you go:

Code:
type: custom:vertical-stack-in-card
cards:
  - type: custom:vertical-stack-in-card
    cards:
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-template-card
            entity: sensor.daily_energy
            secondary: '{{states(''sensor.daily_load_cost'')}}'
            primary: |
              {{ states('sensor.daily_energy')}} KwH
            icon: mdi:home-lightning-bolt-outline
            icon_color: '#5FB6AD'
            tap_action:
              action: more-info
            layout: vertical
          - type: custom:mushroom-template-card
            entity: sensor.daily_solar_energy
            secondary: '-{{states(''sensor.daily_pv_savings'')}}'
            primary: |
              {{ states('sensor.daily_solar_energy')}} KwH
            icon: mdi:solar-power-variant-outline
            icon_color: '#FF9B30'
            layout: vertical
            tap_action:
              action: more-info
          - type: custom:mushroom-template-card
            entity: sensor.daily_grid_energy
            secondary: '{{states(''sensor.daily_grid_cost'')}}'
            primary: |
              {{ states('sensor.daily_grid_energy')}} KwH
            icon: mdi:transmission-tower
            icon_color: '#5490C2'
            layout: vertical
            tap_action:
              action: more-info
      - type: custom:mini-graph-card
        entities:
          - entity: sensor.daily_energy
            name: Load
            color: '#5FB6AD'
          - entity: sensor.daily_solar_energy
            name: Solar
            color: '#FF9B30'
          - entity: sensor.daily_grid_energy
            name: Grid
            color: '#5490C2'
        name: Energy consumption
        hours_to_show: 168
        height: 73
        aggregate_func: max
        show:
          fill: fade
          icon: false
          state: false
          graph: bar
          name: false
          legend: false
        group_by: date
  - type: custom:vertical-stack-in-card
    cards:
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-template-card
            entity: sensor.monthly_energy
            secondary: '{{states(''sensor.monthly_load_cost'')}}'
            primary: |
              {{ states('sensor.monthly_energy') }} KwH
            icon: mdi:home-lightning-bolt-outline
            icon_color: '#5FB6AD'
            layout: vertical
            tap_action:
              action: more-info
          - type: custom:mushroom-template-card
            entity: sensor.monthly_solar_energy
            secondary: '-{{states(''sensor.monthly_pv_savings'')}}'
            primary: |
              {{ states('sensor.monthly_solar_energy') }} KwH
            icon: mdi:solar-power-variant-outline
            icon_color: '#FF9B30'
            layout: vertical
            tap_action:
              action: more-info
          - type: custom:mushroom-template-card
            entity: sensor.monthly_grid_energy
            secondary: '{{states(''sensor.monthly_grid_cost'')}}'
            primary: |
              {{ states('sensor.monthly_grid_energy') }} KwH
            icon: mdi:transmission-tower
            icon_color: '#5490C2'
            layout: vertical
            tap_action:
              action: more-info
      - type: custom:mini-graph-card
        entities:
          - entity: sensor.monthly_energy
            name: Load
            color: '#5FB6AD'
          - entity: sensor.monthly_solar_energy
            name: Solar
            color: '#FF9B30'
          - entity: sensor.monthly_grid_energy
            name: Grid
            color: '#5490C2'
        name: Energy consumption
        height: 73
        aggregate_func: max
        show:
          fill: fade
          icon: false
          state: false
          graph: bar
          name: false
          legend: false
        group_by: date
  - type: custom:vertical-stack-in-card
    cards:
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-template-card
            entity: sensor.daily_energy
            secondary: Charge
            primary: |
              {{ states('sensor.daily_battery_charge_energy') }} KwH
            icon: mdi:battery-arrow-up
            icon_color: '#FFFF00'
            tap_action:
              action: more-info
          - type: custom:mushroom-template-card
            entity: sensor.daily_solar_energy
            secondary: Discharge
            primary: >
              {{ states('sensor.daily_battery_discharge_energy') | round(2) }}
              KwH
            icon: mdi:battery-arrow-down
            icon_color: '#975AB6'
            tap_action:
              action: more-info
      - type: custom:mini-graph-card
        entities:
          - entity: sensor.daily_battery_charge_energy
            name: Charge
            color: '#FFFF00'
          - entity: sensor.daily_battery_discharge_energy
            name: Discharge
            color: '#975AB6'
        name: Energy consumption
        hours_to_show: 168
        height: 73
        aggregate_func: max
        show:
          fill: fade
          icon: false
          state: false
          graph: bar
          name: false
          legend: false
        group_by: date
  - type: custom:vertical-stack-in-card
    cards:
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-template-card
            entity: sensor.monthly_energy
            secondary: Charge
            primary: |
              {{ states('sensor.monthly_battery_charge_energy') }} KwH
            icon: mdi:battery-arrow-up
            icon_color: '#FFFF00'
            tap_action:
              action: more-info
          - type: custom:mushroom-template-card
            entity: sensor.monthly_solar_energy
            secondary: Discharge
            primary: |
              {{ states('sensor.monthly_battery_discharge_energy') }} KwH
            icon: mdi:battery-arrow-down
            icon_color: '#975AB6'
            tap_action:
              action: more-info
      - type: custom:mini-graph-card
        entities:
          - entity: sensor.monthly_battery_charge_energy
            name: Charge
            color: '#FFFF00'
          - entity: sensor.monthly_battery_discharge_energy
            name: Discharge
            color: '#975AB6'
        name: Energy consumption
        height: 73
        aggregate_func: max
        show:
          fill: fade
          icon: false
          state: false
          graph: bar
          name: false
          legend: false
        group_by: date
card_mod:
  style: |
    :host {
      --ha-card-border-width: 0px
    }
 
V1.4.6
Updates

Add new card option large_font: to increase the size of the displayed sensor data. Default is no. Set to yes to enable. See README and example card config for more information

View attachment 1526275

Now everyone can be happy
Really loving this card. Would it be possible to replace the "battery runtime" with a "time until full" countdown when the battery is charging?
 
Top
Sign up to the MyBroadband newsletter
X