Grafana with InfluxDB for Domoticz

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.
thorian
Posts: 19
Joined: Tuesday 29 September 2015 19:50
Target OS: Raspberry Pi
Domoticz version: 2.2563
Location: Poland
Contact:

Grafana with InfluxDB for Domoticz

Postby thorian » Tuesday 27 December 2016 21:17

Easy to start and implement description of running all on single device: https://blog.jokielowie.com/en/2016/11/ ... e-wykresy/

User avatar
remb0
Posts: 769
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby remb0 » Sunday 01 January 2017 18:43

Great work! works nice..
maybe somethin to place also in our wiki?

thorian
Posts: 19
Joined: Tuesday 29 September 2015 19:50
Target OS: Raspberry Pi
Domoticz version: 2.2563
Location: Poland
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby thorian » Saturday 07 January 2017 18:07

Let me know where - I'll re-write it for Wiki style.

arraWX
Posts: 4
Joined: Wednesday 15 June 2016 15:27
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby arraWX » Wednesday 11 January 2017 15:36

The wiki entry https://www.domoticz.com/wiki/HttpLink explains how to integrate Domoticz with InfluxDB and Grafana. However, the information given there seems somewhat outdated.

thorian, your blog entry was very helpful to me when I recently suceeded to integrate domoticz with influxdb on my rpi 3. Thanks for sharing!

In order to install influxdb on rpi 3 I followed the instructions for Debian users given here https://docs.influxdata.com/influxdb/v1 ... tallation/ This procedure seems even more simple compared to the procedure outlined in thorian's blog entry.

thorian
Posts: 19
Joined: Tuesday 29 September 2015 19:50
Target OS: Raspberry Pi
Domoticz version: 2.2563
Location: Poland
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby thorian » Wednesday 11 January 2017 16:09

Grafana is developing fast, so the entry is getting outdated. Thanks for the easier way @arraWX.

thorian
Posts: 19
Joined: Tuesday 29 September 2015 19:50
Target OS: Raspberry Pi
Domoticz version: 2.2563
Location: Poland
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby thorian » Monday 16 January 2017 0:25

remb0 wrote:Great work! works nice..
maybe somethin to place also in our wiki?


Checked into wiki, I think the best way would be to provide additional new entry with updated information and alternative data entry for grafana.

Trigun
Posts: 117
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby Trigun » Wednesday 29 March 2017 22:16

Hey Guys,
I just ran into this topic and seems promising. I was looking for something like this to create a dashboard for having a Live look at my power usage, tempeature etc.
i managed to install influx en grafana but as mentioned above the Wiki is a bit outdated. I am having trouble with setting up domoticz and being able to actually send data to influx. is there a chance someone can help me out?

thanks in advance!

User avatar
sincze
Posts: 632
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6833
Location: Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby sincze » Thursday 30 March 2017 22:36

I'm very happy with the possibilities of Influx and Grafana.

General overview
Grafana.JPG
Grafana.JPG (82.02 KiB) Viewed 793 times


Monitor the CV
Grafana-OTGW.JPG
Grafana-OTGW.JPG (97.96 KiB) Viewed 792 times


Monitoring Ziggo
Grafana-Ziggo.JPG
Grafana-Ziggo.JPG (43.85 KiB) Viewed 792 times
Running Domoticz since 2013 with Cubietruck
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266
Sensors: You name it I probably got 1.

Jeff
Posts: 33
Joined: Tuesday 16 December 2014 0:39
Target OS: Windows
Domoticz version: 2.3674
Location: Weert, Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby Jeff » Sunday 02 April 2017 12:56

sincze wrote:I'm very happy with the possibilities of Influx and Grafana.

General overview
Grafana.JPG


Monitor the CV
Grafana-OTGW.JPG


Monitoring Ziggo
Grafana-Ziggo.JPG

Just out of curiosity, How did you manage to implement the Ziggo speedtest into grafana ?

User avatar
sincze
Posts: 632
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6833
Location: Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby sincze » Sunday 02 April 2017 19:00

Jeff wrote:
sincze wrote:I'm very happy with the possibilities of Influx and Grafana.

General overview
Grafana.JPG

Monitor the CV
Grafana-OTGW.JPG

Monitoring Ziggo
Grafana-Ziggo.JPG

Just out of curiosity, How did you manage to implement the Ziggo speedtest into grafana ?


I found the instructions somewhere here in the forum and thought it was a nice feature.
https://www.domoticz.com/wiki/Bash_-_Speedtest.net_Download/Upload/Ping_monitoring

And I just read the file that is creates.
After retrieving the data from the file it is just as any other value. Dump it into InfluxDB ;-) and access via Grafana.
Running Domoticz since 2013 with Cubietruck
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266
Sensors: You name it I probably got 1.

Trigun
Posts: 117
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby Trigun » Wednesday 05 April 2017 21:13

Hi Jeff and sincze,

is there a chance you are able to help me out showing my P1 meter data in Grafana?
I already have everything up and running, within domoticz it works perfectly but I can't seem to get it to work in Grafana.
I am using Grafana in combination with Influx.

Thanks!

oh yeah, I also saw the wiki being outdated perhaps this might help.

