Okay rereading the github page, I noticed that all sensors need to be a positive number. It seems the adjusted sensor (sensor.solaredge_template_panels_2_grid) returns a negative result when the solar is below the house load
I read through the post again and found @Robbie-65 posted some code (thanks Robbie) to ensure the value doesn’t go below ‘0’. I’m not sure if this will work but I’ve created two test sub-sensor referencing the panel to grid sensor (sensor.solaredge_template_panels_2_grid) and will need to wait until I have some more sun to see if these values produce a positive value
# Make sure that Grid Feed-In is always positive
solar_tesla_panel_2_grid1:
friendly_name: "panel 2 grid out1"
unit_of_measurement: 'kW'
value_template: >
{% if states('sensor.solaredge_template_panels_2_grid') | int > 0 %}
0
{% else -%}
{{ (states('sensor.solaredge_template_panels_2_grid') | int) | abs }}
{% endif %}
solar_tesla_panel_2_grid2:
friendly_name: "panel 2 grid out2"
unit_of_measurement: 'kW'
value_template: >
{% if states('sensor.solaredge_template_panels_2_grid') | int > 0 %}
{{ states('sensor.solaredge_template_panels_2_grid') }}
{% else -%}
0
{% endif %}
Hi All,
I need some Noob level help on this one please.
I’m attempting to set it up with the Tesla Powerwall Integration.
When I paste in the template sensor codes into my configuration.yaml, I receive differing errors, such as Platform not found.
Can anyone point me to where I should be pasting this in please?
- platform: template
sensors:
tesla_card_grid_consumption:
unique_id: 'tesla_card_5fee6ddd5c1f42a099067ce9dd44e6d1'
value_template: "{{ states('sensor.powerwall_site_now') | float | max(0) }}"
device_class: power
unit_of_measurement: kW
tesla_card_grid_feed_in:
unique_id: 'tesla_card_52d22b847ade42c5b4526b2ff15f5aef'
value_template: "{{ states('sensor.powerwall_site_now') | float | min(0) | abs }}"
device_class: power
unit_of_measurement: kW
tesla_card_solar_consumption:
unique_id: 'tesla_card_2bb67bd5264f4ec39f141f1722fea085'
value_template: >-
{% set solar = states('sensor.powerwall_solar_now') | float %}
{% set house = states('sensor.powerwall_load_now') | float %}
{{ solar if house > solar else house }}
device_class: power
unit_of_measurement: kW
tesla_card_battery_consumption:
unique_id: 'tesla_card_2b7aaa2588e8480aaba586815a84fcd7'
value_template: "{{ states('sensor.powerwall_battery_now') | float | max(0) }}"
device_class: power
unit_of_measurement: kW
tesla_card_battery_charging:
unique_id: 'tesla_card_9c46447cf75942ba9ac4bcaca85ba6c5'
value_template: "{{ states('sensor.powerwall_battery_now') | float | min(0) | abs }}"
device_class: power
unit_of_measurement: kW
I just changed my definitions to the new ones in the bottom of the GitHub readme. The card now seems to be broken. Specifically I noticed that there is no grid_to_battery_entity in the GitHub code. The apparent result is no line from Grid to battery and the kW in the battery reads NaN. I did just reload the code to make sure I wasn’t on an old level.
The example in the Github has simplified my convoluted attempt massively, thank you
I’m not sure if the grid_to_battery_entity is all of my problem or if I’ve messed something else up.
Could somebody please share their sensor for this please?
In response to the question about the powerwall charge, mine is working great. My entry looks the same as yours, I have:
battery_charge_entity: sensor.powerwall_charge
I’m more than happy about this great card! Perfect!
But I still have one more idea:
Is it possible to configure the icons in a way, that e.g. the house is displayed in green if it is only supplied by solar power, in yellow if it is powered by solar power and power from the grid and in red, if only power from the grid is used?
I tried to chande the *.js file in different ways, but I didn’t become it working…
And I am no specialist in programming cards…
Maybe someone can help me?
Maybe it is also possbile to make the colors configurable via tha yaml-data for the card?
Have only just started on this journey myself, am not a developer at all, but am happy to share what I’ve done.
For the kW in the battery reading NaN, I’ve used the following in my card configuration, although I just get 0 %, as per my post above.
battery_charge_entity: sensor.powerwall_charge
As for the grid to battery, I’ve changed the template to include another sensor which is calculated as load_now - battery_now - solar_now as follows, although this is still a work in progress.
For anyone that feels adventurous you can now test the new beta of the card you can download the js file or checkout the branch here:
Beware the configuration variables have changed to allow for a more clear calculation. I’m not sure if it makes it easier, but at least it will be clearer what is what. As soon as I have a few people giving me an ok I will release it to HACS. After that I will create a new thread since this one will be deprecated anyway.
Nothing has changed currently but the next release will sadly be backwards incompatible. So enjoy for now. Next version has all the feature wishes I found until two weeks ago included and new ones will be easier to add.
first thanks a lot for this great card! Really appreciate the work done!
As I added it to successfully to my HA, I quickly wanted to share the stepd and config.
Since I use a Kostal Plenticore inverter and a BYD battery, I hope this might be helpful for others.
For the Kostal inverter, I added per HACS the Kostal Plenticore integration that creates a lot of sensors right away. Bear in mind that the inverter´s IP and interface password is required!
Then I added the Tesla Style Power Card via HACS (in the frontend section).
In order to get the correct & positive values for the missing sensors, I added the below in the configuration.yaml (took me a while as I am not familiar with any coding syntax):
Once they were set up (and the core was restarted) , I recommend first to check in the developer tools, if the entity is properly created and working. If all is well, it looks like this:
With this done, I used the below code to create the card in lovelace:
Great integration, thank you. My case is as follows. I have two wallboxes but I do not have a battery, in this configuration the EVs overlap. When I add batteries, the EVs are OK!
what version are you using? The latest Beta should not have that problem beta1.1.3. But if you are migrating from a prior version beware, the entities required have changed and will change again when 1.1 is out
# This is used for Telsa Solar / Consumption power distribution card
# sensor used to show power flow from Panels to Grid, but shows a negative at night
solaredge_template_panels_2_grid_day:
friendly_name: 'Panels 2 Grid during daylight'
value_template: >-
{{ (states('sensor.solaredge_solar_power') | float -
states('sensor.solaredge_power_consumption') | float ) | round(2) }}
unit_of_measurement: 'kW'
device_class: "power"
# shows the current grid power being fed from the grid to the house and doesn't allow it to show a negative number only positive numbers
solaredge_template_curent_grid_consumption:
friendly_name: grid 2 house"
unit_of_measurement: kW
device_class: power
value_template: >-
{% if states('sensor.solaredge_grid_power')|float < 0 %}
0
{% else %}
{{ states('sensor.solaredge_grid_power') }}
{% endif %}
# sensor used to show power flow from Panels to Grid and doesn't allow it to show a negative number only positive numbers
solaredge_template_panels_2_grid:
friendly_name: 'Panels 2 Grid'
unit_of_measurement: 'kW'
device_class: "power"
value_template: >-
{% if states('sensor.solaredge_template_panels_2_grid_day') | int > 0 %}
{{ states('sensor.solaredge_template_panels_2_grid_day') }}
{% else -%}
0
{% endif %}
# shows the solar power being fed to the house and doesn't allow it to show a negative number only positive numbers
solaredge_template_curent_solar_consumption:
friendly_name: Solar 2 House"
unit_of_measurement: kW
device_class: power
value_template: >-
{% if states('sensor.solaredge_template_panels_2_grid_day') | int > 0 %}
{{ states('sensor.solaredge_power_consumption') }}
{% else -%}
0
{% endif %}
Hey you all. I’m about to push the latest beta release 1.1.5 as the new version of the card. This one is NOT backwards compatible. Meaning you have to redefine the configuration. Now the flows are determining everything. Could some of you try to check out the Readme and let me know if this makes sense and you would know how to deal with it? Any feedback is welcome.