I have had this code working for sometime recently it stopped working, I’ve looked at the Templates HA page and noticed its using a legacy format. I have tried to correct it but everytime I just get errors! Can anyone help?
template:
- sensors:
front_sump_on_24:
friendly_name: "Front sump on over 24H"
value_template: '{{ states("sensor.front_sump_pump_energy_current_2") | float > 1 }}'
there should be no reason that the legacy template code would have stopped working if it had worked before. I have many template sensors running on the legacy format and I have no issues.
the new template format uses different key options for the sensors.
template:
- sensors:
name: "Front sump on over 24H"
state: '{{ states("sensor.front_sump_pump_energy_current_2") | float > 1 }}'
note that the entity_id of the sensor will change because the new format gets the entity_id from the name. the old format got the entity_id from the entity id you created.