InfluxDB+Grafana persistence and graphing

I have been wanting to set it up since I first heard about grafana.
You’re post gave me the final push that I needed.
Now I am amazed by the graphs. It’s almost ridiculous how good looking they are!

I think we need to share some of these dashboards to give us all some inspiration?!

Grafana has some really cool sharing built-in…here is a snapshot of my main dashboard which should be accessible for 7 days…

https://snapshot.raintank.io/dashboard/snapshot/oJmrO8vSzg5Wtd73stG8tB0y9f2BWDp5

Did anyone manage to subtract two values in grafana?
I found this post but I am not sure how I would have to enter it.

I used stacking (had to invert the value in openHAB though)

1 Like

I think you can invert the values in Grafana itself on the Display tab as a custom series parameter like you would do to assign a series to the right y-axis. I experimented with it trying to come up with a graph with my RFM69 gateway transceiver’s temperature with the RSSI so I can see if temp is affecting my signal strength (it is). In the end leaving it not inverted worked better for me. I’ll post some screenshots when I get home, though they are really boring.

Edit: My graphs so far. NOTE: I probably will never use Grafana’s dashboard so this is how I’ll see them in my day to day use.

Inside temps verses outside temps and switch indicating when the central heating fan is on (I’m hoping to prove to myself that running the fan does equalize the temps across my three floors (NOTE: I’m still wiring and coding up the sensor for the basement).

Inside Humidity verses outside humidity. This will become more important in the winter as the winter humidity here stays between 15% and 20% and I like to keep at least the bedrooms at 35%. A whole house humidifier is in the plans at some point.

Light levels. More sensors are in the works. Not sure exactly what I’m going to do with this beyond using the graph to help determine when to turn on/off the lamps instead of the weather.

I’ve created an RFM69HW gateway on a Raspberry Pi and I created one so far “Uber Sensor” from the Uber Home Automation Indestructible. This graph is telling me the temperature reported from the transceiver on the Gateway verses the signal strength reported detected when the sensors communicate with gateway. I admit I don’t know much about wireless but an RSSI of -95 to -85 seems pretty poor to me and it fluctuates. I’m hoping I’ll be able to see some correlations on this chart (e.g. I’ve already seen signal strength goes down when the gateway temp goes up). This is probably my most actively used graph right now.

2 Likes

Hi Ben,

What type of sensors are you using for measuring the 3 temperatures on your hot water cylinder and where did you place them?

Thanks,
Mike

I have solar evacuated tubes providing hot water heating. The controller for this system has a series of temp probes which are housed inside 3 ports in my solar hot water ready HWC. I have just wired up an Arduino to measure the resistance of those 3 probes parasitically from the solar controller and report the temps to openHAB via MQTT.

The probes are a type of thermistor I believe.

Thanks for the reply. I don’t think our hot water cylinder has been ordered yet, so I will investigate the options.

It is basically just a series of holes punched in the side of the cylinder with a little plastic tube. It just bridges the gap from the cylinder shell into the internal cylinder. Then you can poke you temp probes down the tube so they rest against the inner cylinder and get an accurate reading.

They are pretty standard here in NZ for these types of the solar hot water installs I believe.

I think I did not express correctly what I want to display.
Having three values, I want to display the subtracted value with two graphs in one window.
e.g.
Value 1 - Value 2
Value 1 - Value 3

@Udo_Hartmann: There is a Math-Function in Grafana which allows to multiply with a factor (check the math - function in the query). Also stacking does not allow to display two graphs.

@rlkoshak: Can you elaborate how you did it with the second y-axis? Unfortunately I can not find it. :frowning:

@MikeD: I think the holes for measurement are pretty much standard, too.

Off-topic but did you create a custom shield for the Pi? I’m thinking about doing something similar so if you’ve got any info I’d appreciate it.

Hi.
How to install InfluxDB & Grafana on Synology NAS?
May be someone already do it?
Google tells nothing about it.

Thank you.

Let me answer that. I’ll make sure to mention it above (when I next find the time -.-). There are two options. The first is as easy as pressing the colored bar in the legend of the graph:

The second option is to create an override (which is actually quite useful for other options too):

@rlkoshak I like your graphs and the way you added buttons for Hour, Day and Week to your sitemap. I’ll explain how you did that in the first post (I’ll leave this here as a personal note :slight_smile:)

Your temperature graph could benefit from moving the fan series out of the way, I personally find it distracting. A few suggestions:

  1. make the fan series be drawn with the staircase to get a real on-off function (override)
  2. remove the fill color (override)
  3. move the series away from 0 to 100% of the graph by setting y-max for the right axis
  4. make the fan line visually different, increasing the width is a nice hack.

Another personal note: I should explain how to delete single faulty datapoints (e.g. “0” measurements after openHAB restart or when experimenting with rules)

First add all of your series to the graph.

Open the “Display” tab.

Go down to where it says “Series specific overrides” and press the “Add series specific option” button.

It will come up with a box that says “alias or regex”. Slick in the blank box to the right of that and choose the series you want to be on the right hand y-axis.

Then press the “+” button. A series of options will show up, one of which us Y-axis. Select “2” from that menu and the selected series will not be plotted to the right hand y-axis. You can change the units and other aspects of the right hand y-axis in the Axes tab.

I didn’t create a shield. I just wired the RFM69HW transceiver to the GPIO pins directly. I used the following library which tells you which GPIO pins get wired to which ports on the transceiver. It does require some soldering but it isn’t hard.

I used this same library to write a plug-in to my sensorReporter script but can’t publish it because of licensing restrictions (sensorReporter is Apache 2.0, the RFM69 library is GPL 3.0 and the two are not compatible). But the code itself is really simple and easily reproducible. Or even better, etrombly has a whole Gateway published that works with the same Uber Home Automation Instructable code. In a fit of “not invented here” I wanted to make this part of ym sensorReporter rather than adopt these existing gateways largely because I wanted to hide things like node and network IDs and other hardware specific stuff from OH itself.

The example.py tells you pretty much everything you need to do to send and receive messages though if you want to forge your own.

On a side note, given updates I’ve done to my sensorReporter and the way in which it loads and works with libraries it is unclear whether the licensing problems are still a problem but sadly, better safe than sorry. Its ironic that a license intended to promote the publishing of open source code is preventing me from publishing my code on this. :frowning:

Some lessons learned I have so far.

  • If you run in 915 MHz, while it will indeed work just fine with a 3" antenna, I did notice a drop in RSSI of about 10 when I dropped their lengths and the temperature of the gateway transceiver jumped about 40 degrees F. So if it isn’t a problem, I’d make the antenna on the gateway plugged into the Pi be 6". You can coil it around a pencil to make it more compact.

  • You cannot lengthen an antenna by splicing a wire to it to lengthen it. My signal dropped to zero when I tried that.

  • I use a hollowed out pair of pieces of 2"x4" to house my first sensor. The wood in the 2"x4" is apparently a good enough insulator to drop the signal to unusable levels. So keep how you plan on housing it in mind and try to be flexible in placement of things so you can run the antenna out of the case if you need to.

I’m in the middle of building my second sensor, this one in a cardboard tube. I also paid better attention to the quality of the connections so maybe this one will work better. Grafana will tell me though. :wink:

That is easier. :smiley:

Yes, I’ve not spent any time at all working with what I can do to make these graphs easier to read. I’m still not 100% convinced that I’m going to keep that fan on the graph anyway, but it was a way to clearly show and experiment with using two y-axis.

For the record and everyone else’s benefit, here is a new version with the following changes:

  • Removed the fill from everything, It didn’t seem to be adding anything.
  • Bumped the width of the line for the fan to 3
  • Added Staircase to the fan line
  • Bumped the y-max for the right hand axis to 2

I expect to add at least two more temperature lines to that graph over time so the fan line may get cut eventually anyway, once I have convinced myself that the fan running is indeed evening out the temp in the house.

I’ve a lot to experiment with and play with Grafana but so far my experience is that it is easy to install and configure and exceptionally flexible.

Is there a way to change Grafana and all its graphs to use 12 hour time? (EG am/pm) and not 24 hour? Googling shows nothing oddly.

Setting another instance up for my parents house and they hate trying to read 24 hour time

Did anyone yet figure out how to do calculation with different values?
E.g. substract two values from each other?