Page 1 of 6

Rooted Toon plugin

Posted: Sunday 27 December 2020 18:34
by hansaplast31
It was requested to start a new topic on this one.
I developed a plugin for Domoticz for the Toon thermostat after I rooted my trusty Toon v1.
So far I received some helpful feedback, if you want to try it you can find it here:

https://github.com/hansaplast26/domoticz-rooted-toon

* getting started
Create a directory such as RootedToonPlug under domoticz/plugins
copy the plugin.py to this directory & restart domoticz
you will find under hardware 'Rooted Toon', configure the IP address of the Toon. the port is default 80 and should be fine

* You will 6 devices under the newly added hardware:
- auto program to read and set the program mode
- program to read and set the program
- temperature read out
- setpoint temperature read and set
- boiler pressure
- program info (info on next program etc)

yes, yes: there is way much more to add (and I will)

I tested this on Domoticz running on a Raspberry Pi. My toon is a v1 model. Use at your own risk:-)


PS if you browse my github you also find a domoticz plugin for the andino X1. Really nice 'housing', I never bother to publish the plugin since I thought nobody will use it.

Re: Rooted Toon plugin

Posted: Sunday 27 December 2020 18:51
by madpatrick
Great plugin and let's try to add some more functionality

Small add-on.
You can install the plugin with Git

Code: Select all

 git clone https://github.com/hansaplast26/domoticz-rooted-toon

Re: Rooted Toon plugin

Posted: Sunday 27 December 2020 19:04
by madpatrick
Hans,
Tried the latest update (still version 1.0.0)
But the info text is giving an errror

Code: Select all

2020-12-27 19:01:19.072 Error: (Toon2) 'onMessage' failed 'UnboundLocalError':'local variable 'strToonInformation' referenced before assignment'.
2020-12-27 19:01:19.072 Error: (Toon2) ----> Line 356 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessage
2020-12-27 19:01:19.072 Error: (Toon2) ----> Line 277 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessage
2020-12-27 19:01:19.073 Error: (Toon2) ----> Line 224 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessageThermostatInfo

Re: Rooted Toon plugin

Posted: Sunday 27 December 2020 19:15
by EdwinK
Good to see there is a plugin being made for the Toon (v1, which I still use).

Re: Rooted Toon plugin

Posted: Sunday 27 December 2020 20:05
by hansaplast31
madpatrick wrote: Sunday 27 December 2020 19:04 Hans,
Tried the latest update (still version 1.0.0)
But the info text is giving an errror

Code: Select all

2020-12-27 19:01:19.072 Error: (Toon2) 'onMessage' failed 'UnboundLocalError':'local variable 'strToonInformation' referenced before assignment'.
2020-12-27 19:01:19.072 Error: (Toon2) ----> Line 356 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessage
2020-12-27 19:01:19.072 Error: (Toon2) ----> Line 277 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessage
2020-12-27 19:01:19.073 Error: (Toon2) ----> Line 224 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessageThermostatInfo
Yes I spotted it, do you see this in the logs all the time or just once in the beginning (thats what I saw here).

Re: Rooted Toon plugin

Posted: Sunday 27 December 2020 20:32
by madpatrick
hansaplast31 wrote: Sunday 27 December 2020 20:05
madpatrick wrote: Sunday 27 December 2020 19:04 Hans,
Tried the latest update (still version 1.0.0)
But the info text is giving an errror

Code: Select all

2020-12-27 19:01:19.072 Error: (Toon2) 'onMessage' failed 'UnboundLocalError':'local variable 'strToonInformation' referenced before assignment'.
2020-12-27 19:01:19.072 Error: (Toon2) ----> Line 356 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessage
2020-12-27 19:01:19.072 Error: (Toon2) ----> Line 277 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessage
2020-12-27 19:01:19.073 Error: (Toon2) ----> Line 224 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessageThermostatInfo
Yes I spotted it, do you see this in the logs all the time or just once in the beginning (thats what I saw here).
All the time

Re: Rooted Toon plugin

Posted: Sunday 27 December 2020 21:13
by hansaplast31
madpatrick wrote: Sunday 27 December 2020 20:32
hansaplast31 wrote: Sunday 27 December 2020 20:05
madpatrick wrote: Sunday 27 December 2020 19:04 Hans,
Tried the latest update (still version 1.0.0)
But the info text is giving an errror

Code: Select all

2020-12-27 19:01:19.072 Error: (Toon2) 'onMessage' failed 'UnboundLocalError':'local variable 'strToonInformation' referenced before assignment'.
2020-12-27 19:01:19.072 Error: (Toon2) ----> Line 356 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessage
2020-12-27 19:01:19.072 Error: (Toon2) ----> Line 277 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessage
2020-12-27 19:01:19.073 Error: (Toon2) ----> Line 224 in '/var/domoticz/plugins/domoticz-rooted-toon/plugin.py', function onMessageThermostatInfo
Yes I spotted it, do you see this in the logs all the time or just once in the beginning (thats what I saw here).
All the time
can you do a checkout from git? i added some extra info. what program / program state is your toon in?

Re: Rooted Toon plugin

Posted: Monday 28 December 2020 10:04
by madpatrick
I've made a clean install on VM for testing (keep my current setup clean)
Installed the latetst version by Git and now I don't see any errors in the log

The text in Program Info give :

Code: Select all

This should never happen -1
Program : Home
Program state : No (not using the program function at all)

Re: Rooted Toon plugin

Posted: Monday 28 December 2020 10:29
by hansaplast31
madpatrick wrote: Monday 28 December 2020 10:04 I've made a clean install on VM for testing (keep my current setup clean)
Installed the latetst version by Git and now I don't see any errors in the log

The text in Program Info give :

Code: Select all

This should never happen -1
Program : Home
Program state : No (not using the program function at all)
Very good about the VM! I have a spare raspberry pi for testing;)
Does this message go away (it should actually only be visible in the first few seconds, before any update of the Toon is received).

Re: Rooted Toon plugin

Posted: Monday 28 December 2020 10:46
by madpatrick
It stayed for more then 30 minutes.
Then I stopped the server

Re: Rooted Toon plugin

Posted: Tuesday 29 December 2020 7:33
by hansaplast31
madpatrick wrote: Monday 28 December 2020 10:46 It stayed for more then 30 minutes.
Then I stopped the server
The -1 after the 'this should never happen' is a value generated by the toon. In the snippets of information on the internet about Toon published by Eneco it appears that -1 is used when no program is running / set up / active (I don't know exactly). It is handled properly. But tell me, do you run any program on your Toon or do you set it differently?

version 1.0.1 is checked in. with power usage / production and gas (but gas is not working for me). this data comes from /happ_pwrusage?action=GetCurrentUsage

Re: Rooted Toon plugin

Posted: Tuesday 29 December 2020 10:56
by madpatrick
hansaplast31 wrote: Tuesday 29 December 2020 7:33 The -1 after the 'this should never happen' is a value generated by the toon. In the snippets of information on the internet about Toon published by Eneco it appears that -1 is used when no program is running / set up / active (I don't know exactly). It is handled properly. But tell me, do you run any program on your Toon or do you set it differently?

version 1.0.1 is checked in. with power usage / production and gas (but gas is not working for me). this data comes from /happ_pwrusage?action=GetCurrentUsage
I'm not using the Programs on the Toon and also not the text info box, so no issue for me.
When setting the Program on, the text box is working
Image

I'll test the new version for you.

Re: Rooted Toon plugin

Posted: Tuesday 29 December 2020 11:09
by madpatrick
madpatrick wrote: Tuesday 29 December 2020 10:56
hansaplast31 wrote: Tuesday 29 December 2020 7:33 The -1 after the 'this should never happen' is a value generated by the toon. In the snippets of information on the internet about Toon published by Eneco it appears that -1 is used when no program is running / set up / active (I don't know exactly). It is handled properly. But tell me, do you run any program on your Toon or do you set it differently?

version 1.0.1 is checked in. with power usage / production and gas (but gas is not working for me). this data comes from /happ_pwrusage?action=GetCurrentUsage
I'm not using the Programs on the Toon and also not the text info box, so no issue for me.

I'll test the new version for you.
The powerusage and gas blocks are different types.
This is my current setup.
I'm using the P1 sensor and combined powerproduction and usage in one tile (Slimme meter elektra)
And the use of Low and High tariff is possible then in the same tile


Image

Image

Also the Gasmeter is different.
You are using the Watermeter for Gas

Code: Select all

 Domoticz.Device(Name="Gas Usage", Unit=9, TypeName="Waterflow").Create()
must be

Code: Select all

 Domoticz.Device(Name="Gas Usage", Unit=9, TypeName="Gas").Create()

The command "/happ_pwrusage?action=GetCurrentUsage" is not giving all the required information:

{"result":"ok",
"powerUsage": {"value":697, "avgValue":1089.62},
"powerProduction": {"value":0, "avgValue":6.69},

In the script we are using "/hdrv_zwave?action=getDevices.json". This gives als the informaton, but is difficult to read which value is for which sensor
"gasUsage": {"value":null,"avgValue":null}
}

Looks like the gasusage is not working like this way:
https://www.domoticaforum.eu/viewtopic. ... 04&t=12546

Re: Rooted Toon plugin

Posted: Tuesday 29 December 2020 12:17
by hansaplast31
I think I will implement the zwave devices readout soon (it is not that difficult to parse).
However getting the real P1 readouts would be better. this is more accurate and allows for using the P1 devices that are defined in Domoticz.
The P1 devices require information in P1 format (which I obviously do not have).

What piece of hardware do you have for P1 readout (on top of Toon's Zwave meters?)

Re: Rooted Toon plugin

Posted: Tuesday 29 December 2020 12:30
by madpatrick
hansaplast31 wrote: Tuesday 29 December 2020 12:17 I think I will implement the zwave devices readout soon (it is not that difficult to parse).
However getting the real P1 readouts would be better. this is more accurate and allows for using the P1 devices that are defined in Domoticz.
The P1 devices require information in P1 format (which I obviously do not have).

What piece of hardware do you have for P1 readout (on top of Toon's Zwave meters?)
I get the P1 readout from my Toon by uisng a inepro pro1 kWh meter connect to the Meteradapter
https://ineprometering.com/pro1/
https://iotdomotica.nl/klimaat/zon-op-t ... -sTTNhKiUk

Re: Rooted Toon plugin

Posted: Tuesday 29 December 2020 13:02
by hansaplast31
madpatrick wrote: Tuesday 29 December 2020 11:09
Also the Gasmeter is different.
You are using the Watermeter for Gas

Code: Select all

 Domoticz.Device(Name="Gas Usage", Unit=9, TypeName="Waterflow").Create()
must be

Code: Select all

 Domoticz.Device(Name="Gas Usage", Unit=9, TypeName="Gas").Create()
The TypeName Gas is a counter for gas usage (in m3). Gas flow is not measured in m3 (that would be the same as measuring electricity flow in kWh instead of Watts). Waterflow with l/min comes closest. But the image is simply not right, but will work it out.


hdrv_zwave?action=getDevices.json has everything, you can see that CurrentGasFlow is there, as well as electricity flow (nt and lt, delivered and received).

Image

Re: Rooted Toon plugin

Posted: Tuesday 29 December 2020 13:07
by madpatrick
hansaplast31 wrote: Tuesday 29 December 2020 13:02
The TypeName Gas is a counter for gas usage (in m3). Gas flow is not measured in m3 (that would be the same as measuring electricity flow in kWh instead of Watts). Waterflow with l/min comes closest. But the image is simply not right, but will work it out.
Correct, but the the total usage is in m3 (1000L) and that is what is on the bill to the energy company. ;)

Re: Rooted Toon plugin

Posted: Wednesday 30 December 2020 11:11
by hansaplast31
Version 1.0.2 is on git. zwave devices are now being read out

there are now three devices for gasflow/counter, electricity current usage/counter & generated electricity current delivery/counter.
the biggest struggle so far has finding the right device type, and I believe there is still room for improvement there.

Re: Rooted Toon plugin

Posted: Wednesday 30 December 2020 11:15
by hansaplast31
madpatrick wrote: Tuesday 29 December 2020 13:07 Correct, but the the total usage is in m3 (1000L) and that is what is on the bill to the energy company. ;)
With a readout of once per 10 seconds (this is the granularity the toon offers) you cannot go from a flow of l/min to m3. the same as for electricity, 500 watt (500 joule / second) sampled every 10 seconds will not give you a reliable total usage at the end of a day.
therefore toon, but also domoticz have the current usage and a counter. the counter should be used for determining your usage per day.
the current usage is just an indication of what is happening now (kind of now).

Re: Rooted Toon plugin

Posted: Wednesday 30 December 2020 11:36
by madpatrick
hansaplast31 wrote: Wednesday 30 December 2020 11:11 Version 1.0.2 is on git. zwave devices are now being read out

there are now three devices for gasflow/counter, electricity current usage/counter & generated electricity current delivery/counter.
the biggest struggle so far has finding the right device type, and I believe there is still room for improvement there.
Tried v1.02 and see this in the log. Not sure this is ok.

Code: Select all

2020-12-29 17:32:02.984 Status: (Toon2) Initialized version 1.0.2, author 'Hansaplast31'
2020-12-29 17:32:02.987 Status: (Toon2) Entering work loop.
2020-12-29 17:32:03.051 (Toon2) getZwaveInfo created
2020-12-29 17:32:03.110 (Toon2) Update 0:'18.8' (Toon2 - Current Temperature)
2020-12-29 17:32:03.111 (Toon2) Update 0:'19.0' (Toon2 - Setpoint Temperature)
2020-12-29 17:32:03.113 (Toon2) Update 0:'10' (Toon2 - Auto Program)
2020-12-29 17:32:03.114 (Toon2) Update 0:'50' (Toon2 - Program)
2020-12-29 17:32:03.115 (Toon2) Update 0:'No information received from Toon yet (-1)' (Toon2 - Program info)
2020-12-29 17:32:03.115 (Toon2) Update 0:'1.7' (Toon2 - Boiler pressure)
2020-12-29 17:32:03.116 (Toon2) Update 0:'0;0' (Toon2 - Electricity)
2020-12-29 17:32:03.117 (Toon2) Update 0:'0;0' (Toon2 - Generated Electricity)
2020-12-29 17:32:13.130 (Toon2) getZwaveInfo created
2020-12-29 17:32:23.202 (Toon2) getZwaveInfo created
2020-12-29 17:32:33.241 (Toon2) getZwaveInfo created
2020-12-29 17:32:43.330 (Toon2) getZwaveInfo created
2020-12-29 17:32:53.329 (Toon2) getZwaveInfo created
2020-12-29 17:33:03.414 (Toon2) getZwaveInfo created
2020-12-29 17:33:13.483 (Toon2) getZwaveInfo created
2020-12-29 17:33:23.521 (Toon2) getZwaveInfo created
2020-12-29 17:33:33.579 (Toon2) getZwaveInfo created
2020-12-29 17:33:43.624 (Toon2) getZwaveInfo created
2020-12-29 17:33:53.708 (Toon2) getZwaveInfo created
2020-12-29 17:34:03.743 (Toon2) getZwaveInfo created
2020-12-29 17:34:13.809 (Toon2) getZwaveInfo created
2020-12-29 17:34:23.849 (Toon2) getZwaveInfo created
2020-12-29 17:34:33.933 (Toon2) getZwaveInfo created
2020-12-29 17:34:43.993 (Toon2) getZwaveInfo created
2020-12-29 17:34:54.044 (Toon2) getZwaveInfo created
2020-12-29 17:35:04.057 (Toon2) getZwaveInfo created
2020-12-29 17:35:14.113 (Toon2) getZwaveInfo created
2020-12-29 17:35:24.158 (Toon2) getZwaveInfo created
2020-12-29 17:35:34.199 (Toon2) getZwaveInfo created
2020-12-29 17:35:44.305 (Toon2) getZwaveInfo created
2020-12-29 17:35:54.331 (Toon2) getZwaveInfo created
2020-12-29 17:36:04.409 (Toon2) getZwaveInfo created
2020-12-29 17:36:14.461 (Toon2) getZwaveInfo created
2020-12-29 17:36:24.551 (Toon2) getZwaveInfo created
2020-12-29 17:36:34.605 (Toon2) getZwaveInfo created
2020-12-29 17:36:44.639 (Toon2) getZwaveInfo created
2020-12-29 17:36:54.719 (Toon2) getZwaveInfo created
2020-12-29 17:37:04.757 (Toon2) getZwaveInfo created
2020-12-29 17:37:14.820 (Toon2) getZwaveInfo created
2020-12-29 17:37:24.881 (Toon2) getZwaveInfo created
2020-12-29 17:37:34.971 (Toon2) getZwaveInfo created
2020-12-29 17:37:44.985 (Toon2) getZwaveInfo created
2020-12-29 17:37:45.044 (Toon2) Update 0:'1.9' (Toon2 - Boiler pressure)
2020-12-29 17:37:55.065 (Toon2) getZwaveInfo created
2020-12-29 17:38:05.120 (Toon2) getZwaveInfo created
2020-12-29 17:38:15.221 (Toon2) getZwaveInfo created
2020-12-29 17:38:25.275 (Toon2) getZwaveInfo created
2020-12-29 17:38:35.299 (Toon2) getZwaveInfo created
2020-12-29 17:38:45.352 (Toon2) getZwaveInfo created
2020-12-29 17:38:55.380 (Toon2) getZwaveInfo created
2020-12-29 17:39:05.470 (Toon2) getZwaveInfo created
2020-12-29 17:39:15.520 (Toon2) getZwaveInfo created
2020-12-29 17:39:25.587 (Toon2) getZwaveInfo created
2020-12-29 17:39:35.679 (Toon2) getZwaveInfo created
2020-12-29 17:39:45.712 (Toon2) getZwaveInfo created
2020-12-29 17:39:55.787 (Toon2) getZwaveInfo created
2020-12-29 17:40:05.855 (Toon2) getZwaveInfo created
2020-12-29 17:40:15.931 (Toon2) getZwaveInfo created

The plugin is getting better !
For me the Energy device is currently the P1 and is working fine.
You can see the (realtime) energy flow from consumption and delivery (solar) in 1 device.
and also the actual use and total day use of both.
Image