Controlling Toon via Domoticz

Everything about external control, apps, VNC, etc goes here.

Moderators: marcelr, TheHogNL, Toonz

Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Controlling Toon via Domoticz

Post by Ierlandfan »

Did you install ToonStore app "Boilerstatus"?

I am quite sure you're missing that part. That App creates the boilervalues.txt on Toon.
The error says that boilervalues.txt is not found. (404, Not found)
driesk
Starting Member
Starting Member
Posts: 9
Joined: Mon Oct 20, 2014 2:33 pm

Re: Controlling Toon via Domoticz

Post by driesk »

Would it be possible to show 'zon op toon' information in domoticz?
yjb
Member
Member
Posts: 209
Joined: Fri Apr 17, 2009 1:15 pm
Location: Venhuizen, Netherlands

Re: Controlling Toon via Domoticz

Post by yjb »

Yes, that should be possible. It's actually one of the items on my to-do list.

The concept is simple as you have to do it in the same way as the other P1 readout's.

In my case (toon2) the device is dev_3.3 ("HAE_METER_v3_3")
madpatrick
Member
Member
Posts: 100
Joined: Wed Dec 06, 2017 9:52 pm
Location: Zuid-Holland

Re: Controlling Toon via Domoticz

Post by madpatrick »

driesk wrote:Would it be possible to show 'zon op toon' information in domoticz?
Check my
Revious post in this thread.
In this script you can find the part for energy return with dev_xx
Not quite Zon on Toon, but nice to have
TerrorSource
Administrator
Administrator
Posts: 494
Joined: Thu May 04, 2017 9:28 pm

Re: Controlling Toon via Domoticz

Post by TerrorSource »

mAiden wrote:
TerrorSource wrote:
madpatrick wrote:Hi,

I've the script working for a long period on my Toon 2
Maybe this can help.
Please be aware that i've changed the names of the variables etc... for easy reading ;-)
What Device id's should i use?
This is the output of getDevices.json:

Code: Select all

{"dev_settings_device": {"uuid": "fbd78ce3-44a3-4064-bf15-3dac7fa35a6f", "name": "settings_device", "internalAddress": "settings_device", "type": "settings_device"}, "dev_3": {"uuid": "a211f771-6e68-497a-8205-f56ebcf65793", "name": "HAE_METER_v3", "internalAddress": "3", "type": "HAE_METER_v3", "supportsCrc": "1", "ccList": "5e 86 72 32 56 5a 59 85 73 7a 60 8e 22 70 8b 3c 3d 3e", "supportedCC": "5e 86 72 32 56 5a 59 85 73 7a 60 8e 22 70 8b 3c 3d 3e", "nodeFlags": [], "IsConnected": "1", "HealthValue": "10", "DeviceName": "HAE_METER_v3"}, "dev_3.1": {"uuid": "2c152d56-d608-4d28-8c33-2ea0355e8948", "name": "HAE_METER_v3_1", "internalAddress": "3.1", "type": "gas", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentGasFlow": "52.00", "CurrentGasQuantity": "1028744.00", "DeviceName": "HAE_METER_v3_1"}, "dev_3.2": {"uuid": "8239e6a6-a7b6-400d-9de0-4d86ae281f4a", "name": "HAE_METER_v3_2", "internalAddress": "3.2", "type": "elec", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "NaN", "CurrentElectricityQuantity": "NaN", "DeviceName": "HAE_METER_v3_2"}, "dev_3.3": {"uuid": "7a1c0810-b9af-415d-bd3c-0979af6676e1", "name": "HAE_METER_v3_3", "internalAddress": "3.3", "type": "elec_solar", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "NaN", "CurrentElectricityQuantity": "NaN", "DeviceName": "HAE_METER_v3_3"}, "dev_3.4": {"uuid": "aa539bb2-0096-4627-b1a3-2504e5c0cd36", "name": "HAE_METER_v3_4", "internalAddress": "3.4", "type": "elec_delivered_nt", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "3973551.00", "DeviceName": "HAE_METER_v3_4"}, "dev_3.5": {"uuid": "1d138f8c-2da8-4618-ab52-bf6281e12c41", "name": "HAE_METER_v3_5", "internalAddress": "3.5", "type": "elec_received_nt", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "7854368.00", "DeviceName": "HAE_METER_v3_5"}, "dev_3.6": {"uuid": "c9f9be9b-8f4e-4055-b267-4ab93a01d25e", "name": "HAE_METER_v3_6", "internalAddress": "3.6", "type": "elec_delivered_lt", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "372.00", "CurrentElectricityQuantity": "5301825.00", "DeviceName": "HAE_METER_v3_6"}, "dev_3.7": {"uuid": "0951d682-cb2f-4074-a4de-ca6bafa244ac", "name": "HAE_METER_v3_7", "internalAddress": "3.7", "type": "elec_received_lt", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "3328551.00", "DeviceName": "HAE_METER_v3_7"}, "dev_3.8": {"uuid": "2f958e23-8475-48a4-bd26-ed9f539721ca", "name": "HAE_METER_v3_8", "internalAddress": "3.8", "type": "heat", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentHeatQuantity": "NaN", "DeviceName": "HAE_METER_v3_8"}}
dev3_1 is gas
dev3_6 is elec
In my json output is:
v3_1
v3_6

