Controlling Toon [HACKED] from Domoticz

For heating/cooling related questions in Domoticz
Johan1974
Posts: 14
Joined: Monday 04 December 2017 21:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Johan1974 » Friday 23 March 2018 12:25

glsf91 wrote:
Friday 23 March 2018 11:29
Johan1974 wrote:
Friday 23 March 2018 11:18

Code: Select all

-- JSON data from Toon contains a extra "," which should not be there.
ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")
I don't have these 2 lines. Try without them.

Otherwise add:

Code: Select all

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP))) 
just before this curl line. And try the printed string in the browser.
Can you sent me your script.? I will try that..

Johan1974
Posts: 14
Joined: Monday 04 December 2017 21:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Johan1974 » Friday 23 March 2018 12:33

Johan1974 wrote:
Friday 23 March 2018 12:25
glsf91 wrote:
Friday 23 March 2018 11:29
Johan1974 wrote:
Friday 23 March 2018 11:18

Code: Select all

-- JSON data from Toon contains a extra "," which should not be there.
ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")

When I do:

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))

in the browser, is the resultat:

{"result": "error", "error":"no handler for action 'getThermostatInfo', ToonIP)))'"}

glsf91
Posts: 38
Joined: Tuesday 14 November 2017 22:56
Target OS: Linux
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by glsf91 » Friday 23 March 2018 12:38

Johan1974 wrote:
Friday 23 March 2018 12:33

When I do:

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))

in the browser, is the resultat:

{"result": "error", "error":"no handler for action 'getThermostatInfo', ToonIP)))'"}
You have to put this print line in the script.
Then wait until the script executes and then the url is printed in the log. Try that printed url in the browser.

Johan1974
Posts: 14
Joined: Monday 04 December 2017 21:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Johan1974 » Friday 23 March 2018 12:54

glsf91 wrote:
Friday 23 March 2018 12:38
Johan1974 wrote:
Friday 23 March 2018 12:33

When I do:

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))

in the browser, is the resultat:

{"result": "error", "error":"no handler for action 'getThermostatInfo', ToonIP)))'"}
You have to put this print line in the script.
Then wait until the script executes and then the url is printed in the log. Try that printed url in the browser.

I have in the script now:

Code: Select all

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))    
local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
 
and the error is in the log:

Code: Select all

2018-03-23 11:52:40.965 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
2018-03-23 11:52:43.395 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
2018-03-23 11:52:50.875 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
2018-03-23 11:52:51.009 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'

glsf91
Posts: 38
Joined: Tuesday 14 November 2017 22:56
Target OS: Linux
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by glsf91 » Friday 23 March 2018 13:19

Johan1974 wrote:
Friday 23 March 2018 12:54
glsf91 wrote:
Friday 23 March 2018 12:38
Johan1974 wrote:
Friday 23 March 2018 12:33

When I do:

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))

in the browser, is the resultat:

{"result": "error", "error":"no handler for action 'getThermostatInfo', ToonIP)))'"}
You have to put this print line in the script.
Then wait until the script executes and then the url is printed in the log. Try that printed url in the browser.

I have in the script now:

Code: Select all

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))    
local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
 
and the error is in the log:

Code: Select all

2018-03-23 11:52:40.965 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
2018-03-23 11:52:43.395 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
2018-03-23 11:52:50.875 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
2018-03-23 11:52:51.009 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
Sorry, remove one ) at the end of the print line:

Code: Select all

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP))

Johan1974
Posts: 14
Joined: Monday 04 December 2017 21:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Johan1974 » Friday 23 March 2018 13:28

glsf91 wrote:
Friday 23 March 2018 13:19
Johan1974 wrote:
Friday 23 March 2018 12:54
glsf91 wrote:
Friday 23 March 2018 12:38


You have to put this print line in the script.
Then wait until the script executes and then the url is printed in the log. Try that printed url in the browser.

I have in the script now:

Code: Select all

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))    
local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
 
