I could use some help on the following requirement. I have an API on my oven which returns a “true” / “false” value, depending on the state of the oven. I would like to reverse that value, so a “true” becomes a boolean “false”.
An additional question, if I may: Currently I am now getting “true” or “false” in lovelace. What would the correct and elegant way be to replace “true” with a mdi-lightbulb-on and a “false” with mdi-lightbulb for example? I looked into this, but am currently still missing too much background to understand how to implement.
That worked great, many thanks again for your help! Through your input, I learned about template sensors now . The only small change I made was mdi:lightbulb-on instead of mdi-lightbulb-on.
The problem I am battling with now is that the sensor values are not updating, also not the rest platform ones. Would this be the reason and right path to pursue?
The template sensor will update when the rest sensor does. You can use the solution to update the rest sensor at an interval of your choosing I believe.
This apparently only works if the value is boolean, which it is not in this case (value_json.Inactive returns a string). So I would first need to convert the value_json.Inactive from string to boolean. Can you give me any insight into how I can do this, so your solution would work in my case? This btw was the reason why my values were not updating, because the not always returned false…
Ugh, it looks like it’s bed time for me
The REST part is working now, but it looks like I still need to do some work on the template sensor. In any case, I learned a lot today, many thanks to you for that!