Page 1 of 1

Domoticz HTTPLINK --> INFLUXDB --> GRAFANA

Posted: Thursday 19 May 2016 11:33
by Ferno2000
Hi Everybody,


I have scanned for a posting matching what I need but could not find one.
The open therm gateway came the closest but what I need is a bit different.

For now I use 3 domotica systems, Homewizard (which I started with) Domoticz and Vera Edge.

It is now clear to me that Domoticz is hands down the best system and now I want to commit to it.

I have been implementing the functionality I have in the other systems and an close to being able to decommission them.

One thing I find quite important is being able to monitor my energy consumption in domoticz.
Now I use Energy link in Homewizard.

I bought a P1 USB smart meter cable which does the trick well and am planning to buy a s0 SUB cable to measure my solar panels.

Because the graphing in Domoticz is somewhat limited I have implemented Influxdb and Grafana which are working fine and I can see graphs.

The problem now is that I can't find good examples on how to setup the graphs correctly in grafana.

The values of the live counters work well but th export and import of the the P1 meter not, I get values but they keep going up and I want to be able to see what I consume per day, week etc.

I have been thinkering with it but can't seem seem to get it right.
Also my GAS meter does not show up in influxdb.

I use the following settings in the connection in httplink device_%V value=%v %t3

Will this work for all the counters?

I want to implement moer counters in the future like temperature, water etc.

Hope someone can point me in the right direction with some examples. Grain has very good tutorials but none of them are Domoticz oriented.

Re: Domoticz HTTPLINK --> INFLUXDB --> GRAFANA

Posted: Saturday 16 July 2016 20:00
by thorian
Just started with the integration of domoticz/grafana/influxdb

What's your status?

Re: Domoticz HTTPLINK --> INFLUXDB --> GRAFANA

Posted: Saturday 16 July 2016 21:44
by damylen
Well, i configured mqtt, then wrote a small nodejs app that listens to mqtt events and stores those to influxdb.

Re: Domoticz HTTPLINK --> INFLUXDB --> GRAFANA

Posted: Tuesday 26 July 2016 11:57
by dervogt
Hi If you look into the data collected in InfluxDB, you will see that the idx of the smartmeter has multiple value fields:

nvalue
svalue1-5

this is an example GRAFANA query to retrieve the current usage in watts, you probably need to replace the idx value to make it point to your own idx:

Code: Select all

SELECT mean("svalue5") FROM "domoticz" WHERE "idx" = '9' AND $timeFilter GROUP BY time(5m) fill(null)
as an addition, this is my node-red setup with which I retrieve the data from domoticz without using HTTPlink:

Code: Select all

[{"id":"fef6ee73.4610d","type":"influxdb","z":"","hostname":"YOURSERVERIP","port":"YOURSERVERPORT","database":"YOURDATABASE","name":"YOURMEASUREMENTNAME"},{"id":"6480007b.a4985","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"90523bf3.a78028","type":"mqtt in","z":"84bc5807.5ca508","name":"Domotic Out","topic":"domoticz/out","broker":"6480007b.a4985","x":176.3333282470703,"y":168,"wires":[["4a481762.a12a08"]]},{"id":"4a481762.a12a08","type":"json","z":"84bc5807.5ca508","name":"","x":336.3333282470703,"y":169,"wires":[["785d808d.8fc2a"]]},{"id":"fdb31e84.fbc4c","type":"influxdb out","z":"84bc5807.5ca508","influxdb":"fef6ee73.4610d","name":"domoticz","measurement":"domoticz","x":708.3333282470703,"y":169,"wires":[]},{"id":"785d808d.8fc2a","type":"function","z":"84bc5807.5ca508","name":"ToInfluxDB","func":"var influx_obj = new Object();\n\ninflux_obj.idx=msg.payload.idx.toString();\ninflux_obj.id=msg.payload.id;\ninflux_obj.name=msg.payload.name;\ninflux_obj.dtype=msg.payload.dtype;\ninflux_obj.Battery=msg.payload.Battery;\ninflux_obj.RSSI=msg.payload.RSSI;\ninflux_obj.nvalue=msg.payload.nvalue;\ninflux_obj.stype=msg.payload.stype;\ninflux_obj.unit=msg.payload.unit;\n\n//get only existing value X and convert it to Float\nfor (ii=0; ii<10; ii++){\n    var vidx = (ii+1).toString();\n    var vname = \"svalue\" + vidx;\n    if (typeof msg.payload[vname] != 'undefined') {\n        var vdata=msg.payload[vname];\n        if (!isNaN(vdata)) {\n            influx_obj[vname]=parseFloat(vdata);\n        }\n    }\n}\n\nmsg.payload=influx_obj;\nreturn msg;","outputs":1,"noerr":0,"x":514.3333282470703,"y":170,"wires":[["fdb31e84.fbc4c"]]}]
This noder-red makes usage of a custom domoticz output node and a specific influxdb input node which need to be installed in node-RED, they can be found in the node-RED online library.