Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[persistence] forecast strategy not working for states added by REST API #4087

Closed
spacemanspiff2007 opened this issue Feb 12, 2024 · 2 comments · Fixed by #4089
Closed

[persistence] forecast strategy not working for states added by REST API #4087

spacemanspiff2007 opened this issue Feb 12, 2024 · 2 comments · Fixed by #4089
Assignees
Labels
bug An unexpected problem or unintended behavior of the Core persistence

Comments

@spacemanspiff2007
Copy link
Contributor

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).

@spacemanspiff2007 spacemanspiff2007 added the bug An unexpected problem or unintended behavior of the Core label Feb 12, 2024
@J-N-K
Copy link
Member

J-N-K commented Feb 12, 2024

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
Copy link
Contributor Author

I've activated the logger and see the DEBUG and TRACE output but the line above never appears.

@J-N-K J-N-K self-assigned this Feb 13, 2024
@J-N-K J-N-K changed the title forecast does not work with inmemory persistence [persistence] forecast strategy not working for states added by REST API Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core persistence
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants