At the moment I have the value of the sensor displayed with this script.
name: '[[[ return ` ${states[''sensor.warmepumpe_power_2''].state} Watt` ]]]'
I would now like to round it depending on the value.
< 1 kw as watts. E.g. 800 watts
and > 1 kw as kw. 2.5 kw
Can anyone help?
${ states[''sensor.warmepumpe_power_2''].state } ${ iif(states[''sensor.warmepumpe_power_2''].state < 1, ''watts'', ''kw'') }
This is just pseudo code. I didn’t test it. But maybe something like this?
Thank you for the effort.
I used the code, but got a syntax error.
I then set to the code in. " Accent grave " like the working code
Now I don’t get any error message
Unfortunately, only the display as before (without the addition of the script)
name: '[[[ return ` ${states[''sensor.warmepumpe_power_2''].state} Watt`;` ${ iif(states[''sensor.warmepumpe_power_2''].state < 1, ''watts'', ''kw'') }`]]]'