but in the script it is under "-- domoticz.log(jsonGasPower)":
dev_44
dev_46

What lay-out should i use?
MarcF
Starting Member
Starting Member
Posts: 4
Joined: Fri Mar 08, 2019 8:49 pm

Re: Controlling Toon via Domoticz

Post by MarcF »

Hello mAiden, TerrorSource

In the output json output file replace ',' with a ', \n' in notepad++ (CTRL+H, make sure you use the extended option in the search method )

You will get:

Code: Select all

{"dev_settings_device": {"uuid": "fbd78ce3-44a3-4064-bf15-3dac7fa35a6f",
 "name": "settings_device",
 "internalAddress": "settings_device",
 "type": "settings_device"},
 "dev_3": {"uuid": "a211f771-6e68-497a-8205-f56ebcf65793",
 "name": "HAE_METER_v3",
 "internalAddress": "3",
 "type": "HAE_METER_v3",
 "supportsCrc": "1",
 "ccList": "5e 86 72 32 56 5a 59 85 73 7a 60 8e 22 70 8b 3c 3d 3e",
 "supportedCC": "5e 86 72 32 56 5a 59 85 73 7a 60 8e 22 70 8b 3c 3d 3e",
 "nodeFlags": [],
 "IsConnected": "1",
 "HealthValue": "10",
 "DeviceName": "HAE_METER_v3"},
 "dev_3.1": {"uuid": "2c152d56-d608-4d28-8c33-2ea0355e8948",
 "name": "HAE_METER_v3_1",
 "internalAddress": "3.1",
 "type": "gas",
 "supportsCrc": "0",
 "ccList": "5e 59 85 8e 3c 3d 3e",
 "supportedCC": "5e 59 85 8e 3c 3d 3e",
 "nodeFlags": [],
 "CurrentGasFlow": "52.00",
 "CurrentGasQuantity": "1028744.00",
 "DeviceName": "HAE_METER_v3_1"},
 "dev_3.2": {"uuid": "8239e6a6-a7b6-400d-9de0-4d86ae281f4a",
 "name": "HAE_METER_v3_2",
 "internalAddress": "3.2",
 "type": "elec",
 "supportsCrc": "0",
 "ccList": "5e 59 85 8e 3c 3d 3e",
 "supportedCC": "5e 59 85 8e 3c 3d 3e",
 "nodeFlags": [],
 "CurrentElectricityFlow": "NaN",
 "CurrentElectricityQuantity": "NaN",
 "DeviceName": "HAE_METER_v3_2"},
 "dev_3.3": {"uuid": "7a1c0810-b9af-415d-bd3c-0979af6676e1",
 "name": "HAE_METER_v3_3",
 "internalAddress": "3.3",
 "type": "elec_solar",
 "supportsCrc": "0",
 "ccList": "5e 59 85 8e 3c 3d 3e",
 "supportedCC": "5e 59 85 8e 3c 3d 3e",
 "nodeFlags": [],
 "CurrentElectricityFlow": "NaN",
 "CurrentElectricityQuantity": "NaN",
 "DeviceName": "HAE_METER_v3_3"},
 "dev_3.4": {"uuid": "aa539bb2-0096-4627-b1a3-2504e5c0cd36",
 "name": "HAE_METER_v3_4",
 "internalAddress": "3.4",
 "type": "elec_delivered_nt",
 "supportsCrc": "0",
 "ccList": "5e 59 85 8e 3c 3d 3e",
 "supportedCC": "5e 59 85 8e 3c 3d 3e",
 "nodeFlags": [],
 "CurrentElectricityFlow": "0.00",
 "CurrentElectricityQuantity": "3973551.00",
 "DeviceName": "HAE_METER_v3_4"},
 "dev_3.5": {"uuid": "1d138f8c-2da8-4618-ab52-bf6281e12c41",
 "name": "HAE_METER_v3_5",
 "internalAddress": "3.5",
 "type": "elec_received_nt",
 "supportsCrc": "0",
 "ccList": "5e 59 85 8e 3c 3d 3e",
 "supportedCC": "5e 59 85 8e 3c 3d 3e",
 "nodeFlags": [],
 "CurrentElectricityFlow": "0.00",
 "CurrentElectricityQuantity": "7854368.00",
 "DeviceName": "HAE_METER_v3_5"},
 "dev_3.6": {"uuid": "c9f9be9b-8f4e-4055-b267-4ab93a01d25e",
 "name": "HAE_METER_v3_6",
 "internalAddress": "3.6",
 "type": "elec_delivered_lt",
 "supportsCrc": "0",
 "ccList": "5e 59 85 8e 3c 3d 3e",
 "supportedCC": "5e 59 85 8e 3c 3d 3e",
 "nodeFlags": [],
 "CurrentElectricityFlow": "372.00",
 "CurrentElectricityQuantity": "5301825.00",
 "DeviceName": "HAE_METER_v3_6"},
 "dev_3.7": {"uuid": "0951d682-cb2f-4074-a4de-ca6bafa244ac",
 "name": "HAE_METER_v3_7",
 "internalAddress": "3.7",
 "type": "elec_received_lt",
 "supportsCrc": "0",
 "ccList": "5e 59 85 8e 3c 3d 3e",
 "supportedCC": "5e 59 85 8e 3c 3d 3e",
 "nodeFlags": [],
 "CurrentElectricityFlow": "0.00",
 "CurrentElectricityQuantity": "3328551.00",
 "DeviceName": "HAE_METER_v3_7"},
 "dev_3.8": {"uuid": "2f958e23-8475-48a4-bd26-ed9f539721ca",
 "name": "HAE_METER_v3_8",
 "internalAddress": "3.8",
 "type": "heat",
 "supportsCrc": "0",
 "ccList": "5e 59 85 8e 3c 3d 3e",
 "supportedCC": "5e 59 85 8e 3c 3d 3e",
 "nodeFlags": [],
 "CurrentHeatQuantity": "NaN",
 "DeviceName": "HAE_METER_v3_8"}}
A more readable file.

Your device is:
dev_3

Your GAS is:
dev_3.1

Your Electra is:
dev_3.4
dev_3.5
dev_3.6
dev_3.7

Check the values in 'CurrentElectricityQuantity' which device you need for the 'laag' and 'hoog'. You need to use 'dev_31' without the '.' between the 3 and 1
MarcF
Starting Member
Starting Member
Posts: 4
Joined: Fri Mar 08, 2019 8:49 pm

Re: Controlling Toon via Domoticz

Post by MarcF »

To All,

Based on the manual from TerrorSource domoticaforum.eu/viewtopic.php?f=102&am ... mp;t=12097 and BOverdevest domoticaforum.eu/viewtopic.php?f=102&am ... p;start=15 I created 2 files.

// STARTING
Download the manual from TerrorSource, base topic page 1. This Manual explains how you create virtual sensors and define User Variables
The Virtual sensors (Devices) and User Variables you create need to have the EXACT value that is used within the scripts. If this doesn't match, the scripts won't work

To help you out, here is some helpfull data for setting up the Toon <=> Domoticz connection with the proces described by TerrorSource and the script from BOverdevest

NOTE: Download notepad++ if you don;y have it allready. It's free and very usefull! You can use it to replace some parts in the files (personal config settings)

Code: Select all

// Refwerence to Base forum topics with manual and scripts
https://www.domoticaforum.eu/viewtopic.php?f=102&t=12097
https://www.domoticaforum.eu/viewtopic.php?f=102&t=12097&start=15

// User Variables
UV_ToonThermostat				ToonThermostat
UV_ToonTemperature				ToonTemperature
UV_ToonBoilerTempIn				ToonBoilerTempIn
UV_ToonBoilerTempOut			ToonBoilerTempOut
UV_ToonBoilerPressure			ToonBoilerPressure
UV_ToonBoilerModulation			ToonBoilerModulation
UV_ToonScenes					ToonScenes
UV_ToonAutoProgram				ToonAutoProgram
UV_ToonProgramInformation		ToonProgramInformation
UV_ToonIP						ToonIP
UV_DomoticzIP					DomoticzIP
UV_ToonBurnerName				ToonBurnerName
UV_P1SmartMeterElectra			P1SmartMeterPower
UV_P1SmartMeterGasMeterStand	P1SmartMeterGas
UV_ToonBoilerTempSetpoint		ToonBoilerSetpoint
		
		
// DEVICES
ToonThermostat					Thermostat			SetPoint
ToonTemperature					Temperature			LaCrosse TX3
ToonBoilerTempIn				Temperature			LaCrosse TX3
ToonBoilerTempOut				Temperature			LaCrosse TX3
ToonBoilerPressure				General				Pressure
ToonBoilerModulation			General				Percentage
ToonScenes						Light/Switch		Selector Switch
ToonAutoProgram					Light/Switch		Selector Switch
ToonProgramInformation			General				Text
ToonIP							General				Text
DomoticzIP						General				Text
ToonBurnerName					Light/Switch		Selector Switch
P1SmartMeterPower				P1 Smart Meter		Energy
P1SmartMeterGas					P1 Smart Meter		Gas
ToonBoilerSetpoint				Temperature			LaCrosse TX3

// Make sure you enabled LUA/DzVents in 
// Setup => Settings => choose tab 'Other' => EventSystem


// LINKS
// Change the following in this file:
// <ToonIP> with your Toon IP adress
// <DomoticzIP:Port> with your Domoticz IP adress and port used (e.g. 192.168.2.100:8080)
// <IDXnr> with the IDX number of your Toon Device (Setup => Devices, Idx column)
http://<IP_TOON>/happ_thermstat?action=getThermostatInfo
http://<DomoticzIP:Port>/json.htm?type=command&param=udevice&idx=<IDXnr>&nvalue=0&svalue=<IP_TOON>

// Usefull links
http://<IP_TOON>/hdrv_zwave?action=getDevices.json
// Test Toon SET communication if you need to check communication to the Toon
http://<IP_TOON>/happ_thermstat?action=changeSchemeState&state=2&temperatureState=0


// Switch settings
Go to "Swithes" in the Domoticz menu

Select “ToonAutoProgram” => “Edit” .
Set “Hide Off Level” to“OFF”.
Change “Level Names”:
0 Off
10 No
20 Yes
30 Temporary

Change the “Level Action”
0
10 http://<IP_TOON>/happ_thermstat?action=changeSchemeState&state=0
20 http://<IP_TOON>/happ_thermstat?action=changeSchemeState&state=1
30
Press "Save" to save the changes

Select “ToonScenes” => “Edit” .
Set “Hide Off Level” to“OFF”.
Change “Level Names”:
0 Off
10 Away
20 Sleep
30 Home
40 Comfort
50 Manual

Change the “Level Action”
0
10 http://<IP_TOON>/happ_thermstat?action=changeSchemeState&state=2&temperatureState=3
20 http://<IP_TOON>/happ_thermstat?action=changeSchemeState&state=2&temperatureState=2
30 http://<IP_TOON>/happ_thermstat?action=changeSchemeState&state=2&temperatureState=1
40 http://<IP_TOON>/happ_thermstat?action=changeSchemeState&state=2&temperatureState=0
50 http://<IP_TOON>/happ_thermstat?action=setSetpoint&Setpoint=60
Press "Save" to save the changes

Select “ToonBranderInfo” => “Edit”.
Set “Hide Off Level” to“OFF”.
Change “Level Names”:
0 Off
10 CV
20 WW
Press "Save" to save the changes
When all is set up, you can use this script. Please also note the remarks in the top part to update some parts of the script to make it match your situation

Code: Select all

