[persistence] forecast strategy not working for states added by REST API
spacemanspiff2007 opened this issue · 2 comments
spacemanspiff2007 commented
Openhab 4.1.1
inmemory does not respect forecast strategy
inmemory.persist
Strategies {
}
Items {
// persist items on every change and every minute
gInMemoryForecast* : strategy = everyChange, forecast
}
items.items
Group gInMemoryForecast
Number InMemoryForecastItem (gInMemoryForecast)
Create future values in inmemory
/rest/persistence/items/InMemoryForecastItem?time=2024-02-12T08:10:11.000000%2B0100&state=1&serviceId=inmemory
/rest/persistence/items/InMemoryForecastItem?time=2024-02-12T08:10:12.000000%2B0100&state=2&serviceId=inmemory
/rest/persistence/items/InMemoryForecastItem?time=2024-02-12T08:10:13.000000%2B0100&state=3&serviceId=inmemory
/rest/persistence/items/InMemoryForecastItem?time=2024-02-12T08:10:14.000000%2B0100&state=4&serviceId=inmemory
/rest/persistence/items/InMemoryForecastItem?time=2024-02-12T08:10:15.000000%2B0100&state=5&serviceId=inmemory
/rest/persistence/items/InMemoryForecastItem?time=2024-02-12T08:10:16.000000%2B0100&state=6&serviceId=inmemory
/rest/persistence/items/InMemoryForecastItem?time=2024-02-12T08:10:17.000000%2B0100&state=7&serviceId=inmemory
/rest/persistence/items/InMemoryForecastItem?time=2024-02-12T08:10:18.000000%2B0100&state=8&serviceId=inmemory
/rest/persistence/items/InMemoryForecastItem?time=2024-02-12T08:10:19.000000%2B0100&state=9&serviceId=inmemory
Query values to see they are properly created
/rest/persistence/items/InMemoryForecastItem?serviceId=inmemory&starttime=2024-02-12T08:10:05.000000%2B0100&endtime=2024-02-12T08:10:19.005000%2B0100
Values are there:
{1707721810.195: 0, 1707721811.0: 1, 1707721812.0: 2, 1707721813.0: 3, 1707721814.0: 4, 1707721815.0: 5, 1707721816.0: 6, 1707721817.0: 7, 1707721818.0: 8, 1707721819.0: 9}
Observe event log - only the initial change will be shown that was also persisted by the everyChange
policy: 1707721810.195: 0
2024-02-12 08:10:10.195 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'InMemoryForecastItem' changed from 1 to 0
I would have expected that InMemoryForecastItem
will change from 1..9 because there are future timestamps available in the persistence service (as described here).
J-N-K commented
Can you please enable TRACE logging for org.openhab.core.persistence.internal.PersistenceManager
and see if the output of
logger.trace("Scheduled forecasted value for {} at {}", itemName, time);
appears in the log?
spacemanspiff2007 commented
I've activated the logger and see the DEBUG
and TRACE
output but the line above never appears.