I have a total increasing template sensor to calculate the total electrical energy consumed in my house, just adding the energy values from different sensors I have installed. This is the code
{% set alumbrado = states('sensor.energia_circuito_alumbrado') | float %}
{% set cocina = states('sensor.energia_circuito_cocina') | float %}
{% set otros = states('sensor.energia_circuito_otros') | float %}
{% set lavadora = states('sensor.energia_circuito_lavadora') | float %}
{% set secadora = states('sensor.energia_circuito_secadora') | float %}
{% set lavavajillas = states('sensor.energia_circuito_lavavajillas') | float %}
{{ alumbrado + cocina + otros + lavadora + secadora + lavavajillas| round(2)}}
As I have not configured the default value for the float, I’m getting the “template error: Float got invalid input” but my question is
Can a set the default value to 0? what happen to the template value when any of the variables is getting the invalid value?
Sensor None has device class ‘energy’, state class ‘total_increasing’ unit ‘kWh’ and suggested precision ‘None’ thus indicating it has a numeric value; however, it has the non-numeric value: ‘1982.8999999999999 availability: > True’ (<class ‘str’>)
Availability cannot be configured in the template sensor editor and has to be configured directly in the yaml?
Ok, so now another question. I have checked my configuration.yaml and the templates configured in the GUI don’t appear there as code. So, Do I need to delete the GUI sensor and replicate it in the YAML or can I create the sensor with the same name and configure it in YAML?
If a delelte the GUI template, what happens with the historic data?