InfluxDB query addon

Tags: #<Tag:0x00007f51dbfbaa98>

(Joan Pujol) #1

I’ve an Iotawatt device that I use to measure power consumption of several devices.
The measured values are integrated in an InfluxDB (that is one of the export services that Iotawatt supports).

I want to integrate the current consumption of devices into items using the stored InfluxDB values.
I’ve checked the InfluxDB addon and I’ve seen it’s a pure persistence one and I can’t use for my use case.

I plan to make an InfluxDBQuery addon with the idea to be able to have Items that get its result executing an InfluxDB query every X time. That way I will be able to integrate the readings from Iotawatt and also make complex queries composing several data that I’ve in InfluxDB.

Is this a good way to go? I’ve I made it in a clean and reusable way could be it adopted as an official binding?

(Rich Koshak) #2

Before you go down that path, what other export services are supported? Perhaps one of those will be easier to go from the Iotawatt -> openHAB -> InfluxDB. From looking at the docs it looks like the Web Service can directly publish to openHAB in parallel with InfluxDB so you could

         /  InfluxDB
         \  openHAB

Before going to all the effort of building a binding, make sure one is actually needed.

If you just want to build a binding to learn how or you have other use cases that need to query from InfluxDB then I suppose there isn’t anything stopping it. But, since InfluxDB has a REST API too, you can do everything you need to do with the HTTP binding and/or Rules and the sendHttp*Request Actions.

That’s not to say a direct InfluxDB binding wouldn’t be accepted. You have to decide what is more important to you, that you solve the problem or that you solve the problem with a binding. Because both of the two recommendations above would be less work.

(Joan Pujol) #3

Thanks very much for you advice.
Actually Iotawa only supports influxdb, Emoncms and PvOutput.

I will explore a little about bindings and the http interface as I didn’t know influxdb had it. And then decide based on what can offer a custom binding comparing to the default http one and also time I estimate to build such custom binding.

Http binding url escaping rules