return {
   on = {
      timer = {
		-- Run script every minute
         'every minute'
      }
   },
   execute = function(domoticz)
		--
		-- Define local variables. UV_* needs to be creates within Domoticz with exact same name!
		-- Replace the following strings with a find and replace function to
		-- customize this script to your personal installation
		-- replace <IP_TOON> with your Toon IP adres
		-- Check dev_* numbers on your Toon with http://<IP_TOON>/hdrv_zwave?action=getDevices.json
		-- Copy paste the output from your browser in Notepad++ and replace the ',' with ', \n'. Make sure in search method the extended option is activeState
		-- Find the GAS and ELECTRICITY values. Check these with your actual meters to determine which dev_* is your low / high value
		-- Enter the dev values without extra '.' So 'dev_3.3' becomes 'dev_33' in this script 
		-- Change the 'dev' numbers accordingly to your settings in the section marked: START UPDATE SECTION
		-- Save this script as a dzVents Device script in SETUP => MORE OPTIONS => EVENTS Press the '+' tab.
		-- Delete the code in the new file and replace with this entire code. Save the file
		-- Check the SETUP => LOG for events
		-- 
        local ToonThermostat        = domoticz.variables('UV_ToonThermostat').value -- Sensor showing current setpoint
        local ToonTemperature       = domoticz.variables('UV_ToonTemperature').value -- Sensor showing current room temperature
        local ToonBoilerTempIn      = domoticz.variables('UV_ToonBoilerTempIn').value -- Sensor showing water temp return
        local ToonBoilerTempOut     = domoticz.variables('UV_ToonBoilerTempOut').value -- Sensor showing current water temp out
        local ToonBoilerPressure    = domoticz.variables('UV_ToonBoilerPressure').value -- Sensor showing current room temperature
        local ToonBoilerModulation  = domoticz.variables('UV_ToonBoilerModulation').value -- Sensor showing current Boiler Modulation
        local ToonScenes            = domoticz.variables('UV_ToonScenes').value -- Sensor showing current program
        local ToonAutoProgram       = domoticz.variables('UV_ToonAutoProgram').value -- Sensor showing current auto program status
        local ToonProgramInformation = domoticz.variables('UV_ToonProgramInformation').value -- Sensor showing displaying program information status
        local ToonIP                = domoticz.variables('UV_ToonIP').value
        local DomoticzIP            = domoticz.variables('UV_DomoticzIP').value
        local ToonBurnerName        = domoticz.variables('UV_ToonBurnerName').value
        local P1SmartMeterPower     = domoticz.variables('UV_P1SmartMeterElectra').value
        local P1SmartMeterGas       = domoticz.variables('UV_P1SmartMeterGasMeterStand').value
        local ToonBoilerSetpoint    = domoticz.variables('UV_ToonBoilerTempSetpoint').value  -- Sensor showing current boiler set point water temp out
    
        -- Handle json
		-- Adjust loadfile location to your personal installation.
		-- This setting is for the raspberry pi
        local json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Raspberry
        
        local handle_ToonInfo = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
        local ThermostatInfo = handle_ToonInfo:read('*all')
        handle_ToonInfo:close()
        
        local jsonThermostatInfo = json:decode(ThermostatInfo)
        
        if jsonThermostatInfo == nil then
            return
        end
        
        local handle_BoilerInfo = assert(io.popen(string.format('curl http://%s/boilerstatus/boilervalues.txt', ToonIP)))
        local BoilerInfo = handle_BoilerInfo:read('*all')
        handle_BoilerInfo:close()

        -- JSON data from Toon contains a extra "," which should not be there.
        BoilerInfo = string.gsub(BoilerInfo, ",}", "}")
        jsonBoilerInfo = json:decode(BoilerInfo)
        
         -- http://<IP_TOON>/hdrv_zwave?action=getDevices.json 
        local handle_P1Connection = assert(io.popen(string.format('curl http://%s/hdrv_zwave?action=getDevices.json', ToonIP)))
        local GasPowerInfo = handle_P1Connection:read('*all')
        handle_P1Connection:close()
        
        -- JSON data from Toon contains a extra "." which should not be there.
		-- Check dev_* numbers on your Toon with http://<IP_TOON>/hdrv_zwave?action=getDevices.json
        GasPowerInfo = string.gsub(GasPowerInfo, "dev_2.", "dev_2")
        GasPowerInfo = string.gsub(GasPowerInfo, "dev_2:", "dev_2\":")
        
        local jsonGasPower = json:decode(GasPowerInfo)
        
-- START UPDATE SECTION
	   -- CHECK THIS SECTION FOR YOUR PERSONAL SETTINGS
       -- domoticz.log(jsonGasPower)
	   -- Check dev_* numbers on your Toon with http://<IP_TOON>/hdrv_zwave?action=getDevices.json
         local CurrentElectricityFlowHoog = tonumber(jsonGasPower.dev_23.CurrentElectricityFlow )
         local CurrentElectricityQuantityHoog = tonumber(jsonGasPower.dev_23.CurrentElectricityQuantity)
         local CurrentElectricityFlowLaag = tonumber(jsonGasPower.dev_25.CurrentElectricityFlow )
         local CurrentElectricityQuantityLaag = tonumber(jsonGasPower.dev_25.CurrentElectricityQuantity)
         local CurrentGasFlow = tonumber(jsonGasPower.dev_21.CurrentGasFlow)
         local CurrentGasQuantity = tonumber(jsonGasPower.dev_21.CurrentGasQuantity)
         local CurrentElectricityQuantity =   CurrentElectricityFlowHoog + CurrentElectricityFlowLaag
         local CurrentElectricityDeliveredLaag = 0
         local CurrentElectricityDeliveredHoog = 0
         local totalDeliveredPower = 0

        domoticz.devices(P1SmartMeterPower).updateP1(CurrentElectricityQuantityLaag, CurrentElectricityQuantityHoog, CurrentElectricityDeliveredLaag, CurrentElectricityDeliveredHoog, CurrentElectricityQuantity, totalDeliveredPower).silent()
        
        domoticz.devices(P1SmartMeterGas).updateGas(CurrentGasQuantity).silent()
-- END UPDATE SECTION 

-- Update the Boiler Water In to current value
         local currentboilerInTemp = tonumber(jsonBoilerInfo.boilerInTemp)
        if domoticz.utils.round(domoticz.devices(ToonBoilerTempIn).temperature,0) ~= domoticz.utils.round(currentboilerInTemp,0) then
            -- domoticz.log('Updating Boiler Water In to current value: ' ..currentboilerInTemp)
            domoticz.devices(ToonBoilerTempIn).updateTemperature(currentboilerInTemp).silent()
        end
        
-- Update the Boiler water Out to current value
     local currentboilerOutTemp = tonumber(jsonBoilerInfo.boilerOutTemp)
        if domoticz.utils.round(domoticz.devices(ToonBoilerTempOut).temperature,0) ~= domoticz.utils.round(currentboilerOutTemp,0) then
            -- domoticz.log('Updating Boiler Water Out to current value: ' ..currentboilerOutTemp)
            domoticz.devices(ToonBoilerTempOut).updateTemperature(currentboilerOutTemp).silent()
        end
        
-- Update the Boiler water Pressure to current value
        local currentBoilerPressure = tonumber(jsonBoilerInfo.boilerPressure) * 10
        if domoticz.utils.round(domoticz.devices(ToonBoilerPressure)._nValue,0) ~= domoticz.utils.round(currentBoilerPressure,0) then
            -- domoticz.log('Updating Boiler Pressure to current value: ' ..currentBoilerPressure)
            domoticz.devices(ToonBoilerPressure).updatePressure(currentBoilerPressure).silent()
        end

-- Update Program state to current value
        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
-- Update Active state to current value
        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
        
-- Update the toon burner selector to current program state
        local currentBurnerInfo = tonumber(jsonThermostatInfo.burnerInfo)   
        local CurrentToonBurnerValue = domoticz.devices(ToonBurnerName).level
  
        if currentBurnerInfo == 0 then currentBurnerInfo = 0 -- uit
            elseif currentBurnerInfo == 1 then currentBurnerInfo = 10 -- cv aan
            elseif currentBurnerInfo == 2 then currentBurnerInfo = 20 -- warmwater aan
        end
            
        if CurrentToonBurnerValue ~= currentBurnerInfo then  -- Update toon burner selector if it has changed
            -- domoticz.log('Updating Toon burner info:')
            domoticz.devices(ToonBurnerName).switchSelector(currentBurnerInfo)
        end
                    
-- Update the modulation level of the burner
        local currentModulationLevel = tonumber(jsonThermostatInfo.currentModulationLevel)
        if domoticz.devices(ToonBoilerModulation).percentage + 1 ~= currentModulationLevel + 1 then 
            -- domoticz.log('Updating the Modulation sensor to new value: ' ..currentModulationLevel)
            domoticz.devices(ToonBoilerModulation).updatePercentage(currentModulationLevel)
        end
        
-- Update the temperature Boiler setpoint to current boiler set point
        local currentInternalBoilerSetpoint = jsonThermostatInfo.currentInternalBoilerSetpoint+1
        if domoticz.utils.round(domoticz.devices(ToonBoilerSetpoint).temperature, 1) ~= domoticz.utils.round(currentInternalBoilerSetpoint, 1) then 
            -- domoticz.log('Updating the Boiler internal temperature setpoint to new value: ' ..currentInternalBoilerSetpoint)
            domoticz.devices(ToonBoilerSetpoint).updateTemperature(currentInternalBoilerSetpoint)
        end
        
-- Update the thermostat sensor to current setpoint
        if domoticz.devices(ToonThermostat).setPoint*100 ~= currentSetpoint*100 then
            -- domoticz.log('Updating thermostat sensor to new set point: ' ..currentSetpoint)
            domoticz.devices(ToonThermostat).updateSetPoint(currentSetpoint).silent()
        end
     
-- Update the temperature sensor to current room temperature
        if domoticz.utils.round(domoticz.devices(ToonTemperature).temperature, 1) ~= domoticz.utils.round(currentTemperature, 1) then 
            -- domoticz.log('Updating the temperature sensor to new value: ' ..currentTemperature)
            domoticz.devices(ToonTemperature).updateTemperature(currentTemperature)
        end
        
-- Update the toon scene selector sensor to current program state
        if domoticz.devices(ToonScenes).level ~= currentActiveState then  -- Update toon selector if it has changed
            -- domoticz.log('Updating Toon Scenes selector to: '..currentActiveState)
            domoticz.devices(ToonScenes).switchSelector(currentActiveState).silent()
        end
        
-- Updates the toon auto program switch 
        if domoticz.devices(ToonAutoProgram).level ~= currentProgramState then -- Update toon auto program selector if it has changed
            -- domoticz.log('Updating Toon Auto Program selector to: '..currentProgramState)
            domoticz.devices(ToonAutoProgram).switchSelector(currentProgramState).silent()
        end
        
-- Updates the toon program information text box
        local currentNextTime = jsonThermostatInfo.nextTime
        local currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
        
        if currentNextTime == 0 or currentNextSetPoint == 0 then
            ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
        else
            ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
        end
        
        if domoticz.devices(ToonProgramInformation).text ~= ToonProgramInformationSensorValue then
            -- domoticz.log('Updating Toon Program Information to: '..ToonProgramInformationSensorValue)
            domoticz.devices(ToonProgramInformation).updateText(ToonProgramInformationSensorValue)
        end
        
-- Updates the Device Domoticz IP adres to given adres in UV_DomoticzIP
        if domoticz.devices('DomoticzIP').text ~= DomoticzIP then
            -- domoticz.log('Updating Domoticz IP to: '..DomoticzIP)
            domoticz.devices('DomoticzIP').updateText(DomoticzIP)
        end
   end
}
When all is done correctly, it will work with a rooted Toon, fw 5.04. Maybe you need to install the boilerstatus module from the toonstore if you get boiler issues.
hansgrave
Starting Member
Starting Member
Posts: 49
Joined: Sat Dec 23, 2017 12:42 pm

Re: Controlling Toon via Domoticz

Post by hansgrave »

Finaly it works... The problem was the permission in windows for the directory where the DZ script should written :roll:

@MarcF thanx for your summary of settings and script, little correction in the switch part: the proper switch name is ToonBurnerName in stead of ToonBranderInfo
Homey, rooted Toon 1 and HomeAssistent.
Edwin66
Member
Member
Posts: 78
Joined: Mon Aug 13, 2018 10:50 pm

Re: Controlling Toon via Domoticz

Post by Edwin66 »

I don't know why, but every time I do the following:

Code: Select all

http://192.168.0.11:8080/json.htm?type=command&param=udevice&idx=<IDXnr>&nvalue=0&svalue=192.168.0.4
Of course with my settings, I get an unresponsive system. Can't even connect with terminal. All I can do is to reinstall domoticz and then restore a backup.
Toon® (rooted) | Hue bulbs | TRÅDFRI bulbs | Smart Plug | Domoticz latest BETA |

I'm not a programmer, just wish things work MY way
MarcF
Starting Member
Starting Member
Posts: 4
Joined: Fri Mar 08, 2019 8:49 pm

Re: Controlling Toon via Domoticz

Post by MarcF »

Hello Edwin66,

You need to replace the <IDXnr> with the correct IDX number from your device. Go to:

