Toon as a domotica controller?

Everything about rooting Toons 1 and 2.

Moderators: marcelr, TheHogNL, Toonz

marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

Sending data to toon is easy.

Getting the data into the databases for display on toon is a totally different kettle of fish.
It will require some serious programming, to get all data averaged and plugged into the databases. But it's entirely possible.
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: Toon as a domotica controller?

Post by TheHogNL »

Sjoek wrote:Hello Fellow Members!
i am reading data from my smart meter for a while now, and like 2 keep it (history)

Is it possible or is this a lot af work for a little electric use and power-history?
Why would you even want to have the electric usage on the Toon? You already have it in domoticz now. You can remove all tiles regarding electric usage from Toon saving some memory for other apps.

If so, I would suggest to use the meteradapter (no idea if the electric usage is really a thing to consider) and then update your our domoticz P1 device from the data collected using the Toon output. You will keep your history but the P1 device is now updated using some scripting which collect them from Toon.
Member of the Toon Software Collective
glsf91
Member
Member
Posts: 184
Joined: Fri Sep 15, 2017 9:25 pm

Re: Toon as a domotica controller?

Post by glsf91 »

al_n wrote:Can someone please repeat the following test;
Please go to http://10.10.10.7/hdrv_zwave?action=getDevices.json (use your toon's IP) and compare the results of CurrentGasQuantity with the daily gas usage on the toon's screen.

I get 6,83 m3 on the toon's screen and 669490.00 from the json reply and I don't understand why.
The electricity readouts are accurate.

on http://10.10.10.7:7080/happ_pwrusage?ac ... rrentUsage

I get only avgValue for gas of 298.10 which makes no sense either.

If anyone knows of another way to get the daily gas usage than I'll be happy to know.
I know this is very old.
I have the same problem. I have a analog gas meter (No P1-meter).

Hopefully there will be more knowledge available now how to read the (analog) gas consumption.

My value on the display now 6,66m3 and the json:
"dev_2.1":{"uuid":"169b26b1-0939-4f27-b6af-8d53ffed9fa6", "name":"HAE_METER_v2_1", "internalAddress":"2.1", "type":"gas", "supportsCrc":"0", "ccList":"3c 3d 3e 72 86", "supportedCC":"3c 3d 3e 72 86", "CurrentGasFlow":"0.00", "CurrentGasQuantity":"19870.00", "location":"(null)"},

How can I retrieve the gas consumption?

Edit: I made a mistake in understanding the gas meter. Next day it was working like expected. So it is now showing the same value in domoticz as on the Toon display.
Last edited by glsf91 on Thu Jan 18, 2018 9:00 pm, edited 1 time in total.
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon as a domotica controller?

Post by Hypermobile »

glsf91 wrote:
al_n wrote:Can someone please repeat the following test;
Please go to http://10.10.10.7/hdrv_zwave?action=getDevices.json (use your toon's IP) and compare the results of CurrentGasQuantity with the daily gas usage on the toon's screen.

I get 6,83 m3 on the toon's screen and 669490.00 from the json reply and I don't understand why.
The electricity readouts are accurate.

on http://10.10.10.7:7080/happ_pwrusage?ac ... rrentUsage

I get only avgValue for gas of 298.10 which makes no sense either.

If anyone knows of another way to get the daily gas usage than I'll be happy to know.
I know this is very old.
I have the same problem. I have a analog gas meter (No P1-meter).

Hopefully there will be more knowledge available now how to read the (analog) gas consumption.

My value on the display now 6,66m3 and the json:
"dev_2.1":{"uuid":"169b26b1-0939-4f27-b6af-8d53ffed9fa6", "name":"HAE_METER_v2_1", "internalAddress":"2.1", "type":"gas", "supportsCrc":"0", "ccList":"3c 3d 3e 72 86", "supportedCC":"3c 3d 3e 72 86", "CurrentGasFlow":"0.00", "CurrentGasQuantity":"19870.00", "location":"(null)"},

How can I retrieve the gas consumption?
i rewrote the gas_data_json.php & analog_electricity_data_json.php
Since the scripts i downloaded from the Forum didn't work for me.


I'm not a programmer; but this scripts works for me...

what it does.

1) It read the Domoticz value of Gas-Total-Value of the GasMeter.
2) It reads a Domoticz User-Variable "UV_LastToonGas" (integer type)
3) It reads the CurrentGasQuantity from toon.

New value to be sent to domoticz = (3) - (2) + (1)

Domoticz does the rest of the calculations.
everytime i sent a higher total-gas-value.

Code: Select all

#!/usr/bin/php
<?php

