Hi!
I want to calculate my power usage since 7 days from my smartmeter item SmartMeter_101670 which is type number:power and stored in influxdb persistence. i can also view all values in a defined period coming from influxdb from a page. The influxdb-UI also shows me the correct values. When i try to calculate my usage with the “.sumSince” function i always get zero/ nothing from my persistence service.
I’d be surprised if you don’t get entries in your openhab.log to go with that.
Some part of the processing within OH persistence service has gone wrong. It’s the kind of thing you see if an Item type has been changed, and stored data no longer suits live Item.
You might try with a brand new Item to see if it is along those lines.
EDIT - in another thread, it looks like logInfo("test", "return {}", results)
is misbehaving somehow.
Try instead
logInfo("test", "return state ", results.state.toStrng)
logInfo("test", "return stamp ", results.getTimestamp.toStrng)
the problem is that openhab does not handle underscores correctly. so you are not allowed to use underscores in the bucket name with influxdb2.x. i have now recreated my bucket and now it works!
thanks again to @rossko57.
the command to debug was:
logInfo("test", "return state {}", results.state.toString())
logInfo("test", "return stamp {}", results.getTimestamp.toString())
Yes, at the moment the only workaround is not naming your default policy/bucket with underscores. Not that this fact is mentioned anywhere.
Funny thing is, persisting works, just the query to the database does not.