There is some information on how to set up influxdb, but some of it is confusing, especially if you don’t already know the details of how Influxdb works and what you want to do with the data (perhaps Grafana?). Like with many things, it is best to first think about what you want to achieve. I didn’t really start here, but now that I have done some stuff I decided to think about it a little first.
- Curious about what is going on with my usage
- Curious about what is going on with voltage, since my house is far from the transformer and very far from the substation
- Interested in if the heating elements on either water heater come on or not
- Interested in the maximum consumption to see if it ever exceeds what the generator could provide (and if I need to implement demand-side-load management to prevent the possibility)
- Monthly (or 30day might be close enough) usage
- How much is the heated floor in the bathroom cost to run (do I need to create a more sophisticated control system for it, simple timer now)
- How much do the water heaters cost to operate
- How much does me working from home cost
- How much does the recirculation pump that provides instant hot water really cost (does it make sense to have a more sophisticated control system)
- How much does the dehumidifier in the basement cost
- Is the dehumidifier working correctly and has its efficiency dropped
Wow, that is a lot of stuff. IotaWatt with some additional help from Influxdb and Grafana can do almost all that and probably more.
I first started trying to understand what others had done with Influxdb. I found this: https://brettbeeson.com.au/influx-and-iotawatt-multi-tenant-setup/
It got me pretty close, but it was missing some key pieces of information, and things have changed somewhat since it was written.
- Use Influxdb 1.8 (do not use the 2.0 version as it is not compatible with IotaWatt at this time, so far that is not an issue
- There are lots of tutorials and information about Influxdb on the internet, It is good to understand what it can do and the choices.
You need to have, at least, a basic understanding of databases, measurements, tags and fields. For a normal home setup up you only need one database. You can call it whatever you want. I have used iotawatt and also Power and power. I believe it is case sensitive, so pick wisely (you can change it later if you really don’t like your first choice).
Iotawatt gives you the ability to choose how you use tags and fields. Brett Beeson has a tag set that uses $device, $name, and $units. I couldn’t get $units to work, but I might have done it wrong. The tags are what allow you to do groups of things. I used channel instead of sensor, but that is personal preference.
The part that was not clear (at first, to me) was that I needed to add each thing that I wanted to send to Influxdb in the measurements section. Doing this is a bit tedious. It allows you to use a different name than actual channel name in Iotawatt, which makes sense, since you can do math there. I didn’t do/need any math there.
I did not do any of the continuous queries to generate KWH. I do that in Grafana. The (currently) very latest version has beta support for flux queries. Flux allows math across measurements (and series, which are specific measurements). I need this to get the total from legs A and B. For graphs, using stacking will get something similar without needing to actually add all the numbers. But, I wanted some boxes for 24hr usage for the whole house.
There was someone how shared their JSON from Grafana. I used that as the starting point, but mine is not really in a state to share yet. Once it is ready, I will share it.
I will add more to this later, including how to use Flux and how to debug it.