Hello everyone!
I’m using OH 2.5. I’ll bring up the topic because I still can’t find an answer to a similar question. I save the data to the rrd4 database according to the strategy once a minute. But some of the data is missing due to the periodic shutdown of the computer. When trying to read using .historicState(parse(My_String)).state as Number an error occurs .persistence.HistoricItem.getState() on null. How do I make a condition correctly so that the error does not occur and the rule continues to be executed?.
The syntax
if (Total_act.historicState(parse(Int_nowY.toString() + "-" + Int_nowM.toString() + "-04T12:00:00.0000")).state != null)
Like with about any programming, you must check for the returned object .historicState(parse(My_String)) to not be null before you try to access it i.e. .state