I do have a temperature sensor which shows correctly the temperature in OH3 (windows). Now I configured a new widget where I would like to change the icon color depending on the temperature. Unfortunately it does not work. I suppose the temperature is a number.
Here my widget code where I change the color (not working):
The second problem is the state is a String but you want to do a numeric comparison meaning you need to parse the String to a Number. Building Pages - Components & Widgets | openHAB shows Number is available in expressions.
Thanks for the answer and sorry for the late reply. I changed it accordingly but it is still not working as expected. I reduced the expression to the minimum to verify it. Now it looks like this:
Thanks for the hint!! This helped a lot and I could find a “)” issue which I solved. Now the developer sidebar shows the correct iconcolor but on the page where I am using this widget the color shows still “red”, independend of the current temperature.
I also refreshed the page several times already. Any idea what goes wrong here?
The best I can offer is that the expression tested in the developer sidebar is different from the one in the widget. The same code runs in both places. Either that, or the Item’s state > 30.