Page 3 of 12

Re: Toon app: boiler status

Posted: Sun Nov 26, 2017 1:01 pm
by RDNZL
Influxdb and Grafana together form a nice platform to graph stuff.
I'm thinking about how to get this rrd data imported and create graphs for them to be used outside toon.

nickyb2.tweakblogs.net/blog/13109/bijmi ... rm-gateway

Re: Toon app: boiler status

Posted: Sun Nov 26, 2017 5:09 pm
by Ierlandfan
Posting to Grafana is already integrated into Domoticz. But it's also possible with InfluxDb, they removed JSON from Influx long time ago so you need a little scripting. You need to write a small php script to make it work:

Code: Select all

#!/usr/bin/php
<?php
        error_reporting(E_ALL);

$data = file_get_contents('http://192.168.1.31:10080/hcb_rrd?action=getRrdData&loggerName=thermstat_boilerChPressure&rra=year&readableTime=1&samples=100&nullForNaN=1&skipEmpty=1');
  
//echo $data;
$split0 = str_replace(' ',  '$', $data);
$split1 = str_replace('":$',  '" : { "Value": ', $split0); 
$split2 = str_replace(',"', ' # #, " ', $split1);
$split3 = str_replace('$', '": {" ', $split2);
$split4 = str_replace('}', '} } }', $split3);
$split5 = str_replace(' # #, "' , ' } }, " ' ,$split4);
$split6 = str_replace('{": {" "' , '{ " ' ,$split5);

$final_array = json_decode($split6, TRUE);
print_r($final_array);
?>
Let's say write some code that split it into these three values (Edit: It's up to the reader to do some json magic)
$Date
$Time
$value

Then you can make a post to the database something in the line of this:

curl -i -XPOST 'http://Your-IP-Influxdb-Server:Portnumber/write?db=Your-Database-name' --data-binary 'Date-Time,$Date, $time, value=$value '

(docs.influxdata.com/influxdb/v1.3/guide ... ting_data/)

Re: Toon app: boiler status

Posted: Sun Nov 26, 2017 9:28 pm
by RDNZL
Very nice pointers you gave there!
I whipped up this small python script to import all boiler water pressure data from last year.

Code: Select all

#!/usr/bin/python
import requests

toon_url = 'http://192.168.178.133/hcb_rrd?action=getRrdData&loggerName=thermstat_boilerChPressure&rra=year&nullForNaN=1'

db_url = 'http://192.168.178.113:8086/write?db=toon'
headers = {'X-Requested-With': 'Python requests', 'Content-type': 'text/xml'}

values = requests.get(toon_url).json()
for timestamp, value in values.iteritems():
    print(timestamp, value)
    payload = 'thermstat_boilerChPressure value=' + str(value) + ' ' + str(timestamp + '000000000')
    r = requests.post(db_url, data=payload, headers=headers)
Steps to do before running this:

Install influxdb and grafana
Create database to store data ('toon' in my case)
$ influx
Connected to http://localhost:8086 version 1.3.6
InfluxDB shell version: 1.3.6
> CREATE DATABASE toon

Change script to reflect your toon and influxdb server urls
Also the data you want to copy (tested with thermstat_boilerChPressure)

Add datasource in grafana to use influxdb and db toon
Create dashboard and graph to display data you want to view like this.
graph_define.png
graph_define.png (40.68 KiB) Viewed 17203 times
You can see when the CV got it's yearly maintenance ;)
graph_1year.png
graph_1year.png (77.25 KiB) Viewed 17203 times
graph_7days.png
graph_7days.png (48.61 KiB) Viewed 17203 times

Re: Toon app: boiler status

Posted: Sun Nov 26, 2017 9:35 pm
by Toonz
Another small find from version 4.8 onwards for the graph app:

if you change the following line in GraphScreen.qml:

Code: Select all

			visible: globals.thermostatFeatures["FF_HeatingBeat_UiElements"]
into

Code: Select all

			visible: true
You will get an extra tab in the graph screen called 'boiler' which shows you the minutes and hours the boiler has been burning.

Re: Toon app: boiler status

Posted: Mon Nov 27, 2017 8:52 pm
by Ierlandfan
If Grafana is showing a red triangle in the left top of the graph then you have to set the time interval in the datasource to:

Code: Select all

>60s
As in copy and paste that and hit save&test. Then it works.

Re: Toon app: boiler status

Posted: Tue Nov 28, 2017 2:19 pm
by gielie
Ierlandfan wrote:Posting to Grafana is already integrated into Domoticz.
Could you explain how i can get this data into Domoticz?

Re: Toon app: boiler status