/* Version 1.0 written by Ierlandfan */
/* Version 1.0 modified by DennisD */
/* Version 2.0 rewritten by FunFair */
/* Version 2.2 rewritten by Hypermobile */
/* 17-01-2018 */

/* 	Changelog Version 2.2
	- Changed the way of calculating gas. by saving the last Value into a User-Variable: "UV_LastToonGas" (Interger) in Domoticz
	- And checks whether the next Input is larger then the last input. to prevent getting wrong values in Domoticz like this one "18446744949882880"
*/


/* 
	Changelog Version 2.1
	- Removed the compare to previous value, so it will update every minute.

	Changelog Version 2.0:																		
	- Rewrite from version 1.0																	
	- Define IP adresses and idx value at start													
	- Check if Toon value is higher than Domoticz Value. (In case connection is lost with meteradapter, Toon will output wrong values) 
*/

/* Instructions:
	- Place script in Domoticz folder /home/pi/domoticz/scripts/p1_meter/ or desired folder.
	- Make sure Curl is installed (sudo apt-get install php-curl).
	- Make sure script is executable (chmod +x filename.php).
	- All echo's are used for debugging.
	- Put script in 'crontab -e' to run every minute. */ 
	  #Example crontab: (*/1 * * * * /home/pi/domoticz/scripts/p1_meter/gas_data_json.php)
	
		
/* Set IP addresses and idx*/
$IPDomoticz = '192.168.x.x:8084';
$IPToon = '192.168.x.x';
$idx = 357; 
$idx2 = 11; #UV_LastToonGas

/* read LastToonGasValue value from Domoticz */
$json_string = file_get_contents("http://$IPDomoticz/json.htm?type=command&param=getuservariable&$idx2");
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['result'][0];
$GasValueToonLast = $parsed_json['Value'] / 100;
echo "Gas Value UV_Domoticz = ";
echo $GasValueToonLast;
echo " liters";
echo "\n";

/* read Gasmeter value from Domoticz */
$json_string = file_get_contents("http://$IPDomoticz/json.htm?type=devices&rid=$idx");
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['result'][0];
$GasValueDomoticz = $parsed_json['Counter']*1000; #value Domoticz is in m3, convert to liters.
echo "Gas Value Domoticz = ";
echo $GasValueDomoticz;
echo " liters Totaal";
echo "\n";


/* http://$IPDomoticz/json.htm?type=command&param=getuservariable&idx=11

/* read Gasmeter Value from Toon */
$file_string_gas = file_get_contents("http://$IPToon/hdrv_zwave?action=getDevices.json");
$parsed_json = json_decode($file_string_gas, true);
$GasValueToon= $parsed_json['dev_3.1']['CurrentGasQuantity']; #value Toon is in liters.
echo "Gas Value Toon = ";
echo $GasValueToon;
echo " liters";
echo "\n";
echo "\n";

/*write current value to last uv_parameter]*/
	$GasValueToonNext = $GasValueToon * 100;
	if ($GasValueToonNext > 10) {
	$WriteVar = curl_init("http://$IPDomoticz/json.htm?type=command&param=updateuservariable&vname=UV_LastToonGas&vtype=Integer&vvalue=$GasValueToonNext");
	curl_exec($WriteVar);
}

if ($GasValueToon == $GasValueToonLast){
	echo "geen gasverbruik \n";
}

	if ($GasValueToon > $GasValueToonLast){ 
		$GasValueToon = $GasValueDomoticz + $GasValueToon - $GasValueToonLast ;
	echo $GasValueToon;
	echo "GasValueToon Herschreven \n";
		$WriteValue = curl_init("http://$IPDomoticz/json.htm?type=command&param=udevice&idx=$idx&nvalue=0&svalue=$GasValueToon");
		curl_exec($WriteValue);
	}

?>
EDIT: Added a check; the value written into "UV_Variable" is bigger than 10
yesterday my fuse blew ;Toon restarted. and got a wrong number in Domoticz.
Last edited by Hypermobile on Fri Jan 19, 2018 9:37 pm, edited 1 time in total.
michel30
Member
Member
Posts: 286
Joined: Fri Aug 25, 2017 4:42 pm

Re: Toon as a domotica controller?

Post by michel30 »

Hello,

I have something strange when I check this website: http://IP_TOON/hdrv_zwave?action=getDevices.json

The following is changed " dev_5.1: "

