[SOLVED] Average number value, calculated addition values via Influx Query Language

I have problem with calculated rule:


Two items, first origin second calculated:
Number Pow2_Voltage     "Spanung [%.0f V]" <energy>   (Pow2) { http="<[http://
Number Pow2_VoltageAvg  "AvgSpanung [%.0f V]" <energy>


rule "Voltageaverage"
    Item Pow2_Voltage changed
    var Number Pow2_V = Pow2_Voltage.averageSince(now.minusMinutes(5))
    Pow2_VoltageAvg.postUpdate(Pow2_V.state)   // not working line


Text item=Pow2_VoltageAvg label="POW2_VoltageAvg" icon="lock"

Is it possible to read out some calculated value using InfluxQL from database to openhab ?
InfluxQL functions

Thanks for help.

That’s not an Item. I think it’s just a Number (which doesn’t have a .state)
What does openhab.log tell you about the error?

Persistence is stored only in influxdb.persist
persistence-influxdb - 1.14.0
JDBC Mariadb Mysql installed not used

persistence-rrd4j - 1.14.0 not installed

Pow2_Voltage : strategy = everyMinute, everyUpdate
Pow2_VoltageAvg : strategy = everyChange, everyUpdate

tail -f openhab.log | grep “Pow2_V”
2020-01-19 19:31:21.241 [WARN ] [jdbc.internal.JdbcPersistenceService] - JDBC::query: database not connected, query aborted for item ‘Pow2_Voltage’

Copy first to secend variable is OK

This will query your default database service.
Either check that influxdb is set to be your default service, or set the query to your chosen database

Pow2_Voltage.averageSince(now.minusMinutes(5), “influxdb”)

These are not variables. These are Items. You must keep a clear distinction in your head, they are not the same thing and do not behave the same way.

Thanks Ross, all works now.
I don’t had influxdb in paperui as default.

1 Like