Posted: Mon Dec 04, 2017 9:12 pm
by DennisD
Great findings, unfortunately i upgraded to 4.9.23. Before the upgrade i used the happ_thermstat?action=printTableInfo url to load information into my domoticz, for example when my hotwater was on so domoticz could lower my screens in case they were open. Downgrading to happ-thermstat_1.554-trunk_qb2.ipk while on firmware 4.9.23 makes my boilermodule unseen by toon. Now my question is how can i check whether my hot water is on or not, via toon ;)

Re: Toon app: boiler status

Posted: Sun Dec 10, 2017 3:19 pm
by globegrabber
Hallo, I like to have the boilerstatus app as a tile on my rooted toon only thing is i don't now how to do this the firmware on my toon is ad this moment 4.7.23
Isn't possible to do this install this by the Toon store? I do not now how to install this by using putty!
probably there are more people how have this problem, it will fore those being muts conveniently be if this is possible by the Toon store.
Thz.

Re: Toon app: boiler status

Posted: Sun Dec 10, 2017 5:10 pm
by marcelr
The boiler status tile is available for toons with firmwares 3.0.29 - 3.5.4. For other versions, the app needs a full rewrite.

Re: Toon app: boiler status

Posted: Sun Dec 10, 2017 5:43 pm
by globegrabber
Ohww thats a little bit of a pity.
Thnz anyway for the reply.

grz

Re: Toon app: boiler status

Posted: Thu Dec 14, 2017 10:35 pm
by Toonz
Toonz wrote:I believe these are the parameters you can use in the http call which I have successfully tested:

readableTime (values 0 or 1 - converts Epoch to normal time
skipEmpty (values 0 or 1 - skips null value readings)
nullForNaN (values 0 or 1 - shows null instead of NaN)
loggerName (string without quotes)
rra (string without quotes)
from (epoch time)
to (epoch time)
samples (integer value - determines how many values you will receive back)

Example:

Code: Select all

http://192.168.x.x/hcb_rrd?action=getRrdData&loggerName=thermstat_boilerChPressure&rra=year&readableTime=1&samples=100&nullForNaN=1&from=1504301154&to=1509301154&skipEmpty=1
More parameters exist but these are for the function setRrdData with which you can create rra data yourself
To add to this post for convenience a complete overview of all variables available in the rrd databases from version 4.10.
Note that the ID's after the smart plug variables are different for each smart plug. Each plug will have it's own set of databases.
4.10.rrd.png
4.10.rrd.png (51.5 KiB) Viewed 16689 times

Re: Toon app: boiler status

Posted: Thu Jan 04, 2018 11:45 pm
by rubyan
DennisD wrote:Great findings, unfortunately i upgraded to 4.9.23. Before the upgrade i used the happ_thermstat?action=printTableInfo url to load information into my domoticz, for example when my hotwater was on so domoticz could lower my screens in case they were open. Downgrading to happ-thermstat_1.554-trunk_qb2.ipk while on firmware 4.9.23 makes my boilermodule unseen by toon. Now my question is how can i check whether my hot water is on or not, via toon ;)
So I downgraded to happ-thermstat_1.554-trunk_qb2.ipk because I wanted to see the data on http://TOONIP/happ_thermstat?action=printTableInfo . It is working, but on my 4.9.23 firmware the boilermodule tile is not usable, and that is not what I want. However, I cannot find the current happ-thermstat (which is version 1.1117-ene-master I believe) ipk file online, and also not on my toon in the cache dir. How can I restore the situation before downgrading to happ-thermstat_1.554-trunk_qb2.ipk ? Is there anyone here that can provide the current happ-thermstat ipk file or do I have to enable the VPN and try to upgrade ? I'm quite new to this, and do not know the exact direction I should go now.

Re: Toon app: boiler status

Posted: Fri Jan 05, 2018 11:35 am
by DennisD
I just did a factory reset on Toon itself. You do lose your existingvdata but that wasn't a problem for me.

Re: Toon app: boiler status

Posted: Sat Jan 06, 2018 10:03 pm
by rubyan
DennisD wrote:I just did a factory reset on Toon itself. You do lose your existingvdata but that wasn't a problem for me.
And what happens during a factory reset? Do I need to 'reroot' the device? Are the iptables restored? What happens to the root passwd? I only have a few days existing data, loosing that is not a problem.

Re: Toon app: boiler status

Posted: Sat Jan 06, 2018 10:19 pm
by marcelr
rubyan wrote:And what happens during a factory reset? Do I need to 'reroot' the device? Are the iptables restored? What happens to the root passwd? I only have a few days existing data, loosing that is not a problem.
A factory reset will:

erase all databases on toon
erase personal setiings like the week program, tile preferences etc.
erase wifi settings
reset toon's configuration (config_happ_scsync.xml) to its default settings

It will NOT:

reset the password
reset iptables.conf
remove any software packages

(It will also remove a bunch of files in RAM, but these are restored as soon as the machine has rebooted).