Hubitat + InfluxDB + Grafana Howto [Ubuntu Linux]

The IoTaWatt has built-in support for exporting data to InfluxDB. It even caches data if your InfluxDB server is unavailable for any reason, and then catches back up later. It works really well.

I run both InfluxDB and Grafana on my Windows 10 ‘home server’. I have a scheduled task that starts then both up upon system startup. It has been running for a few years now, without any issues. It has been so long, that is really don’t recall the steps to set it up…:thinking:

1 Like

I'm still not sure how to set it up. I downloaded and installed 1.8 but not sure about configs. You should do a how to :grin:

3 Likes

I use MakerAPI to integrate to Node-Red using the Hubitat node set.

Mine started on Windows. The tricky part can be getting the apps setup as service so they run at boot, but its not that difficult using some third party software. I got annoyed with the update process on windows, stop the service, download installer, run installer (or extract), click click click.... start the service again. Linux its just 'apt upgrade' boom updated and running new version.

Anyway... its pretty easy. Could prob walk you through it in a post and make it into a guide basically. Do you want to use the older Influx 1.8 or the current version 2.x? If you want to use the InfluxDB logger (to cut out the need for Node-Red) it requires a few extra command line steps to get it to work on 2.x but its really not that bad, I have it documented in another post somewhere. I recommend 2.x, I always figure if I am going to set something up new I start with the latest version when possible.

2 Likes

I tested it for a short while and it seemed like it was logging things slightly different than my node-red setup as far as measurements / fields. I think I need to resist this though. Also yes I agree I am not a fan of the polling, it would create "false" events in my mind, I only want stuff logged when there is an event, not randomly. I could maybe see polling once a day for any devices that sends events very seldom.

I was also wondering how it does the batching, would have to look at the code. I don't think Influx 1.x/8 has a true bulk/batch update so it might just be sending a bunch of separate requests when it batches, which seems like it would be worse than just sending them as they happen. Influx 2.x added true bulk updates (called batch save). I am using the batch save mode in my node even though I am only sending one event at a time, because it was easier for me to understand the payload format of the batch save.

The app probably need an overhaul. I wish I had more time to just sit here and code apps and drivers all day, so many custom things people have made and abandoned that could use a refresh!

1 Like

If you are more comfortable with other databases you can use them too; minimally need 2 columns - a timestamp, and a value

If 2x is the better option, that would probably be the way for me (as much network experience that I have, I'm fairly database stupid lol) . It's gonna be running on a windows server VM..

1 Like

Thats part of my problem I tried to convert my laptop to linux and it ended being a complete fluster cluck. Ended up having to reformat and reinstalling windows. I just have not had the motivation to delve into it again. I've just been looking into the possibility of buying a new linux machine and starting clean. In the mean time, I need to figure out how to do these things with windows.

That would be great! If you would like a guinea pig to work through the steps with , im game.

2 Likes

Well, you guys did at least motivate me to update my InfluxDB instance to 1.8.10. :wink: Seems to be running fine. Now to take a look at Grafana to see if it needs an upgrade as well!

I look forward to seeing what you guys come up with for a InfluxDB 2.x Windows install!

Update: And now I have updated Grafana to v9.1.2 OSS. That was pretty easy as well.

Really? Try Ubuntu, most novices can install it. Boot it from a thumb drive then pick install to pc option.

I think that the polling is a problem with this setup, specially for energy monitoring.

Last evening i noticed that even though my air conditioner was off for a few minutes, grafana was showing consumption. So this is not as accurate as it should be. You have pooling from Shelly to Hubitat, then pooling from InfluxDB Logger to Grafana, so you have a minimum delay of 2 minutes.

I will try Node-Red because it has some benefits, and from Hubitat perspective, MakerAPI is as easy to use as InfluxDB Logger. I did not understant how it creates the values in the database and if you have to set that up manually, or just choose what you need from Grafana.

At that point why not just do a Linux VM? I have a DietPi (lite debian) VM running Homebridge, NR, Influx, Grafana, etc... Unless you just have no Linux / command line experience then it might be daunting. I learned linux while in college, it was the cool thing to do at the time. Then I started admining a dedicated redhat linux server that hosted web sites and game servers.

Another question: is Raspberry Pi 3B+ 1GB of RAM + SSD enough for this setup, or for Node-Red alternative?

I really doubt polling caused a problem with that. The reason polling is there is for records to get into Influxdb at set intervals for devices that don't generate traffic. It isn't going to make your device report late. You record is queued when it is received in HE and then loaded on the next batch load. It is more likely a problem with your polling of the shelly delaying it device.

What do you have setup for "Soft-Polling Interval" and "How Often to write to DB" in InfluxDB Logger. Personally I would suggest setting the "Soft-Polling interval to something fairly large, and then set the "How Often to write to DB" value to 1 min to keep the queue low

1 Like

That would probably work, not sure how well, but I do think it will work. It probably wouldn't be a bad place to start, but you may see performance issue as the database grows.

I created a Pi Image that already has Influxdb, Grafana in it. You may want to try that just to get something built and working.

1 Like

@lcw731 and @rlithgow1
So as not to totally derail this thread I made a new one: [Guide] InfluxDB / Grafana on Windows

5 Likes

I had done that with both Ubuntu and Mint (i preferred Mint). My nephew was trying to convert my laptop and that where it went wonky. It wasn't even anything he did, just an unrelated situation that occured while he was doing it and i needed to finish up . I couldn't get it to work. So I just went back to windows. Eventually i'll experiment with Linux again, just dont have the patience or attention span to do it now.

1 Like

You are right.

I have tested with a virtual temperature sensor. I have set values from 1-10, then incremented by 5 up to 50.

The values all showed up in Grafana but with delays. Values from 0 to 30 where shown first then the rest. I think the events are sent to InfluxDB at the polling rate which in this case is 1 minute. Am I right?

Lets be clear there are two settings.

One is soft polling. That is how often InfluxDB will ask HE what the value is for given attributes for devices it tracks and write to InfluxDB. This can be important under certain circumstances to make sure you have something in the db at given intervals. This has nothing to do though with getting event driven changes into InfluxDB from HE.

The second value is how often to write to the DB. This value basically just tells influxdb logger how long to wait before posting events to the database unless the queue gets full. This doesn't effect the time of the event as that is part of the data that is queued. If a device changed 3 times in one minute all 3 events would be posted when that 1 min was up. It may take 1 min for new data to appear, but the values will reflect what happened in that interval and when in that interval.

Technically you could set the polling interval to 0 and just turn polling off completely. Depending on what and how you graph that may be fine.

The default code allows the queue to get to 100 before it forces a write to the Influxdb server. You can easily change that to a different number, or just 1 if you like. That number is there though to help reduce overall load. I have tweaked that number a few times to see if i could improve load. What i found worked best was setting the write to db value to 1 minute.

1 Like

To anyone needing help making this work on InfluxDB 2.X+, I edited the original app to include an API token section. Leave the username/password blank, but add an API token from your InfluxDB (create a token, then it should begin working.

Here is the updated Github link:
https://raw.githubusercontent.com/jaondayko/InfluxDB-Logger/master/influxdb-logger.groovy

1 Like

This is what i have achieved so far. Setup is working pretty good.

1 Like