Toon app: boiler status

Forum about forum-provided applications on Toon

Moderators: marcelr, TerrorSource, Toonz, TheHogNL

Re: Toon app: boiler status

Postby RDNZL » Sun Nov 26, 2017 12:01 pm

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.
User avatar
RDNZL
Forum Moderator
Forum Moderator
 
Posts: 997
Joined: September 2006
Location: Dordrecht, The Netherlands

Re: Toon app: boiler status

Postby Ierlandfan » Sun Nov 26, 2017 4:09 pm

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 9:54 pm, edited 3 times in total.
Ierlandfan
Member
Member
 
Posts: 150
Joined: October 2013

Re: Toon app: boiler status

Postby RDNZL » Sun Nov 26, 2017 8:28 pm

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 7374 times

You can see when the CV got it's yearly maintenance ;)
graph_1year.png
graph_1year.png (77.25 KiB) Viewed 7374 times

graph_7days.png
graph_7days.png (48.61 KiB) Viewed 7374 times
Regards, Ron.
User avatar
RDNZL
Forum Moderator
Forum Moderator
 
Posts: 997
Joined: September 2006
Location: Dordrecht, The Netherlands

Re: Toon app: boiler status

Postby Toonz » Sun Nov 26, 2017 8:35 pm

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
User avatar
Toonz
Forum Moderator
Forum Moderator
 
Posts: 1381
Joined: December 2016

Re: Toon app: boiler status

Postby Ierlandfan » Mon Nov 27, 2017 7:52 pm

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.
Ierlandfan
Member
Member
 
Posts: 150
Joined: October 2013

Re: Toon app: boiler status

Postby gielie » Tue Nov 28, 2017 1:19 pm

Ierlandfan wrote:Posting to Grafana is already integrated into Domoticz.

Could you explain how i can get this data into Domoticz?
gielie
Member
Member
 
Posts: 55
Joined: November 2017

Re: Toon app: boiler status

Postby DennisD » Mon Dec 04, 2017 8:12 pm

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 ;)
DennisD
Starting Member
Starting Member
 
Posts: 19
Joined: July 2017

Re: Toon app: boiler status

Postby globegrabber » Sun Dec 10, 2017 2:19 pm

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.
globegrabber
Starting Member
Starting Member
 
Posts: 45
Joined: September 2017

Re: Toon app: boiler status

Postby marcelr » Sun Dec 10, 2017 4:10 pm

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.
marcelr
Global Moderator
Global Moderator
 
Posts: 1113
Joined: May 2012
Location: Ehv

Re: Toon app: boiler status

Postby globegrabber » Sun Dec 10, 2017 4:43 pm

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

grz
globegrabber
Starting Member
Starting Member
 
Posts: 45
Joined: September 2017

Re: Toon app: boiler status

Postby Toonz » Thu Dec 14, 2017 9:35 pm

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 6860 times
Attachments
4_10_rrd_contents_xls.zip
(10.13 KiB) Downloaded 141 times
member of the Toon Software Collective
User avatar
Toonz
Forum Moderator
Forum Moderator
 
Posts: 1381
Joined: December 2016

Re: Toon app: boiler status

Postby rubyan » Thu Jan 04, 2018 10:45 pm

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.
rubyan
Starting Member
Starting Member
 
Posts: 10
Joined: November 2017

Re: Toon app: boiler status

Postby DennisD » Fri Jan 05, 2018 10:35 am

I just did a factory reset on Toon itself. You do lose your existingvdata but that wasn't a problem for me.
DennisD
Starting Member
Starting Member
 
Posts: 19
Joined: July 2017

Re: Toon app: boiler status

Postby rubyan » Sat Jan 06, 2018 9:03 pm

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.
rubyan
Starting Member
Starting Member
 
Posts: 10
Joined: November 2017

Re: Toon app: boiler status

Postby marcelr » Sat Jan 06, 2018 9:19 pm

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).
marcelr
Global Moderator
Global Moderator
 
Posts: 1113
Joined: May 2012
Location: Ehv

PreviousNext

Return to Toon Apps

Who is online

Users browsing this forum: No registered users and 1 guest