I’m pretty new here and probably make a beginners mistake I created 2 variables (var.) I have the variable integration installed and it works fine.
…
peugeot_508e_last_energy:
friendly_name: “Peugeot 508e_Last_Energy”
state_class: measurement
unit_of_measurement: “Kwh”
icon: mdi:gauge
peugeot_508e_today_energy:
friendly_name: “Peugeot 508e_Today_Energy”
state_class: measurement
unit_of_measurement: “Kwh”
icon: mdi:gauge
…
I have an automation who is filling the var.peugeot_508e_last_energy This is without problem. And I can display the value.
Now I have an automation wich is calculating the differens between the original and the stored value. It works fine in the template simulator.
…
“{{ ‘%0.2f’ | format (states(“sensor.north_porch_peugeot_508e_142_energy”) |
float - states(“var.peugeot_508e_last_energy”) | float ) }}”
…
gives a real value “15.02”
When i put his in the action of an automation It doesn’t work and gives an unknown
…
service: var.set
data_template:
entity_id: var.peugeot508e_today_energy
value: >-
“{{ ‘%0.2f’ | format (states(“sensor.north_porch_peugeot_508e_142_energy”) |
float - states(“var.peugeot_508e_last_energy”) | float ) }}”
…
I tried a lot of differnt formats but no result
So i need some help here please