I’m new to OpenHAB and this is my first post. Please be gentle! I have zero experience of Java, so I expect this is a dreadfully noob question.
I’ve installed openhabian OH2.51 on a RPi3 and got it working with a few MQTT lighbulbs, and thought the next step would be to copy the weather part of the demo site. I have used DarkSky and it’s pulling down all of the detailed information correctly.
The one thing I can’t get my head around is the section of code that changes the colour of the text based on
Weather_LastUpdate, which is the time of the last update. It seems to me that the logic is based on the number of minutes since that update, so how is this meant to work?
The line I don’t understand is
Text item=Weather_Temperature valuecolor=[Weather_LastUpdate=="NULL"="lightgray",Weather_LastUpdate>90="lightgray",>25="orange",>15="green",>5="orange",<=5="blue"]
The value of the variable as shown by VSCode is e.g. ‘2020-01-27T18:06:25.071+0000’ and the colour is usually grey, but sometimes orange after a page refresh.
This is my an entry in a file I’ve called weather.rules (and the log shows it is being read)
// Creates an item that stores the last update time of this item rule "Records last weather update time" when Item Weather_Temperature received update then postUpdate(Weather_LastUpdate, new DateTimeType()) end
Could anyone please give me some pointers as to what I’m doing wrong? Many thanks in advance.