SETUP=>DEVICES

The second column is labeled "idx". Get the IDX number from your device you're setting the value for.
gielie
Member
Member
Posts: 69
Joined: Thu Nov 02, 2017 11:06 am

Re: Controlling Toon via Domoticz

Post by gielie »

I can't figure out which dev_ I need to use to get the right values.
I get the following error

Code: Select all

 2019-03-29 13:58:00.866 Status: dzVents: Error (2.4.15): An error occured when calling event handler Toon
2019-03-29 13:58:00.866 Status: dzVents: Error (2.4.15): ...e/pi/domoticz/scripts/dzVents/generated_scripts/Toon.lua:78: attempt to index field 'dev_104' (a nil value)
2
This is my output from /hdrv_zwave?action=getDevices.json

Code: Select all

{"dev_settings_device": {"uuid": "eneco-001-003065:hdrv_zwave_722E1463E52", 
"name": "settings_device", "internalAddress": "settings_device", "type": "settings_device"}, "dev_10": {"uuid": "5abdbba5-9ab3-4172-a729-89ecc9ea8b2b", 
"name": "HAE_METER_v3", "internalAddress": "10", "type": "HAE_METER_v3", "supportsCrc": "1", "ccList": "5e 86 72 32 56 5a 59 85 73 7a 60 8e 22 70 8b 3c 3d 3e", "supportedCC": "5e 86 72 32 56 5a 59 85 73 7a 60 8e 22 70 8b 3c 3d 3e", "nodeFlags": [], "IsConnected": "1", 
"DeviceName": "HAE_METER_v3"}, "dev_10.1": {"uuid": "2671d3ea-aa17-4f52-8904-515df9f0af6b", 

"name": "HAE_METER_v3_1", "internalAddress": "10.1", "type": "gas", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", 
"supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentGasFlow": "7.00", "CurrentGasQuantity": "340247.00", 

"DeviceName": "HAE_METER_v3_1"}, "dev_10.2": {"uuid": "ac189810-349a-449b-ae82-d82bff1c2ff0", 

"name": "HAE_METER_v3_2", "internalAddress": "10.2", "type": "elec", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "NaN", "CurrentElectricityQuantity": "NaN", 

"DeviceName": "HAE_METER_v3_2"}, "dev_10.3": {"uuid": "4a42813f-80b0-4928-b471-d24ba223fe50", 

"name": "HAE_METER_v3_3", "internalAddress": "10.3", "type": "elec_solar", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "599.00", "CurrentElectricityQuantity": "2365.00", 

"DeviceName": "HAE_METER_v3_3"}, "dev_10.4": {"uuid": "fc22df5d-8cdc-4a66-9843-6d322658d260", 

"name": "HAE_METER_v3_4", "internalAddress": "10.4", "type": "elec_delivered_nt", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 5e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "928993.00", 

"DeviceName": "HAE_METER_v3_4"}, "dev_10.5": {"uuid": "90737039-083b-4f54-8a05-01e2f1f404d7", 

"name": "HAE_METER_v3_5", "internalAddress": "10.5", "type": "elec_received_nt", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "386.00", "CurrentElectricityQuantity": "60117.00", 

"DeviceName": "HAE_METER_v3_5"}, "dev_10.6": {"uuid": "2ad2e8f8-7353-4acf-9fd3-888c4afdb9d3", 

"name": "HAE_METER_v3_6", "internalAddress": "10.6", "type": "elec_delivered_lt", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "1014445.00", 

"DeviceName": "HAE_METER_v3_6"}, "dev_10.7": {"uuid": "fb071696-e514-42e7-aec7-36966724e927", 

"name": "HAE_METER_v3_7", "internalAddress": "10.7", "type": "elec_received_lt", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "17643.00", 

"DeviceName": "HAE_METER_v3_7"}, "dev_10.8": {"uuid": "ff785dff-6a4f-4631-8b30-b62ba5056e76", 

"name": "HAE_METER_v3_8", "internalAddress": "10.8", "type": "heat", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentHeatQuantity": "NaN", 

"DeviceName": "HAE_METER_v3_8"}}
so I think I need to use elec high dev_104, elec low dev_106 and for gas dev 101
What am I doing wrong?????
Last edited by gielie on Fri Mar 29, 2019 3:46 pm, edited 2 times in total.
madpatrick
Member
Member
Posts: 100
Joined: Wed Dec 06, 2017 9:52 pm
Location: Zuid-Holland

