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.

Moderator: leecollings

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

Grafana with InfluxDB for Domoticz

Post by thorian »

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: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by remb0 »

Great work! works nice..
maybe somethin to place also in our wiki?
thorian
Posts: 25
Joined: Tuesday 29 September 2015 19:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2563
Location: Poland
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by thorian »

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 / ODroid
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by arraWX »

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: 25
Joined: Tuesday 29 September 2015 19:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2563
Location: Poland
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by thorian »

Grafana is developing fast, so the entry is getting outdated. Thanks for the easier way @arraWX.
thorian
Posts: 25
Joined: Tuesday 29 September 2015 19:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2563
Location: Poland
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by thorian »

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: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Trigun »

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: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by sincze »

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

General overview
Grafana.JPG
Grafana.JPG (82.02 KiB) Viewed 20250 times
Monitor the CV
Grafana-OTGW.JPG
Grafana-OTGW.JPG (97.96 KiB) Viewed 20249 times
Monitoring Ziggo
Grafana-Ziggo.JPG
Grafana-Ziggo.JPG (43.85 KiB) Viewed 20249 times
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Jeff
Posts: 22
Joined: Monday 15 December 2014 23:39
Target OS: Windows
Domoticz version: 2.3674
Location: Weert, Netherlands
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Jeff »

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: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by sincze »

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_-_Sp ... 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.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Trigun »

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: 9
Joined: Tuesday 14 February 2017 21:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by grubstake »

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: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Trigun »

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: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by sincze »

It should still be possible with httplink right?
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Trigun »

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: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by sincze »

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.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Trigun »

@ 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: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by sincze »

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);
}
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by Trigun »

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: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Grafana with InfluxDB for Domoticz

Post by sincze »

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)..
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests