I’m very new to templating. I’ve got the Snoo integration running and it produces values of “ONLINE”, “BASELINE”, “LEVEL 1”, etc. These appear to be strings. I would like to convert them to numbers so I can use a Lovelace gauge card to display the status. Something along the lines of this.
template:
- sensor:
- name: Baby Monitor
state: >
{if sensor.parker_s_snoo == "ONLINE" { 0 }
if sensor.parker_s_snoo == "BASELINE" {0}
if sensor.parker_s_snoo == "LEVEL 1 {1}
if sensor.parker_s_snoo == "LEVEL 2 {2}
if sensor.parker_s_snoo == "LEVEL3 {3}}
My syntax is probably a disaster, can anyone help point me in the right direction?
You also need a unit of measurement for graphs, not sure about the gauge card but I suspect so.
You should also use an availability template or your gauge card will complain with an ugly message about that non numeric else state if it ever happens.