Code: Select all

 
dev_5.1: {
uuid: " ",
name: "HAE_METER_v3_1",
internalAddress: "5.1",
type: "gas",
supportsCrc: "0",
},
dev_5.2: {
uuid: " ",
name: "HAE_METER_v3_2",
internalAddress: "5.2",
type: "elec",
supportsCrc: "0",
location: "(null)"
Before I had dev_2.3: And Domiticz was reading out.
After upgrade the software off Toon it want dev_3.1:

But today it is dev_5.2:

So domoticz is not reading out.

I did one small thing but I don't know is that is the case.

I remove the meter from Toon and reconnected back in Toon.


I have also an other strange thing?

On my Toon my GAS use at this moment is 0,86 m3 but when I check in domoticz my GAS use is 10.160 m3 that sounds better than 0,86
Where is TOON getting this display information from? domoticz is receiving every min the GAS information from TOON.
Als my electric use on TOON is lower than it shows before..

It looks like TOON gives the wrong information on the display..
michel30
Member
Member
Posts: 286
Joined: Fri Aug 25, 2017 4:42 pm

Re: Toon as a domotica controller?

Post by michel30 »

If you have http://toon_ip/hdrv_zwave?action=getDevices.json and you see this:

CurrentGasFlow: "0.00",
CurrentGasQuantity: "15820.00",

Sud the CurrentGasFlow also filled in?

And when you check here: http://toon_ip/happ_pwrusage?action=GetCurrentUsage

sud this not filled in?

gasUsage:
value: 0,
dayCost: 0,
avgValue: 0
Rudolf
Member
Member
Posts: 136
Joined: Mon Dec 04, 2017 8:50 pm

Re: Toon as a domotica controller?

Post by Rudolf »

Maybe the MeterAdapter's firmware was updated and thus the device id has changed.
CurrentGasFlow is only non zero if you're actually using gas for i.e. heating or warm water right now.

{"result":"ok",
"powerUsage": {"value":xxxx, "dayCost":x.xx, "avgValue":xxx.xx},
"powerProduction": {"value":0, "dayCost":0.00, "avgValue":0.00},
"gasUsage": {"value":7976, "dayCost":103.37,"avgValue":272.56}
}

Ignore my values; my sensor is oriented the wrong way and that might be causing these high values.
It's cold outside, but not thát cold. :D
michel30
Member
Member
Posts: 286
Joined: Fri Aug 25, 2017 4:42 pm

Re: Toon as a domotica controller?

Post by michel30 »

Hello,

Thanks for you information: I see information now.

{
result: "ok",
powerUsage: {value: 184,dayCost: 0.97,avgValue: 270.54},
powerProduction: {value: 0,dayCost: 0,avgValue: 93.67},
gasUsage: {value: 0,dayCost: 0,avgValue: 10.79}
}

Only one thing I don't understand is GAS using today at table display say 1,28 m3

When I check: http://IP_TOON/hdrv_zwave?action=getDevices.json I see that CurrentGasQuantity: is "26490.00", when I check in my domoticz GAS used: for today it say 10,280 it looks like that I miss a number on my Toon that is sued be 10.28 m3

There also a strange thing last month I had always around 15 - 20 kwh of electric but for some how is it now between 6 - 10 kwh when I check http://IP_TOON/hdrv_zwave?action=getDevices.json CurrentElectricityQuantity: "14769.00", it looks like this shows also wrong in the total of electric use.

Is there a way to fix this? I have toon software 4.10.6
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon as a domotica controller?

Post by Hypermobile »

:D
Attachments
Webp.net-resizeimage.jpg
Webp.net-resizeimage.jpg (30.61 KiB) Viewed 11464 times
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon as a domotica controller?

Post by Hypermobile »

/qmf/qml/themes for the loadscreens

/qmf/qml/images for the logo.png
Attachments
loadscreen_0.png
loadscreen_0.png (186.13 KiB) Viewed 11463 times
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon as a domotica controller?

Post by Hypermobile »

loadscreen_1
Attachments
loadscreen_1.png
loadscreen_1.png (127.67 KiB) Viewed 11462 times
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon as a domotica controller?

Post by Hypermobile »

and last a Blank Logo.png
Attachments
logo.png
logo.png (2.76 KiB) Viewed 11462 times
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

Hypermobile wrote:loadscreen_1
Cool :mrgreen:
What about the splash screen and "first dot" image after kernel boot?
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon as a domotica controller?

Post by Hypermobile »

marcelr wrote:
Hypermobile wrote:loadscreen_1
Cool :mrgreen:
What about the splash screen and "first dot" image after kernel boot?
Well it's a Animation

1) Kernal-Original
2) Lightning Burst
3) complete Breakdown :-)

My Workaround to keep the Kernal one and still have a nice intro
Didn't know how to get to that one too :D

i'm more a Image Guy rather then a Programmer Guy
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon as a domotica controller?

Post by Hypermobile »

Post Reply

Return to “Toon Rooting”