Problem with Persistence historicState and maximumSince


(Oliver K.) #1

Hi,

I have two items where the persistence doesn’t work (historicState and maximumSince)

The items are:

Number:Length RainD “Gesamtniederschlag [%.1f %unit%/d]” (gWetter) {channel=“weatherunderground:weather:local:current#precipitationDay”}
Number:Length RainH “Aktueller Niederschlag [%.1f %unit%/h]” (gWetter) {channel=“weatherunderground:weather:local:current#precipitationHour”}

Database is influxdb.
When i check the DB…all values are there. I can use Grafana to display a the values but when i try to use this values in a rule

rainYesterday = RainD.historicState(now.minusHours(24), "influxdb")

i get this:
[pse.smarthome.model.script.dev.rules] - DevLog: org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@b40126 org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@1bda89

with this rule

rainYesterday = RainD.maximumSince(now.minusHours(24), "influxdb")

i receive this
[pse.smarthome.model.script.dev.rules] - DevLog: org.eclipse.smarthome.model.persistence.extensions.PersistenceExtensions$1@b8a37b org.eclipse.smarthome.model.persistence.extensions.PersistenceExtensions$1@1df7207

With other Items i´ve now Problems with the historicState and maximumSince

THX
Oliver


(Harry) #2

The item type is Number:Length. What value does the persictence store?


(Oliver K.) #3

Hi,

at the moment 3,4 and 5


(Harry) #4

Try

rainYesterday = RainD.historicState(now.minusHours(24), "influxdb").state

(Oliver K.) #5

same …
2018-06-15 13:30:31.769 [INFO ] [pse.smarthome.model.script.dev.rules] - Devlog: org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@1db7edd org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@1d57e5c

UPDATE:
don´t now why but with
rainYesterday = RainD.historicState(now.minusHours(24), "influxdb").state.toString
it works

maybe someone can explaint it to me. I put a Number (not Number:Length ) Item into the influxdb.
to get it out i´ve to convert it to string?:confused: