Sunsynk + Home Assistant

That battery runtime calculator you have there on the right is quite interesting.

Care to share details?
Sure. Its basically an implementation of the following:

YAML:
- platform: template
  sensors:
    soc_battery_time_left:
      friendly_name: "Battery Depletion Seconds"
      unit_of_measurement: Seconds
      value_template: >
        {% set state = states('sensor.battery_output_power') | int %}
        {% if state == 0 -%}
         {{ ((((states('sensor.battery_soc') | float - 20) /100) * 10640) / 60 * 60 ) | timestamp_custom('%s', 0) }}
        {%- else -%}
         {{ ((((states('sensor.battery_soc') | float - 20) /100) * 10640) / (states('sensor.battery_output_power') | float) * 60 * 60 ) | timestamp_custom('%s', 0) }}
        {%- endif %}
    soc_battery_time_left_friendly:
      friendly_name: "Battery Depletion Time"
      value_template: >
        {% set state = states('sensor.battery_output_power') | int %}
        {% if state > 0 -%}
         {%- set time = states('sensor.soc_battery_time_left') | int %}
         {%- set minutes = ((time % 3600) // 60) %}
         {%- set minutes = '{} minutes'.format(minutes) if minutes > 0 else '' %}
         {%- set hours = ((time % 86400) // 3600) %}
         {%- set hours = '{} hours, '.format(hours) if hours > 0 else '' %}
         {%- set days = (time // 86400) %}
         {%- set days = '{} day, '.format(days) if days > 0 else '' %}
         {{ 'Less than 1 minute' if time < 60 else days + hours + minutes }}
        {%- else -%}
         {{ 'Running on solar power' }}
        {%- endif %}

The "20" is the battery shutdown or minimum SOC
10640 is the total battery energy. in my case 3 x 5.32 kWh batteries.
Both of these attributes can be defined in the card config.

The first condition checks the battery output power. If this is negative the battery is charging and the assumption is I am running off grid or have sufficient solar. .
If positive calculates available battery energy and divides this by the current battery power being used and then converts to seconds

The java script code looks like this:

JavaScript:
    if (stateObj13.state > 0 && config.battery_energy !== "hidden") {
      let totalSeconds = ((((parseInt(stateObj12.state) - config.battery_shutdown_soc) / 100) * (config.battery_energy || 15960) ) / (stateObj13.state || 1)) * 60 * 60;
      const days = Math.floor(totalSeconds / (60 * 60 * 24));
      const hours = Math.floor((totalSeconds % (60 * 60 * 24)) / (60 * 60));
      const minutes = Math.floor((totalSeconds % (60 * 60)) / 60);
      if (days > 0) {
        duration += `${days} days, `;
      }
      if (hours > 0 || days > 0) {
        duration += `${hours} hrs, `;
      }
      duration += `${minutes} min`;
    }
    
    if (stateObj13.state <= 0) {
      duration = "Charging";
    }
 
I've updated the card to include a panel_mode. It removes any card height restrictions for better card scaling. For use with Panel(1 card) view types or grid layouts. @SauRoNZA might work better with your view now. Assuming you have a grid layout. @w1tw0lf I've also update grid_status_194 attribute. Now accepts 1/0 or `on/off`

Example of panel mode layout

1683154479790.png
 
I've logged a pull request to have it added to HACS. For now you can add it as a custom repository. CLick on front end and then the three dots on the right. Select custom reositories and past the github link.




I think I''ve figured it out. Should be easy enought to add a scale attribute



Whats nice is you can also scale it by 150% and have a really big card for tablet
Can confirm that your pull request has been actioned.

No longer need to add it manually
 
I've got some basic automation in place with a few Shelly, but I'm interested in getting a dashboard to display inverter related information. What are people using to display these dashboards? Just on the phone or do you have permanent displays set up? Leaning toward just using a basic tablet or something, but keen to see if there are better ideas.
 
I've got some basic automation in place with a few Shelly, but I'm interested in getting a dashboard to display inverter related information. What are people using to display these dashboards? Just on the phone or do you have permanent displays set up? Leaning toward just using a basic tablet or something, but keen to see if there are better ideas.

Unused iPad in kitchen

3e67b3f633e61848fb32c955d857ad56.jpg
 
I've updated the card to include a panel_mode. It removes any card height restrictions for better card scaling. For use with Panel(1 card) view types or grid layouts. @SauRoNZA might work better with your view now. Assuming you have a grid layout. @w1tw0lf I've also update grid_status_194 attribute. Now accepts 1/0 or `on/off`

Example of panel mode layout

View attachment 1518353
Unless I am doing something wrong, but doesn't display anything for grid. Currently we have loadshedding.

4b336ea96a9c1b05a0170d14cf4b40a4.jpg
 
Did you define the grid active entity?

grid_status_194: binary_sensor.grid_available
Yup, one of the updates for the card was for the 1 or 0 that the sunsynk integration gives. Before i had a template that changed the 1 to on and 0 to off.
 
I'm thinking of changing the inverter image. Which do you prefer new or old or neither :)

1683230484838.png
 
The new image

Would love the Battery image to be Green
We all need a bit of colour.. :)

Check out the new release v1.1.0

Updates
  • Change the inverter image to create a more unified look and feel.
  • Reposition some of the path elements
  • Add inverter_colour: attribute to the card config. Customise the look of your card by choosing your own inverter colour.
 
Would it be possible to while battery is charging, to only display "charging" and remove "battery runtime" that is below it ?

1683264370668.png
 
Top
Sign up to the MyBroadband newsletter
X