Get historic state with Mariadb

Hello there,
how i get the historic state with Mariadb?
in OH2 i did it like this:


but in OH3 no function
How I have to change this code?

Thank you very much.

There are lots of ways to do this. First of all, pretty much all of your date time questions can be answered at ZonedDateTime (Java SE 11 & JDK 11 ).

If you don’t want to mess with the timezone stuff the easiest is probably:


Unfortunately I don’t think ZonedDateTime will support something like


but you can try it.

With this: `


I got this

Script execution of rule with UID 'system-1' failed: Text '2019-06-30' could not be parsed at index 10 in system

With this


I got this:

2021-02-25 07:27:36.611 [WARN ] [nce.extensions.PersistenceExtensions] - There is no queryable persistence service registered with the id 'mariadb'

2021-02-25 07:27:36.613 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'system-1' failed: cannot invoke method public abstract org.openhab.core.types.State org.openhab.core.persistence.HistoricItem.getState() on null in system

That warn tells that mariadb is not known to the REST API. If you have installed I’d try to uninstall and install again.

I have done it. And I have made the config new: But no solution. The state of the items goes into the DB.
I don’t get the historic state.

Are you using jdbc service?


Well, the message is plain enough.
I guess your default persistence service is set to ‘mariadb’, perhaps an inheritance of upgrade from OH2?
You can correct that, or override it in your rule
...historicState( (time stuff), "jdbc") ...

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.