Code: Select all

sudo apt-get update
sudo apt-get upgrade

Install INFLUXDB
   wget https://repos.influxdata.com/debian/pool/stable/i/influxdb/influxdb_1.2.1-1_armhf.deb
   sudo dpkg -i influxdb_1.2.1-1_armhf.deb
      
-- start the service
   sudo service influxd start

-- run the CLI
   influx

install GRAFANA   (only for raspberry pi 2 and pi 3)

sudo apt-get install adduser libfontconfig
curl -L https://github.com/fg2it/grafana-on-raspberry/releases/download/v4.0.1/grafana_4.0.1-1480722482_armhf.deb -o /tmp/grafana_4.0.1-1480722482_armhf.deb
sudo dpkg -i /tmp/grafana_4.0.1-1480722482_armhf.deb
sudo apt-get update
sudo apt-get install grafana

to start Grafana:
   sudo /bin/systemctl start grafana-server


create database and setup domoticz

grubstake
Posts: 10
Joined: Tuesday 14 February 2017 22:49
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby grubstake » Saturday 08 April 2017 23:18

The InfluxDB data push on Domoticz is broken, dates do not load correctly in InfluxDB, putting them out of range and resulting in empty charts in Grafana even though it has a connection with the database.

Don't waste your time trying to get this to work until the data push is fixed.

Trigun
Posts: 117
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby Trigun » Saturday 08 April 2017 23:29

grubstake wrote:The InfluxDB data push on Domoticz is broken, dates do not load correctly in InfluxDB, putting them out of range and resulting in empty charts in Grafana even though it has a connection with the database.

Don't waste your time trying to get this to work until the data push is fixed.

Hi, I checken the outcome in domoticz and grafana with influx seem to work fine. I believe it's a matter of configuration. How do you know it's broken?


Sent from my iPhone using Tapatalk

User avatar
sincze
Posts: 632
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6833
Location: Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby sincze » Saturday 08 April 2017 23:30

It should still be possible with httplink right?
Running Domoticz since 2013 with Cubietruck
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266
Sensors: You name it I probably got 1.

Trigun
Posts: 117
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby Trigun » Saturday 08 April 2017 23:39

In the latest domoticz version the influx data push option is not there anymore. I am running on 3.5877. I used the option with httplink and it works indeed


Sent from my iPhone using Tapatalk

User avatar
sincze
Posts: 632
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6833
Location: Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby sincze » Saturday 08 April 2017 23:44

in the beta 3.7266 inflixdb is available.
However currently I am not using it.
Last time I used it it was still working. So currrently can not confirm nor deny the functionality.
Running Domoticz since 2013 with Cubietruck
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266
Sensors: You name it I probably got 1.

Trigun
Posts: 117
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby Trigun » Saturday 08 April 2017 23:48

@ Sincze, are you also using a seperate query to generate info from influx to Grafana ? Still no luck with the power graphs from the smart meter. Grtz


Sent from my iPhone using Tapatalk

User avatar
sincze
Posts: 632
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6833
Location: Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby sincze » Saturday 08 April 2017 23:56

I use Pass2PHP ;-0

Code: Select all

<?php

        $input 
= ($s['Electra']);
        $meter = explode(";",$input);
        
        influxdb
("Electra_Usage",$meter[4]);
        influxdb("Electra_Return",$meter[5]);


And dump the data straight into influxdb.

If you would use Pass2Php the function could looks like:

Code: Select all


function influxdb
($device,$value)
{
// FAMOUS STRING REPLACEMENT UTILITY
    if (strpos($device, " ") !== false) { $device=str_replace(" ","_",$device); }
// ENDOF FAMOUS STRING REPLACEMENT UTILITY
   $postdata = ("device_$device value=$value ".system('date +%s%N'));
//   lg('InluxDB Data: '.$postdata);

    $opts = array('http' =>
        array(
            'method'  => 'POST',
            'header'  => 'Content-Type:application/octet-stream',
            'content' => $postdata
        
)
    );

    $context  = stream_context_create($opts);
    $result = file_get_contents('http://192.*.*.*:8086/write?db=domoticz', false, $context);
}
Running Domoticz since 2013 with Cubietruck
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266
Sensors: You name it I probably got 1.

Trigun
Posts: 117
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby Trigun » Sunday 09 April 2017 0:13

This might actually be solution. Would like to try it but am not really familiar with using these scripts in domoticz. Can you let me know how to set this up? would like to try it and compare it with the httplink output.


Sent from my iPhone using Tapatalk

User avatar
sincze
Posts: 632
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6833
Location: Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Postby sincze » Sunday 09 April 2017 0:21

No worries. we started a thread here: https://www.domoticz.com/forum/viewtopic.php?t=12343

Requires some patience however... no more "script ... over 10 seconds... " messages in your domoticz log. This really speeds up domoticz bigtime. Especially if you have complicated scripts (example: show ip camera on all devices that are switched on in your home when doorbell is pressed and send images via telegram to the mobile phones of the family members)..
Running Domoticz since 2013 with Cubietruck
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266
Sensors: You name it I probably got 1.


Return to “Show your projects”

Who is online

Users browsing this forum: No registered users and 3 guests