Custom Solar Power Card the Tesla Style (almost)

Can someone please help me figure out how to set up this card with my system?

These are the sensors I’m pulling into HA:

PV Current Generation: sensor.sunsynk_solar_pv1_power
Battery Output (positive) and Charge (Negative): sensor.sunsynk_battery_output_power
Battery SOC: sensor.sunsynk_battery_soc
Current Grid Import (export disabled): sensor.sunsynk_grid_ct

House consumption would be the below two combined:
Non-essential Load: sensor.sunsynk_grid_load
Essential Load (UPS): sensor.sunsynk_grid_inverter_load

Got this setup and working alright. It looks as it should in the web interface.
However the card does not show in lovelace on the android app.
It only shows as a blank spot.

In the iOS app it’s sometimes not rendered correctly. If I pull from top the whole page refreshes and it works normal again. Can’t you do something like that on Android?

Awesome card by the way, well done :slight_smile:
Small issue with the alignment of the house to EV line where it is not quite centered and the correct height and I guess the line from the PV going down and from the Batery going up are also not centered.
That’s in Chrome.
image

Hi who could help me with the following?

What do I miss that I can’t get it to work.

I have the following entities:

sensor.envoy_current_energy_consumption
sensor.envoy_current_energy_production

With the power-wheel-card I have it working with the following in lovelace dashboard:

type: custom:power-wheel-card
title: Power Distribution
solar_power_entity: sensor.envoy_current_energy_production
solar_icon: mdi:solar-power
grid_power_consumption_entity: sensor.importing
grid_power_production_entity: sensor.exporting
grid_icon: mdi:transmission-tower
color_icons: true

And the sensor.importing & sensor.exporting are constructed as follows:

  - platform: template
    sensors:
        energy_import_export:
          friendly_name: "Energy"
          value_template: "{% if (states('sensor.envoy_current_energy_production') | int - states('sensor.envoy_current_energy_consumption') | int) > 0 %}Exporting{% else %}Importing{% endif %}"
          icon_template: "{% if (states('sensor.envoy_current_energy_production') | int - states('sensor.envoy_current_energy_consumption') | int) > 0 %}mdi:arrow-up-box{% else %}mdi:arrow-down-box{% endif %}"
        exporting:
          friendly_name: "Current Energy Exporting"
          value_template: "{{ [0, (states('sensor.envoy_current_energy_production') | int - states('sensor.envoy_current_energy_consumption') | int)] | max }}"
          unit_of_measurement: 'W'
          icon_template: 'mdi:flash'
        importing:
          friendly_name: "Current Energy Importing"
          value_template: "{{ [0, (states('sensor.envoy_current_energy_consumption') | int - states('sensor.envoy_current_energy_production') | int)] | max }}"
          unit_of_measurement: 'W'
          icon_template: 'mdi:flash'

What should I do to get tesla-style-solar-power-card working?

This one is much nicer than the power-wheel-card.

Thank you for your help!

Great card, love it. It would be perfect with some more optional appliances, 2-3 more at least. Can it be done?

Also, an option to configure the size of the circles and the font, and maybe to choose rectangle vs circle.

Just throwing there some wishes. Amazing job, thanks for sharing it. :slight_smile:

Ok. So I started a new job and probably this card will only seldom see new features @alexdelprete unless other people join in. But you are right, I would also like to have more appliances, but maybe next year I can add them.
@MJPVDH I have the impression that you are trying to use negativa values, so import and export can be both positive and negative. This won’t work with my card, you have to create separate sensors for negative and positive since they mean different things.
As you will find in the docs you need to define the flows. So from what I see at least:
grid_to_house:
generation_to_house:
generation_to_grid:
And if you have a battery a few more. Have you gone through the readme?
So your templates should calculate the flows I defined above. So grid_to_house might be just importing. But the solar production will be calculated as a sum of generation_to_house and generation_to_grid and house consumption will be a sum of grid_to_house and generation_to_house. This sum is going to be done by the card. You have to provide each flow.

Yeah, this is because the first rendering does sometimes not get a width for the card. I’m thinking of at some point doing the whole animation just as a few css steps and a css based animation not with svgs. But I haven’t found the time and it will be a while.

1 Like

No problem, life comes first, we can live without extra appliances on the card.

All the best for your new job.

1 Like

This is a rather easy feature but I have some others lined up before this one. Could you create an issue in github please?

I’ve just migrated to this power card with an Envoy system. I had to add one more template sensor (just found a prettier version here):

sensor:
  - platform: template
    sensors:
      current_generation_to_house:
        friendly_name: "Current Generation to House"
        value_template: "{{ [0, (states('sensor.envoy_current_energy_production') | int - states('sensor.exporting') | int)] | max }}"
        unit_of_measurement: 'W'
        icon_template: 'mdi:flash'

And then the simplest configuration (no battery) looks like this:

type: custom:tesla-style-solar-power-card
grid_to_house_entity: sensor.importing
generation_to_grid_entity: sensor.exporting
generation_to_house_entity: sensor.current_generation_to_house

Hi, I am getting graphics scaled to dots almost. Can I somehow reset the scale or help it in any other way ?
Regards
Yassith

With the help from exxamalte i tink i get it done!

Put his info in the configuration.yaml

  - platform: template
    sensors:
        exporting:
          friendly_name: "Current Energy Exporting"
          value_template: "{{ [0, (states('sensor.envoy_current_energy_production') | int - states('sensor.envoy_current_energy_consumption') | int)] | max }}"
          unit_of_measurement: 'W'
          icon_template: 'mdi:flash'
        importing:
          friendly_name: "Current Energy Importing"
          value_template: "{{ [0, (states('sensor.envoy_current_energy_consumption') | int - states('sensor.envoy_current_energy_production') | int)] | max }}"
          unit_of_measurement: 'W'
          icon_template: 'mdi:flash'
        current_generation_to_house:
          friendly_name: "Current Generation to House"
          value_template: "{% if (states('sensor.envoy_current_energy_production') | int - states('sensor.envoy_current_energy_consumption') | int) > 0 %}{{ states('sensor.envoy_current_energy_consumption') | int }}{% else %}0{% endif %}"
          unit_of_measurement: 'W'
          icon_template: 'mdi:flash'

And this info in the Lovelace card.

type: custom:tesla-style-solar-power-card
grid_to_house_entity: sensor.importing
generation_to_grid_entity: sensor.exporting
generation_to_house_entity: sensor.current_generation_to_house

But now I get these values which are different from the custom:power-wheel-card

Only when export to grid then i see this:

My configuration works fine in both scenarios - importing from and exporting to grid.

From your screenshot taken while importing from the grid I would say that each card in itself is consistent, it’s just that the two cards are not in sync, correct?
When you observe the underlying sensor values for each of the cards, are the cards at least in sync with those sensor values?

Okay, but can you email me your config/sensor/ui-lovelace.yaml for the specific envoy setup please?

Or post it here?

My card configuration looks like the one you posted here.

And the original Envoy sensors are these two - everything else is just maths:

  • sensor.envoy_current_energy_production
  • sensor.envoy_current_energy_consumption
1 Like

You have probably an error in your generation_to_house_entity.