I’m using OH 4.3.1 on Ubuntu with a MariaDB sql databse.
In a rule, I read the json respons of an API call to Solcast to get solar power forecasts. In the rule I get the value and the timeslot is referes to. Next I want to store that value with the specific time. I’m using this Blockly part to do just that:
true, DateTimeKort is another datetime layout I tried.
DateTime is in format: yyyy-mm-ddThh:mm:ss:0.0000000Z
DateTime is in format yyyy-mm-ddThh:mm:ss:00
Both randomly don’t work perfectly. It seems that the first 10-20 values of the Repeat loop get stored with the actual time when the rule runs. But also sometimes it works perfectly. And another rule who basically uses the same concept, never fails.
It feels like a timing thing, perhaps also the json api call respons is big. I did increase the timer of the call and also added 1 5s wait, but all of the above isn’t the solution.
My other rule works with datetime format: yyyy-mm-dd hh:mm:ss
I think I’ll give that a try.
I think the datetime block will return now if the value passed to it is null and I think JSONPATH will return null if it doesn’t find anything at the path provided.
So you might need to add some error checking around the JSONPATH to make sure you are getting something back.
That is probably where the “when the rule ran” timestamps come from.