Re: Controlling Toon via Domoticz

Post by madpatrick »

Look like you need to use "dev_10.5" etc....
gielie
Member
Member
Posts: 69
Joined: Thu Nov 02, 2017 11:06 am

Re: Controlling Toon via Domoticz

Post by gielie »

I can't figure out how I can get this to work, I figured out which Dev_ I need but now I get this error

Code: Select all

2019-03-29 14:35:00.583 Status: dzVents: Info: ------ Start internal script: Toon:, trigger: every minute
2019-03-29 14:35:01.077 Status: dzVents: Error (2.4.15): There is no device with that name or id:
2019-03-29 14:35:01.078 Status: dzVents: Error (2.4.15): An error occured when calling event handler Toon
2019-03-29 14:35:01.078 Status: dzVents: Error (2.4.15): ...e/pi/domoticz/scripts/dzVents/generated_scripts/Toon.lua:89: attempt to index a nil value
2019-03-29 14:35:01.078 Status: dzVents: Info: ------ Finished Toon
I think it has to something with the device, but there is one called P1SmartMeterPower, what am I doing wrong

===========update===========

ok got it working right now, I messed up the user variables.
1 question, is it possible with this script to see the return from my solar panels, it is possible with the php script.
Duiken60
Starting Member
Starting Member
Posts: 9
Joined: Wed Apr 10, 2019 6:01 pm

Re: Controlling Toon via Domoticz

Post by Duiken60 »

Have my Toon working on Domoticz but only after turning the option "local access" on but that works only for 2 hrs. How can I get is working without time limitation?
michel30
Member
Member
Posts: 274
Joined: Fri Aug 25, 2017 4:42 pm

Re: Controlling Toon via Domoticz

Post by michel30 »

Hello,

Why not using home assistant?

It is easy to set up, you can control Toon with google home assistant. You see how match power and gas you are using and match more things.

I used Domoticz in the beginning but than I had my google speaker and this was not free to use with domoticz so I search for someting else and there it was home assistant.
Post Reply

Return to “Toon external control”