Closed chezpaul closed 2 years ago
change the names of the variables, and you should be good. You can always try the result on home assistant in the developer_tools section and see the result
battery_consumption:
value_template: '{% set batter_cons = sensor.powerwall_battery_now | int %}
{% if batter_cons > 0 %}
{{ batter_cons | int }}
{% else %}
0
{% endif %}'
device_class: power
unit_of_measurement: W``
I need some help as well, of possible.
I'm trying to keep my configuration.yaml as clean as possible.
If I were to use "!include" to use this instead of throwing all those line into my config.yml, how can I do that?
I tried creating this yml file called "powerwall.yaml":
template:
- sensor:
- name: "Tesla Card Grid Consumption"
unique_id: 'tesla_card_grid_consumption'
state: "{{ states('sensor.powerwall_site_now') | float | max(0) | round(1) }}"
device_class: power
unit_of_measurement: kW
- name: "Tesla Card Grid Feed In"
unique_id: 'tesla_card_grid_feed_in'
state: "{{ states('sensor.powerwall_site_now') | float | min(0) | abs | round(1) }}"
device_class: power
unit_of_measurement: kW
- name: "Tesla Card Solar Consumption"
unique_id: 'tesla_card_solar_consumption'
state: "{{ ((states('sensor.powerwall_solar_now') | float) - (states('sensor.tesla_card_grid_feed_in') | float ) - (states('sensor.tesla_card_battery_charging_inside') | float) ) | round(1) }}"
device_class: power
unit_of_measurement: kW
- name: "Tesla Card Battery Consumption"
unique_id: 'tesla_card_battery_consumption'
state: "{{ states('sensor.powerwall_battery_now') | float | max(0) | round(1) }}"
device_class: power
unit_of_measurement: kW
- name: "Tesla Card Battery Charging Inside"
unique_id: 'tesla_card_battery_charging_inside'
state: "{{ states('sensor.powerwall_battery_now') | float | min(0) | abs | round(1) }}"
device_class: power
unit_of_measurement: kW
And then added this to my configuration.yaml" file:
# Tesla Sensors for Tesla Dashboard
powerwall: !include powerwall.yaml
I do get the image, only it's static and only reads the battery charge, nothing else.
As long as it's in the configuration.yaml it works perfectly fine. The moment I try to move to include, not anymore.
Can someone please help me here?
Thank you.
This is not a question about the card but about home assistant itself. You cannot add any include file. Check the community forums
It figures. Thanks a lot man.
First off, beautiful card. Love it. just what I wanted. I got the gist of it but I'm not sure how to program in yaml with {If then, else}
Could someone help me code this sensor? Once I see how this one is done, I can do the others.
sensor.solar_consumption: if sensor.solaredge_current_power=0 then solar_consumption=0 else if sensor.solaredge_current_power>sensor.energy_usage then solar_consumption=sensor.energy_usage else
solar_consumption=sensor.solaredge_current_power end if end if
I tried but nothing worked. Thanks