Hello,
I tried to recieve the last historic state of an item frommy database.
here is my code
var local_time_yesterday = LocalDate.now().atStartOfDay().minusMinutes(1)
logInfo("loggerName", local_time_yesterday.toString())
logInfo("loggerName", Z_way_number_WallPlug2_totalpower.historicState(local_time_yesterday).state.toString())
last database entry.
021-02-01 23:59:52 60.27
error is
2021-02-03 05:23:33.002 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'energy-1' failed: An error occurred during the script execution: Could not invoke method: org.openhab.core.persistence.extensions.PersistenceExtensions.historicState(org.openhab.core.items.Item,java.time.ZonedDateTime) on instance: null in energy
How do i do this within OH3?