and the error is in the log:

Code: Select all

2018-03-23 11:52:40.965 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
2018-03-23 11:52:43.395 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
2018-03-23 11:52:50.875 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
2018-03-23 11:52:51.009 Error: EventSystem: in ToonGetInfo: [string "-- Time script runs every minute, intended to..."]:23: unexpected symbol near ')'
Sorry, remove one ) at the end of the print line:

Code: Select all

print(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP))
The same error.. :(

Code: Select all

2018-03-23 12:26:26.785 Error: EventSystem: Warning!, lua script ToonGetInfo has been running for more than 10 seconds

glsf91
Posts: 38
Joined: Tuesday 14 November 2017 22:56
Target OS: Linux
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by glsf91 » Friday 23 March 2018 13:33

Johan1974 wrote:
Friday 23 March 2018 13:28


The same error.. :(

Code: Select all

2018-03-23 12:26:26.785 Error: EventSystem: Warning!, lua script ToonGetInfo has been running for more than 10 seconds
What is the printed string ?

And try without this line:

Code: Select all

ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")

Johan1974
Posts: 14
Joined: Monday 04 December 2017 21:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Johan1974 » Friday 23 March 2018 14:12

glsf91 wrote:
Friday 23 March 2018 13:33
Johan1974 wrote:
Friday 23 March 2018 13:28


The same error.. :(

Code: Select all

2018-03-23 12:26:26.785 Error: EventSystem: Warning!, lua script ToonGetInfo has been running for more than 10 seconds
What is the printed string ?

And try without this line:

Code: Select all

ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")
Without that line, same error:

Code: Select all

2018-03-23 13:10:54.466 Error: EventSystem: Warning!, lua script ToonGetInfo has been running for more than 10 seconds

Johan1974
Posts: 14
Joined: Monday 04 December 2017 21:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Johan1974 » Friday 23 March 2018 15:18

Johan1974 wrote:
Friday 23 March 2018 14:12
glsf91 wrote:
Friday 23 March 2018 13:33
Johan1974 wrote:
Friday 23 March 2018 13:28


The same error.. :(

Code: Select all

2018-03-23 12:26:26.785 Error: EventSystem: Warning!, lua script ToonGetInfo has been running for more than 10 seconds
What is the printed string ?

And try without this line:

Code: Select all

ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")
Without that line, same error:

Code: Select all

2018-03-23 13:10:54.466 Error: EventSystem: Warning!, lua script ToonGetInfo has been running for more than 10 seconds
And this is the message if I change the temp to 20 degrees:

Code: Select all

2018-03-23 14:05:25.535 User: Johan initiated a SetPoint command
2018-03-23 14:05:25.650 dzVents: Setting Toon setpoint to 22.00
2018-03-23 14:05:25.651 EventSystem: Fetching url...
2018-03-23 14:05:25.651 EventSystem: Script event triggered: ToonSetPoint
2018-03-23 14:05:25.660 dzVents: curl http://192.168.1.36/happ_thermstat?action=getThermostatInfo
2018-03-23 14:05:25.751 dzVents: Updating thermostat sensor to new set point: 20
2018-03-23 14:05:25.751 dzVents: Updating Toon burner info
2018-03-23 14:05:25.753 EventSystem: Sending SetPoint to device....
2018-03-23 14:05:35.656 Error: EventSystem: Warning!, lua script ToonGetInfo has been running for more than 10 seconds

Johan1974
Posts: 14
Joined: Monday 04 December 2017 21:56
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Johan1974 » Friday 23 March 2018 22:51

I saved ToonGetInfo in the events as TIME, and ToonSetPoint as DEVICE..
Now is Domoticz not freezing, and it works perfect..

Sometime's I see at the log the message:

Code: Select all

Error: EventSystem: Warning!, lua script ToonGetInfo has been running for more than 10 seconds

But it is working now better.

Thanks for your help glsf91 !!! :D :D :D :D

maikelvds
Posts: 5
Joined: Monday 19 March 2018 16:16
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by maikelvds » Thursday 29 March 2018 21:15

FunFair wrote:
Tuesday 20 March 2018 8:24
The php script doesnt need names. Only idxnumbers.
What is the output when you manually run the script?
Is the script executable?
When I run "chmod +x /home/pi/domoticz/scripts/p1_meter/gas_data_json.php" in Putty, I go directly to the next line. So no fault or something, is that correct? I don't see anything further...

When I run in manually:
pi@raspberrypi:~/domoticz/scripts/p1_meter$ ./gas_data_json.php
-bash: ./gas_data_json.php: /usr/bin/php: bad interpreter: No such file or directory
pi@raspberrypi:~/domoticz/scripts/p1_meter$ sudo ./gas_data_json.php
sudo: unable to execute ./gas_data_json.php: No such file or directory
I installed php5-curl... is that the problem maybe?

maikelvds
Posts: 5
Joined: Monday 19 March 2018 16:16
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by maikelvds » Thursday 29 March 2018 22:33

maikelvds wrote:
Thursday 29 March 2018 21:15
I installed php5-curl... is that the problem maybe?
I re-installed this, and also installed php5 (Without curl)....
Now it is working!!

patzzz
Posts: 4
Joined: Friday 06 April 2018 23:19
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by patzzz » Friday 06 April 2018 23:23

I own a Toon which is now without a Eneco subscription. Now, I was wondering whether it is possible to use the Toon the other way around; so controlling Domoticz from my Toon.
Because after all I do like the form factor, touch screen et cetera from the Toon unit.
Please advice, thanks.

FunFair
Posts: 37
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair » Sunday 08 April 2018 21:27

patzzz wrote:
Friday 06 April 2018 23:23
I own a Toon which is now without a Eneco subscription. Now, I was wondering whether it is possible to use the Toon the other way around; so controlling Domoticz from my Toon.
Because after all I do like the form factor, touch screen et cetera from the Toon unit.
Please advice, thanks.

If your Toon is rooted you can use this.
https://www.domoticaforum.eu/viewtopic. ... 35bf881dfd

if not, root your Toon first :)

jozg
Posts: 4
Joined: Friday 09 December 2016 12:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by jozg » Monday 09 April 2018 13:20

Hello All,

I'm using a script to get the temperature from the toon into domoticz from this forum.
I've tried different type of scripts DZVents and also LUA.

But sometimes, my toon is losing it's wifi connection, wich is not a problem for me.
The only thing is that the script is freezing domoticz with this error log: Error: EventSystem: Warning!, lua script GJK_Script_toon_OK has been running for more than 10 seconds.

The biggest problem is, that domoticz freezes up, until the wifi connection from the Toon is restored.
within the freeze i cannot switch my lights anymore, and that's a problem ;-)

Is there a way to make the script failsafe over a disconnected toon?.

Thanks for helping.

Regards,

glsf91
Posts: 38
Joined: Tuesday 14 November 2017 22:56
Target OS: Linux
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by glsf91 » Monday 09 April 2018 17:29

jozg wrote:
Monday 09 April 2018 13:20
But sometimes, my toon is losing it's wifi connection, wich is not a problem for me.
The only thing is that the script is freezing domoticz with this error log: Error: EventSystem: Warning!, lua script GJK_Script_toon_OK has been running for more than 10 seconds.

The biggest problem is, that domoticz freezes up, until the wifi connection from the Toon is restored.
within the freeze i cannot switch my lights anymore, and that's a problem ;-)

Is there a way to make the script failsafe over a disconnected toon?.
Yes, with https://www.domoticz.com/wiki/DzVents:_ ... P_requests

Or make a 2 stage process:
1. get data in background process
2. process data

Example:

Code: Select all

-- This script retrieves data from the Internet without risking to lock the Domoticz event system.

local ResultFile = '/var/tmp/tmpknmi.txt' -- Temporary file to store the servers response
local fetchIntervalMins = 5 -- (Integer) (Minutes, Range 5-60) How often the data shall be retrieved 
local scriptVersion = '1.0.0'
local station = 267
local meanTemperatureInside = 18

local function round(num, idp)
   local mult = 10^(idp or 0)
   return math.floor(num * mult + 0.5) / mult
end

return {
	active = true,
	logging = {
		level = domoticz.LOG_INFO, -- Uncomment to override the dzVents global logging setting
		marker = 'Graaddagen '..scriptVersion
	},
	on = {
		timer = {   'at 6:05-6:07',
		            'at 7:05-7:07',
		            'at 8:05-8:07',
		            'at 9:05-9:07',
		            'at 10:05-10:07',
		            'at 11:05-11:07',
		            'at 12:05-12:07',
		            'at 13:05-13:07',
		            'at 14:05-14:07',
		            'at 15:05-15:07',
		            'at 16:05-16:07',
		            'at 17:05-17:07'
		    } -- warning: don't change the last number 5 and 7; at every minute just for debugging
	},
	execute = function(domoticz, device)

	    -- Only update if last update is yesterday
	    if ( domoticz.devices('Graaddagen').lastUpdate.hoursAgo <= 12 ) then
	        domoticz.log('Update already done today, end script', domoticz.LOG_INFO)
            return	        
	    end
	    
		-- Every 5 minutes, call the URL and exit.
		-- The following minute, return to read the result file 
		local callUrl = false
		if (os.date('*t').min % fetchIntervalMins) == 0 then
			callUrl = true
		elseif ((os.date('*t').min -1) % fetchIntervalMins) ~= 0 then
			--return
		end
        
        previousday = os.date('%Y%m%d', os.time() - 60*60*24)
        
		if callUrl then
			local url = 'http://projects.knmi.nl/klimatologie/daggegevens/getdata_dag.cgi'
			startdate = os.date('%Y%m%d', os.time() - 2*60*60*24)
			local data = 'vars=TG&start='..startdate..'&end='..previousday..'&stns='..station
			domoticz.log('Requesting data from the knmi server...', domoticz.LOG_INFO)
			domoticz.log('URL used: '..url, domoticz.LOG_DEBUG)
			domoticz.log('DATA used: '..data, domoticz.LOG_DEBUG)
			os.execute('curl --data "'..data..'" -s "'..url..'" > '..ResultFile..'&')
			return -- Nothing more to do for now, we'll be back in a minute to read the data!
		end

		---loads a json file with the provided name and returns it as a table (if it exists)
		local function readLuaFromFile(fileName)

		    local month = tonumber(os.date('%m'))
		    if ((month >= 4) and (month <= 9)) then
		        weegfactor = 0.8
		    elseif ((month == 3) or (month == 10)) then
		        weegfactor = 1.0
            else 
                weegfactor = 1.1 		    
            end    
			local file = io.open(fileName, 'r')
			if file then
        	    while true do 
                    local line = file:read("*line")
                    if not line then break end
                    if debug then domoticz.log('Line:'..line, domoticz.LOG_DEBUG) end
                    -- skip lines starting with #
                    if not string.find(line, "#", 1) then
                        linestation, linedate, linegraden = string.match(tostring(line), '([0-9]*),([0-9]*), *([-0-9]*)')
                        domoticz.log('linestation:'..linestation, domoticz.LOG_DEBUG)
                        domoticz.log('linedate:'..linedate, domoticz.LOG_DEBUG)
                        domoticz.log('linegraden:'..linegraden, domoticz.LOG_DEBUG)
                        graden = tonumber(linegraden)/10
                        domoticz.log('graden:'..graden, domoticz.LOG_DEBUG)

            			difference = os.difftime (linedate,previousday)
                        domoticz.log('previousday:'..previousday, domoticz.LOG_DEBUG)
                        domoticz.log('difference date:'..difference, domoticz.LOG_DEBUG)
	                    -- get only line from yesterday
                        if (difference == 0 ) then
                            io.close(file)
                            if graden >= meanTemperatureInside then
                                return 0 
                            end
                            return round((meanTemperatureInside - graden) * weegfactor,0)
                        end
 
                    end
                end			    
				io.close(file)
			end
			return nil
		end

		local graadgraden = readLuaFromFile(ResultFile)
		if not graadgraden then
			domoticz.log('Could not read data from file or not data for yesterday available: '.. ResultFile, domoticz.LOG_ERROR)
			return
		end
		domoticz.log('Result graaddagen: '..graadgraden, domoticz.LOG_INFO)
		--domoticz.devices('Graaddagen').dump()
		domoticz.devices('Graaddagen').updateCustomSensor(graadgraden)
	end
}

jozg
Posts: 4
Joined: Friday 09 December 2016 12:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by jozg » Monday 09 April 2018 20:54

Hello Glsf,

I'm trying to get the openurl working in the given script from this forum, but i'm no scripter ;-)
This is the script i use, and the 2 lines with -- in front, that's a try from me to get it working, but it's not.
When i uncomment this line: local handle = assert(io.popen(string.format(domoticz.openURL('http://192.168.1.75/happ_thermstat?acti ... mostatInfo'))))

i receive errors:
2018-04-09 20:50:00.182 Error: dzVents: Error: /home/pi/domoticz/scripts/dzVents/generated_scripts/GJK.lua:22: bad argument #1 to 'format' (string expected, got no value)

Can you please look at the script?.

Code: Select all

return {
	on = {
		timer = {
			'every minute'
		}
	},
	execute = function(domoticz)
        local ToonThermostatSensorName = domoticz.variables('UV_ToonThermostatSensorName').value -- Sensor showing current setpoint
        local ToonTemperatureSensorName = domoticz.variables('UV_ToonTemperatureSensorName').value -- Sensor showing current room temperature
        local ToonScenesSensorName  = domoticz.variables('UV_ToonScenesSensorName').value -- Sensor showing current program
        local ToonAutoProgramSensorName = domoticz.variables('UV_ToonAutoProgramSensorName').value -- Sensor showing current auto program status
        local ToonProgramInformationSensorName = domoticz.variables('UV_ToonProgramInformationSensorName').value -- Sensor showing displaying program information status
        local ToonIP = domoticz.variables('UV_ToonIP').value
        local DomoticzIP = domoticz.variables('UV_DomoticzIP').value
    
        -- Handle json
        --local json = assert(loadfile "C:\\Program Files (x86)\\Domoticz\\scripts\\lua\\json.lua")()  -- For Windows
        local json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux
        
        local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
--          local handle = assert(domoticz.openURL('http://192.168.1.75/happ_thermstat?action=getThermostatInfo')) 
--        local handle = assert(io.popen(string.format(domoticz.openURL('http://192.168.1.75/happ_thermstat?action=getThermostatInfo'))))
        local ThermostatInfo = handle:read('*all')
        handle:close()
        
        local jsonThermostatInfo = json:decode(ThermostatInfo)
        
        if jsonThermostatInfo == nil then
            return
        end
        
        local currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
        local currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
        local currentProgramState = tonumber(jsonThermostatInfo.programState)
            if currentProgramState == 0 then currentProgramState = 10 -- No
                elseif currentProgramState == 1 then currentProgramState = 20 -- Yes
                elseif currentProgramState == 2 then currentProgramState = 30 -- Temporary       
            end      
        local currentActiveState = tonumber(jsonThermostatInfo.activeState)
            if currentActiveState == -1 then currentActiveState = 50 -- Manual
                elseif currentActiveState == 0 then currentActiveState = 40 -- Comfort
                elseif currentActiveState == 1 then currentActiveState = 30 -- Home
                elseif currentActiveState == 2 then currentActiveState = 20 -- Sleep
                elseif currentActiveState == 3 then currentActiveState = 10 -- Away
            end
        local currentNextTime = jsonThermostatInfo.nextTime
        local currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
        local currentBoiletSetPoint = jsonThermostatInfo.currentInternalBoilerSetpoint
        ----
        
        -- Update the thermostat sensor to current setpoint
        if domoticz.devices(ToonThermostatSensorName).setPoint*100 ~= currentSetpoint*100 then
            domoticz.log('Updating thermostat sensor to new set point: ' ..currentSetpoint)
            domoticz.devices(ToonThermostatSensorName).updateSetPoint(currentSetpoint).silent()
        end
        

        -- Update the temperature sensor to current room temperature
--        if domoticz.round(domoticz.devices(ToonTemperatureSensorName).temperature, 1) ~= domoticz.round(currentTemperature, 1) then 
            domoticz.log('Updating the temperature sensor to new value: ' ..currentTemperature)
            domoticz.devices(ToonTemperatureSensorName).updateTemperature(currentTemperature)
--        end
        
        -- Update the toon scene selector sensor to current program state
        if domoticz.devices(ToonScenesSensorName).level ~= currentActiveState then  -- Update toon selector if it has changed
            domoticz.log('Updating Toon Scenes selector to: '..currentActiveState)
            domoticz.devices(ToonScenesSensorName).switchSelector(currentActiveState).silent()
        end
        
        -- Updates the toon auto program switch 
        if domoticz.devices(ToonAutoProgramSensorName).level ~= currentProgramState then -- Update toon auto program selector if it has changed
            domoticz.log('Updating Toon Auto Program selector to: '..currentProgramState)
            domoticz.devices(ToonAutoProgramSensorName).switchSelector(currentProgramState).silent()
        end
        
        -- Updates the toon program information text box
        if currentNextTime == 0 or currentNextSetPoint == 0 then
            ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
        else
            ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
        end
        
        if domoticz.devices(ToonProgramInformationSensorName).text ~= ToonProgramInformationSensorValue then
            domoticz.log('Updating Toon Program Information to: '..ToonProgramInformationSensorValue)
            domoticz.devices(ToonProgramInformationSensorName).updateText(ToonProgramInformationSensorValue)
        end
	end
}
Thanks.

Regards,

Smiggel
Posts: 17
Joined: Friday 23 March 2018 18:29
Target OS: -
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Smiggel » Wednesday 11 April 2018 7:52

Hi,

I am have a secondhand toon at home. And when I boot the device I notice I have to activate it. I think the Toon was set to factory defaults. I can not do anything with it now.

Will this script unlock/activate my Toon as well?

FunFair
Posts: 37
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair » Saturday 14 April 2018 6:53

Smiggel wrote:
Wednesday 11 April 2018 7:52
Hi,

I am have a secondhand toon at home. And when I boot the device I notice I have to activate it. I think the Toon was set to factory defaults. I can not do anything with it now.

Will this script unlock/activate my Toon as well?
This script is for rooted toons. You can't activate it with this. If you havent rooted your toon call eneco.
If they wont help visit https://www.domoticaforum.eu/viewforum.php?f=87 and root it. Then you can manually activate it by changing some files.

Smiggel
Posts: 17
Joined: Friday 23 March 2018 18:29
Target OS: -
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Smiggel » Tuesday 17 April 2018 20:04

FunFair wrote:
Saturday 14 April 2018 6:53
Smiggel wrote:
Wednesday 11 April 2018 7:52
Hi,

I am have a secondhand toon at home. And when I boot the device I notice I have to activate it. I think the Toon was set to factory defaults. I can not do anything with it now.

Will this script unlock/activate my Toon as well?
This script is for rooted toons. You can't activate it with this. If you havent rooted your toon call eneco.
If they wont help visit https://www.domoticaforum.eu/viewforum.php?f=87 and root it. Then you can manually activate it by changing some files.
Thanks! Will look into it. :-)

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests