Page 14 of 22

Re: Controlling Toon [HACKED] from Domoticz

Posted: Monday 05 November 2018 13:17
by madpatrick
ronalddehaan wrote: Monday 05 November 2018 12:28
madpatrick wrote: Sunday 23 September 2018 14:11 snip
So this is the most recent (in a nutshell) instruction to get Toon talking to Domoticz?
In that case I will offer up a spare saturday evening to give it a new try :D
Please also check out this post :
https://www.domoticaforum.eu/viewtopic. ... =15#p87836

This is the same script, but in DZvents and runs "smoother".
You must comment out what you are not needing.

Re: Controlling Toon [HACKED] from Domoticz

Posted: Monday 05 November 2018 18:36
by Smiggel
MatthijsD wrote: Monday 05 November 2018 11:45
MatthijsD wrote: Monday 05 November 2018 11:02 I hope someone can help me out here :)
Toon suddenly stopped working on Domoticz; Room Setpoint, HeatingOn, Stroom and Temperature are all last sen on 2018-10-10 02:07:38.

I have no idea where to look how to get this working again.
Anyone had this happen to?
I've read the tutorial about Toon and Domoticz again, couldn't find anything out of the ordinary.
Then, I went to the Toon Hardware in Domoticz and turned it off and on again. Then suddenly it started working again!

Was lucky that this did the trick :')
Nice! Good to hear it worked. :-)

Re: Controlling Toon [HACKED] from Domoticz

Posted: Tuesday 06 November 2018 10:55
by EdwinK
Okay, I'm trying to get that dzVents script to work, and for the most parts it works, but
I've commented this for now,

Code: Select all

 -- domoticz.log(jsonGasPower)               
        -- local CurrentElectricityFlowHoog		= tonumber(jsonGasPower.dev_44.CurrentElectricityFlow )
        -- local CurrentElectricityQuantityHoog	= tonumber(jsonGasPower.dev_44.CurrentElectricityQuantity)
        -- local CurrentElectricityFlowLaag       	= tonumber(jsonGasPower.dev_46.CurrentElectricityFlow )
        -- local CurrentElectricityQuantityLaag     	= tonumber(jsonGasPower.dev_46.CurrentElectricityQuantity)
        -- local CurrentGasFlow                     	= tonumber(jsonGasPower.dev_41.CurrentGasFlow)
        -- local CurrentGasQuantity                 	= tonumber(jsonGasPower.dev_41.CurrentGasQuantity)
        -- local CurrentElectricityQuantity         	= CurrentElectricityFlowHoog + CurrentElectricityFlowLaag
        -- local CurrentElectricityDeliveredLaag    	= 0
        -- local CurrentElectricityDeliveredHoog    = 0
        -- local totalDeliveredPower                	= 0
According to a post on the domotica-forum I need to replace the dev_44 into either:
dev_2.2 is your're dev, Try that one?

or: dev_2.1

or: dev_2.5

or: dev_2.6

or: dev_2.8

Don't forget the underscore _ and the dot between 2 and 8
However, using either one of those will result in an error in the editor, about " expected ')' near '0.1' "

Who can help me with this?

Re: Controlling Toon [HACKED] from Domoticz

Posted: Tuesday 06 November 2018 11:22
by madpatrick
Did you comment this one out also

Code: Select all

        
        --domoticz.devices(P1SmartMeterPower).updateP1(CurrentElectricityQuantityLaag, CurrentElectricityQuantityHoog, CurrentElectricityFlowLaagDel, CurrentElectricityFlowHoogDel, CurrentElectricityQuantity, totalDeliveredPower).silent()
        --domoticz.devices(P1SmartMeterGas1).updateGas(CurrentGasQuantity).silent()
This is my setting for this:

Code: Select all

local CurrentElectricityFlowHoog = tonumber(jsonGasPower.dev_24.CurrentElectricityFlow )
local CurrentElectricityQuantityHoog = tonumber(jsonGasPower.dev_24.CurrentElectricityQuantity)
.............

Re: Controlling Toon [HACKED] from Domoticz

Posted: Tuesday 06 November 2018 23:16
by EdwinK
madpatrick wrote: Tuesday 06 November 2018 11:22 Did you comment this one out also

Code: Select all

        
        --domoticz.devices(P1SmartMeterPower).updateP1(CurrentElectricityQuantityLaag, CurrentElectricityQuantityHoog, CurrentElectricityFlowLaagDel, CurrentElectricityFlowHoogDel, CurrentElectricityQuantity, totalDeliveredPower).silent()
        --domoticz.devices(P1SmartMeterGas1).updateGas(CurrentGasQuantity).silent()
Yes, those are also commented out.
This is my setting for this:

Code: Select all

local CurrentElectricityFlowHoog = tonumber(jsonGasPower.dev_24.CurrentElectricityFlow )
local CurrentElectricityQuantityHoog = tonumber(jsonGasPower.dev_24.CurrentElectricityQuantity)
.............
Tried with .dev_22, and see no error's at the moment. Will let it run now and take a look at it tomorrow.

Re: Controlling Toon [HACKED] from Domoticz

Posted: Saturday 17 November 2018 21:57
by evanhaarst
Hi Maes and others,
I new to Domoticz, but I was glad to find it and especially this topic, hoping to control my Toon.
I've been reading through this topic and ik seems very nice (thanks for all the work!).

However, in the first step of your manual I got lost already. Variables are created. But then you wrote:
"Now create the proper devices".
I can't figure out where and how. Maybe the layout of Domoticz has changed since then?
So can you (or any other forum member) explain me under which menu/submenu I will find the option to create a device?
Thanks a lot

Re: Controlling Toon [HACKED] from Domoticz

Posted: Saturday 17 November 2018 22:22
by madpatrick
See “Hardware” and create the dummy devices

Re: Controlling Toon [HACKED] from Domoticz

Posted: Sunday 18 November 2018 8:31
by evanhaarst
Well thanks for trying, that's swift though short.
However, now I found in the long list of types the Dummy.
After the dummy is created I can choose switchtype.
Getting there slowly, I think.

Re: Controlling Toon [HACKED] from Domoticz

Posted: Sunday 18 November 2018 9:09
by madpatrick
check this site.
https://www.domoticaforum.eu/viewtopic. ... 97&start=0
There is a small manual which will guide you.

Re: Controlling Toon [HACKED] from Domoticz

Posted: Saturday 24 November 2018 17:54
by evanhaarst
Maes wrote: Tuesday 05 April 2016 21:23
EDIT:
[...]
ToonGetInfo

-- Handle json
--local json = assert(loadfile "C:\\Program Files (x86)\\Domoticz\\scripts\\lua\\json.lua")() -- For Windows
local json = assert(loadfile "/home/maes/domoticz/scripts/lua/JSON.lua")() -- For Linux
Okay, next step - I hope.
I have Domoticz installed on my Synology NAS. So that is Linux as I understand.
However, I can't find the proper directory path to that script JSON.lua.
I do have a directory home, of course no maes, but nowhere a subdirectory domoticz, while Domoticz is installed.
How and where can I find it?

The IP-address of Domoticz (plus the script/events section) is this: http://192.168.0.2:8084/#/Events Does that help?
Some suggestions?

Re: Controlling Toon [HACKED] from Domoticz

Posted: Saturday 24 November 2018 22:38
by madpatrick
Depending on your platform you can check if one is applicable.

Code: Select all

-- Choose the correct platform which Domoticz runs on
-- Remove -- before the line which applies for your situation, set -- for all other platforms
    json = assert(loadfile "/var/domoticz/scripts/lua/JSON.lua")()  -- For Linux (ClearOS)
--  json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Raspberry
--  json = assert(loadfile "/opt/domoticz/scripts/lua/JSON.lua")()  -- For Linux (LEDE)
--  json = assert(loadfile "C:\\Program Files (x86)\\Domoticz\\scripts\\lua\\json.lua")() -- For Windows
--  json = assert(loadfile "/volume1/@appstore/domoticz/var/scripts/lua/JSON.lua")() -- For Synology
Othewise you need to look in to the directories and find where Domoticz is installed

Re: Controlling Toon [HACKED] from Domoticz

Posted: Sunday 16 December 2018 21:45
by maikelvds
nt1nitro wrote: Sunday 18 March 2018 17:17 I was hoping someone can help me with the following error.

The error is after manual changing the setpoint in domoticz.

2018-03-18 17:04:22.630 dzVents: Info: ------ Start internal script: ToonSetPoint: Device: "Toon Thermostat (Toon Thermostat)", Index: 468
2018-03-18 17:04:22.631 dzVents: Error (2.4.1): An error occured when calling event handler ToonSetPoint
2018-03-18 17:04:22.631 dzVents: Error (2.4.1): ...oticz/scripts/dzVents/generated_scripts/ToonSetPoint.lua:8: attempt to perform arithmetic on field 'SetPoint' (a nil value)
2018-03-18 17:04:22.631 dzVents: Info: ------ Finished ToonSetPoint

Everything with the rooted toon is working EXCEPT manual changing the setpoint. The temp is not changing in the toon display, and after 1 minute the temp is back in domoticz to the previous temp.

I removed multiple times everything, also the variables. I'm using the dvenz scripts.
I have the same fault over here. The solution for this post is also not working for me. I don't know what is wrong in the script.
When I use the http it is working:

Code: Select all

http://192.168.2.1/happ_thermstat?action=setSetpoint&Setpoint=1950
What is wrong in:

Code: Select all

return {
	on = {
		devices = {
			'ToonThermostat'
		}
	},
	execute = function(domoticz, device)
		domoticz.openURL(string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', domoticz.variables('UV_ToonIP').value, device.Setpoint*100))
				domoticz.log('Setting Toon setpoint to '.. device.SetPoint)
	end
}
The UV_ToonThermostatSensorName variable is named 'ToonThermostat'.

Does anybody know how the fix the script?

Re: Controlling Toon [HACKED] from Domoticz

Posted: Sunday 16 December 2018 21:54
by madpatrick
Do you have a switch called “ToonThermostat” ?

In the original script it is calles Toon Thermostat”

Re: Controlling Toon [HACKED] from Domoticz

Posted: Sunday 16 December 2018 22:08
by maikelvds
Yes I have.
That was also my thought, also try to change it but no results..

Re: Controlling Toon [HACKED] from Domoticz

Posted: Sunday 16 December 2018 22:17
by madpatrick
You can also try the Lus script.
I can post my script, but this this adjusted with different (custom) names

Re: Controlling Toon [HACKED] from Domoticz

Posted: Monday 17 December 2018 22:04
by maikelvds
I used the lua before, but I remember something about errors in that script?

It is strange, because this DZvents script worked before. I don't know when it stopped working, because I don't use the function that much.. But it would be nice if it can work again...

Re: Controlling Toon [HACKED] from Domoticz

Posted: Monday 17 December 2018 22:28
by madpatrick
What i remember is that there an typo error in the script in this line somewhere...

This is what i have :

Code: Select all

 domoticz.openURL(string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', domoticz.variables('UV_ToonIP').value, device.setPoint*100)) 

Re: Controlling Toon [HACKED] from Domoticz

Posted: Monday 17 December 2018 22:36
by maikelvds
Yes, exactly..
I will get in to it later this week... I've moved everything from Rapberry 1 to Raspberry 2, maybe it has something to do with that.
For some strange reason my gas and electro usage are also not working anymore (gas since I moved, electro sinds yesterday evening..)

To be continued, thanks for now! :D

Re: Controlling Toon [HACKED] from Domoticz

Posted: Tuesday 18 December 2018 19:47
by maikelvds
madpatrick wrote: Monday 17 December 2018 22:28 What i remember is that there an typo error in the script in this line somewhere...

This is what i have :

Code: Select all

 domoticz.openURL(string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', domoticz.variables('UV_ToonIP').value, device.setPoint*100)) 
I copied your code and it is working right now... The difference: capital letter S. Your code: device.setPoint, my code: device.Setpoint

Don't know it was that accurate :lol:

So the code which is working for me:

Code: Select all

return {
	on = {
		devices = {
			'ToonThermostat'
		}
	},
	execute = function(domoticz, device)
    domoticz.openURL(string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', domoticz.variables('UV_ToonIP').value, device.setPoint*100)) 
	domoticz.log('Setting Toon setpoint to '.. device.setPoint)
	end
}
After I changed the first setPoint, the error came in line 9, domoticz.log. Changed that one also and everything works fine right now!
Thanks!

Re: Controlling Toon [HACKED] from Domoticz

Posted: Friday 21 December 2018 19:49
by RobbiHo
The same strange thing happened to me on my 5 day old fresh install on a Raspberry Pi 2B with Raspbian Stretch. It worked without any problems. Today I noticed the same failure in the logging.
Your solution worked for me. Thanks for posting.