Templates To have NaN Unavailable Unknown Passed Without Error Log

so id liked to see Templates that are numerical that get Non numerical input get ignored by Error Logs

if its a Sensor. and its unavailable state and its a numerical sensor there is no error log for it

when i try to pass that same sensor to a Template i made for better Naming and its a Temperature in C
and it pass’s unavailable… Logs complain its a non numerical state…

so it should be
“NaN”, “unavaliable”, “unknown” when they are passed to a Template numerical just like a numerical sensor it doesnt throw an error.
it should allow those key words to be ignored as “string” should get treated the same way its processed however a “sensor” is processed

This is already implemented. Use the availability template option. e.g.

template:
  - sensor:
      - name: "Transmission Down Speed"
        unit_of_measurement: "kB/s"
        state: "{{ states('sensor.transmission_down_speed')|float * 1024 }}"
        availability: "{{ is_number(states('sensor.transmission_down_speed')) }}"

      - name: "Transmission Up Speed"
        unit_of_measurement: "kB/s"
        state: "{{ states('sensor.transmission_up_speed')|float * 1024 }}"
        availability: "{{ is_number(states('sensor.transmission_up_speed')) }}"
1 Like