Hello @Foxejoe, thatâs not possible directly as these are specific queries generated by grafana to display your desired value.
However, you are free to query whatever you want to from InfluxDB yourself. Check out the InfluxDB documentaiton on how to retrieve such measures, then build a corresponding rule.
Thanks,
I see there is also example on OH1 wiki for persistance in Rules.
if I well understand the rules for avg temperature on the last 24h should be something like::
rule "Temperature Average"
when
Item Temperature received update
then
Temperature_Avg.postUpdate(Temperature.averageSince(now.minusHours(24)))
end
Correct?
Is there also a method to get the avg temperature from a defined period (i.I.e. from 1/1/2017 to 1/2/2017)?
Hi, I tried to use this tutorial to get the grafana+influxDB combo running on my raspberry pi together with openhab 2. I am struggling with grafana though.
I have set up influxDB and added a grafana and an openhab user. It is already connected to openhab and data is written to the openhab_db database. I also installed grafana and changed the settings .ini file according to this tutorial. Then I logged in with the grafana admin account to the server:3000 grafana website.
Now my problem is creating the influxdb datasource. I selected influxdb and added the url. I also checked the basic auth option and that is where the problems start: which user do I have to enter here? The influxDB grafana user? The grafana admin user? I tried both and get the same problem.
In the influxDB Details part I added the database and grafana user for the influxDB. Clicking save & test shortly displays a progressbar but then keeps spamming me with a âauthentification neededâ popup.
Why is that? I am already logged in.
Can anyone help solving this or had similar problems? Thank you!
Ok I fixed the problem⊠turns out I somehow made an error while creating the grafana user in the influxDB. I set the password a second time and now everything is working just fine. If someone has similar problems I recommend testing the users ability to request data via curl commands (there are explanations on how to do this in the influx manual).
Okay I got a strange Issue. My Influx does not store any data.
If I look at the Karaf logs (I set org.openhab.influxdb to TRACE) I only get the log from startup
13:48:58.430 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model âinflux.persistâ
Nothing more.
At this point I dont know what the problem could be.
I use
Item101 : strategy = everyChange, everyDay, restoreOnStartup
# The database URL, e.g. http://127.0.0.1:8086 or https://127.0.0.1:8084 .
# Defaults to: http://127.0.0.1:8086
url=http://127.0.0.1:8086
# The name of the database user, e.g. openhab.
# Defaults to: openhab
user=openhab
# The password of the database user.
password=YouSneekyLittle
# The name of the database, e.g. openhab.
# Defaults to: openhab
db=openhab_db
# The retention policy to be used, needs to configured in InfluxDB
# Till v0.13: 'default', since v1.0: 'autogen'
retentionPolicy=autogen
// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
everyMinute:"0 * * * * ?"
// if no strategy is specified for an item entry below, the default list will be used
default = everyChange
}
/*
* Each line in this section defines for which item(s) which strategy(ies) should be applied.
* You can list single items, use "*" for all items or "groupitem*" for all members of a group
* item (excl. the group item itself).
*/
Items {
// persist all items once a day and on every change and restore them from the db at startup
g_INFLUX* : strategy = everyChange, everyDay, restoreOnStartup
Item101 : strategy = everyChange, everyDay, restoreOnStartup
}
take out all comments (stuff starting with // and/or /* + */) from /etc/openhab2/persistence/influxdb.persist
By the way use: influxdb.persist (not influx.persist)
edit the file with a linux editor (like vim) and make sure that there is no crap lying around in the contents of the file (strange characters or line feeds, etc)
Of course. I checked it with show measurements and show series
Connected to http://localhost:8086 version 1.3.3
InfluxDB shell version: 1.3.4
> use openhab_db
Using database openhab_db
> show series
key
---
sine_wave
> show measurements
name: measurements
name
----
sine_wave
did this installation work before and it broke recently or itâs a clean start?
I donât see anything wrong with your setupâŠ
that should be extremely light load for influxdb⊠I donât expect problems from that.
On the other hand⊠I wouldnât run influx on a Pi because of small RAM.