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

[rrd4j] historicState() utility fails in very recent time #9948

Open
Rossko57 opened this issue Jan 24, 2021 · 3 comments
Open

[rrd4j] historicState() utility fails in very recent time #9948

Rossko57 opened this issue Jan 24, 2021 · 3 comments
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@Rossko57
Copy link
Contributor

Rossko57 commented Jan 24, 2021

RRD4J is typically set up with everyMinute persist strategies.

Requesting a historicState() with a target time more recent than actual "most recent" record results in a null return.
Expected behaviour - return most recent record.

Demo (Item is just a Number type persisted everyMinute) -

var xx = nm_Out_temp.historicState(now.minusSeconds(65), "rrd4j")
logInfo("TTEST", "Test Result 65: " + xx.state.toString + " " + xx.getTimestamp.toString)
xx = nm_Out_temp.historicState(now.minusSeconds(40), "rrd4j")
logInfo("TTEST", "Test Result 40: " + xx.state.toString + " " + xx.getTimestamp.toString)
xx = nm_Out_temp.historicState(now.minusSeconds(1), "rrd4j")
logInfo("TTEST", "Test Result 1: " + xx.state.toString + " " + xx.getTimestamp.toString)

sample results, which will vary depending on run time.

2021-01-24 19:12:29.263 [INFO ] [eclipse.smarthome.model.script.TTEST] - Test Result 65: 0.4 Sun Jan 24 19:11:00 GMT 2021
2021-01-24 19:12:29.272 [INFO ] [eclipse.smarthome.model.script.TTEST] - Test Result 40: 0.4 Sun Jan 24 19:11:00 GMT 2021
2021-01-24 19:12:29.277 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'test operation': cannot invoke method public abstract org.eclipse.smarthome.core.types.State org.eclipse.smarthome.core.persistence.HistoricItem.getState() on null

There might be a clue in this surprising random result, where the -40 seconds request appears to have seeked forward in time. Rounding going on?

2021-01-24 19:13:04.528 [INFO ] [eclipse.smarthome.model.script.TTEST] - Test Result 65: 0.4 Sun Jan 24 19:11:00 GMT 2021
2021-01-24 19:13:04.532 [INFO ] [eclipse.smarthome.model.script.TTEST] - Test Result 40: 0.4 Sun Jan 24 19:13:00 GMT 2021
2021-01-24 19:13:04.535 [INFO ] [eclipse.smarthome.model.script.TTEST] - Test Result 1: 0.4 Sun Jan 24 19:13:00 GMT 2021

May be related to NaN issue
openhab/openhab1-addons#5965

@Rossko57 Rossko57 added the bug An unexpected problem or unintended behavior of an add-on label Jan 24, 2021
@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/historicstate-with-rrd4j-in-oh3-returns-null/115263/8

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/persistence-maximumsince-different-type-returned-depending-on-timespan/133716/5

@lsiepel
Copy link
Contributor

lsiepel commented Jul 23, 2024

From the pull requests created after this issue was raised i don't see one that looks like a clear fix, but it would be nice if this can be confirmed. Also this post from Rich seems ot have usefull information.

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 an add-on
Projects
None yet
Development

No branches or pull requests

3 participants