Custom Solar Power Card the Tesla Style (almost)

Hi,

I’ve setup my entities for all the combinations on the panel.
I don’t think the grid to battery is showing the flow correctly.

These are the values of my sensors…

house_consumption_entity: 0.6
grid_consumption_entity: 2.9
grid_feed_in_entity: 0.0
solar_consumption_entity: 1.0
solar_yield_entity: 1.0
grid_to_battery_entity: 1.2999999999999998
battery_charge_entity: 80
battery_charging_entity: 3.3
battery_consumption_entity: 0.0
car_battery_entity: 55
car_charging_entity: 0.0
car2_battery_entity: 65
car2_charging_entity: 0.0

I got these from:

house_consumption_entity: {{ states('sensor.harvi_home') }}
grid_consumption_entity: {{ states('sensor.harvi_grid_import') }}
grid_feed_in_entity: {{ states('sensor.harvi_grid_export') }}
solar_consumption_entity: {{ states('sensor.harvi_solar') }}
solar_yield_entity: {{ states('sensor.solaredge_ac_power_kw_output' )}}
grid_to_battery_entity: {{ states('sensor.grid_to_battery') }}
battery_charge_entity: {{ states('sensor.powerwall_charge_corrected') }}
battery_charging_entity: {{ states('sensor.harvi_powerwall_charge') }}
battery_consumption_entity: {{ states('sensor.harvi_powerwall_discharge') }}
car_battery_entity: {{ states('sensor.jyggy_battery_level') }}
car_charging_entity: {{ states('sensor.zappi_jyggy_power') }}
car2_battery_entity: {{ states('sensor.vf1ag000366115079_battery_level') }}
car2_charging_entity: {{ states('sensor.zappi_paddy_power') }}

My calculation for Grid to Battery so far is…

{% if ((states('sensor.harvi_powerwall_charge') | float) > 0.0)  and  ((states('sensor.harvi_grid_import') | float) > 0.0)  %}
{{ (states('sensor.harvi_grid_import') | float) - (states('sensor.harvi_home') | float) - (states('sensor.solaredge_ac_power_kw_output') | float) }}
{% else %}0.0{% endif %}

But my card shows no flow from grid to battery ?

grid_to_batt

What is solar consumption? The solar produces, not consumes… I don’t have any way of determining how much solar production gets used in the house vs what gets exported to the grid other than creating a template sensor to calculate solar_production - house_consumption, which is my grid export value anyway…

Charging the battery from grid:
I’m not sure, but I think that the value for the battery comes only from the ‘battery_charging_entity’.
The ‘grid_to_battery_entity’ seems to be only used for the animation (which works good).
So, once I understood this I changed the template sensor for the ‘battery_charging_entity’ to get the right value for charging from the grid. I have this not tested yet but this would be OK for me.
Sorry for any inconvenience.

Not sure, I didn’t write it, but if it’s required it must use it somewhere. I created template sensors for ones I didn’t have and worked from there. Add a template sensor and re-test. Or wait for dev to reply.

Hi,

I’ve been reading a lot and trying out various settings, but I just don’t get it working properly.

Would anyone like to help me on my way?

I have the following data available from my Enphase Envoy-S Metered with a consumption and yield measurement coil.

  1. sensor.envoy_current_energy_consumption
  2. sensor.envoy_current_energy_production

How do I get this processed in the items below?

//general
house_consumption_entity: sensor.house_consumption
//grid
grid_consumption_entity: sensor.grid_consumption
grid_feed_in_entity: sensor.grid_feed_in
//solar
solar_consumption_entity: sensor.solar_consumption
solar_yield_entity: sensor.solar_yield
type: 'custom:tesla-style-solar-power-card

I’ve tried to create the following additional sensors, but still I can’t figure it out:

  • platform: template
    sensors:
    grid_power_export: # Grid Power Export for Sense Power Wheel
    friendly_name: 'Grid power export
    unit_of_measurement: 'W
    value_template: >-
    {(states(“sensor.envoy_current_energy_production”) | float | int) - (states(“sensor.envoy_current_energy_consumption”) | float | int) }}
  • platform: template
    sensors:
    grid_power_import: # Grid Power Export for Sense Power Wheel
    friendly_name: 'Grid power import
    unit_of_measurement: 'W
    value_template: >-
    {(states(“sensor.envoy_current_energy_consumption”) | float | int) - (states(“sensor.envoy_current_energy_production”) | float | int) }}

Who wants to help me and others?

Thank you in advance for your feedback.

That is probably more likely when you post your code properly :slight_smile: How to help us help you - or How to ask a good question

I love the look of this card and my Powerwall app looks so good so I want this on my home assistant but I struggle to set this card up. Can anyone with a similar setup post their configuration and sensors?

sorry, name was chosen wrong. Solar consumption will in the future be called battery_from_solar_entity.

I see, there is a bug. Due to the fact, that in germany we cannot (legaly) load the battery from grid, I have never tested it. So the lower flow is actually only the one from the battery and never from the grid. This should be an added one. I’m working on a new iteration that will allow this. It’s almost done and also has some nice extra features.
Just as a note, bugs like this should be posted as an issue in github rather than here. I would have corrected this much earlier. Sorry

Question to all here. I have created a new completely reworked version of this card. The problem I’m facing is it won’t be backwards compatible. Do you think it would be a big issue for you to migrate your setup when the new version comes out? Or do I have to create a backwards compatible version that I warn as “deprecated”? Second one will take a week longer at least.

1 Like

no problem, I was going to raise it on github if you didn’t respond. Just hadn’t got round to it yet.
I’ll do that if I spot anything else.

Thanks

I’m happy to start with something new, it’s no big deal, just have to put in the correct sensors.

1 Like

This will not work, since now you will see the flow from battery whenever there is only grid_to_battery :frowning: I’m already on the solution

Ok, so since I don’t have batteries yet how can I get the card to work properly without that entity? I’d like to use it with just:

  • Solar generation
  • Grid import
  • Grid export
  • House consumption

It looks like others have done this but mine isn’t working (code posted further up thread)

I am just starting to get this card up and running but man is it amazing, I do not mind migrating to a new revision, great work with the card much love

Hey,
thx for the card, much appreciated.
One question i have: Did you measure the power consumption of the EV charging on the charger? I dont have this values and just collect the data from the Tesla integration, which just shows gained km per hour.

Are there any workaround, or i cannot use the hole function of this card.

Thx.

Sure man, here you go, create a template sensor like this one:

tesla_current_charging:
        friendly_name: "Tesla Charging with"
        value_template: "{{ (states.sensor.tesla_charging_rate_sensor.attributes.charger_actual_current * states.sensor.tesla_charging_rate_sensor.attributes.charger_voltage / 1000 ) | round(1) }}"
        unit_of_measurement: "kW"
2 Likes

Great work! Love this card!

Opened a couple of PR’s with contributions :wink:

Saw that and already implemented a few things on the new version, will try to get to merging at least one today or tomorrow

Hi all,

i have got a question in regards to this card. I have implemented the card into HA successfully. My solarlog is providing the data for the sensors used but it provides only one sensor for:

grid_consumption_entity
grid_feed_in_entity

So if the value is negative it we are taking power from the grid and if positive we are injecting power to the grid. Basicaly this means the animation is not working for me when taking power from grid.
Is there a way to get that fixed? I already thought of a template sensor that is inverting the value when minus. But i have no clue how to do that… is there someone who could help me with that or even has a better idea of solving this?

Greetings