Toon app: boiler status

Forum about forum-provided applications on Toon

Moderators: marcelr, TheHogNL, Toonz

User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Toon app: boiler status

Post 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
Regards, Ron.
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Toon app: boiler status

Post 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/)
Last edited by Ierlandfan on Sun Nov 26, 2017 10:54 pm, edited 3 times in total.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Toon app: boiler status

Post 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 17050 times
You can see when the CV got it's yearly maintenance ;)
graph_1year.png
graph_1year.png (77.25 KiB) Viewed 17050 times
graph_7days.png
graph_7days.png (48.61 KiB) Viewed 17050 times
Regards, Ron.
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: boiler status

Post 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.
member of the Toon Software Collective
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Toon app: boiler status

Post 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.
gielie
Member
Member
Posts: 70
Joined: Thu Nov 02, 2017 11:06 am

Re: Toon app: boiler status

Post by gielie »

Ierlandfan wrote:Posting to Grafana is already integrated into Domoticz.
Could you explain how i can get this data into Domoticz?
DennisD
Starting Member
Starting Member
Posts: 24
Joined: Tue Jul 11, 2017 7:28 pm

Re: Toon app: boiler status

Post 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 ;)
globegrabber
Starting Member
Starting Member
Posts: 47
Joined: Thu Sep 21, 2017 9:14 pm

Re: Toon app: boiler status

Post 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.
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon app: boiler status

Post 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.
globegrabber
Starting Member
Starting Member
Posts: 47
Joined: Thu Sep 21, 2017 9:14 pm

Re: Toon app: boiler status

Post by globegrabber »

Ohww thats a little bit of a pity.
Thnz anyway for the reply.

grz
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: boiler status

Post 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 16536 times
Attachments
4_10_rrd_contents_xls.zip
(10.13 KiB) Downloaded 546 times
member of the Toon Software Collective
rubyan
Starting Member
Starting Member
Posts: 10
Joined: Sat Nov 11, 2017 12:09 am

Re: Toon app: boiler status

Post 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.
DennisD
Starting Member
Starting Member
Posts: 24
Joined: Tue Jul 11, 2017 7:28 pm

Re: Toon app: boiler status

Post by DennisD »

I just did a factory reset on Toon itself. You do lose your existingvdata but that wasn't a problem for me.
rubyan
Starting Member
Starting Member
Posts: 10
Joined: Sat Nov 11, 2017 12:09 am

Re: Toon app: boiler status

Post 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.
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon app: boiler status

Post 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).
Post Reply

Return to “Toon Apps”