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 - #3

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