Porzioev
(Emiliano Porzio)
November 27, 2024, 11:58am
1
Good day everyone… I’m try to do something similar, but i have always error report from HA
Can you please check this code for me?
# Calculated Value Sensor : Battery_Garage_KWH
- platform: template
sensors:
Battery_Garage_KWH2:
entity_id:
- sensor.energy_meter_1_energia
- sensor.inv_gar_out_energia
value_template: =
{set BatGarIn2 = states.sensor.energy_meter_1_energia.state| float }
{set BatGarOut2 = states.sensor.inv_gar_out_energia.state| float }
{{ (BatGarIn2 - BatGarOut2)|round(1) }}
Tinkerer
(aka DubhAd on GitHub)
November 27, 2024, 12:00pm
2
What error?
(I can probably guess, looking at that template, but it really helps people help you if you actually share these things)
1 Like
WallyR
(Wally)
November 27, 2024, 3:38pm
3
The bracket starts a Jinja2 line.
The characters following the bracket decide how the line should be treated.
{% is an internal handled line
{{ is a line that returns a result
YAML is key-value pairs.
The format is key: value, like platform: template
1 Like
finity
November 27, 2024, 9:21pm
4
Where exactly did you get all that template code?
I’m guessing some sort of hallucinogenic AI?
1 Like