Hi guys, been reading here a lot these days since I've rooted my Toon. I used the scripts posted in this thread. I'm still working to get all of the Toon data to Domoticz on my Synology NAS.
My progress so far:
On the 'Swithes' tab the three switches are working (jay)
On the 'Temperature' tab, ToonTemperature and ToonBoilerTempSetpoint are working (my boiler does not seems to be able to give me TempIn and TempOut, but that's fine for now. The ToonBoilerSetupoint value gives a steady 6 degrees, but why?
On the 'Utility' everything is working but the P1 meters.
I think that my main problem is getting the dev settings right.
This is the output from
http://TOON IP/hdrv_zwave?action=getDevices.json
Code: Select all
{"dev_settings_device": {"uuid": "a7ffb43e-3904-41a3-8047-9ef0f717580e", "name": "settings_device", "internalAddress": "settings_device", "type": "settings_device"}, "dev_4": {"uuid": "cfc8836d-ef42-4004-ba58-75e9f9af48fb", "name": "HAE_METER_v3", "internalAddress": "4", "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", "CurrentSensorStatus": "UNKNOWN"}, "dev_4.1": {"uuid": "25850383-c67f-4e3e-a0a0-7b1b84bca8bf", "name": "HAE_METER_v3_1", "internalAddress": "4.1", "type": "HAE_METER_v3_1", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentSensorStatus": "OPERATIONAL", "CurrentGasFlow": "28.00", "CurrentGasQuantity": "4740613.00", "DeviceName": "HAE_METER_v3_1"}, "dev_4.2": {"uuid": "c28239c0-ea0e-40eb-9526-b2e700f55539", "name": "HAE_METER_v3_2", "internalAddress": "4.2", "type": "HAE_METER_v3_2", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentSensorStatus": "UNKNOWN", "DeviceName": "HAE_METER_v3_2", "CurrentElectricityFlow": "NaN", "CurrentElectricityQuantity": "NaN"}, "dev_4.3": {"uuid": "8be23555-f719-43ba-97c4-670a0815015c", "name": "HAE_METER_v3_3", "internalAddress": "4.3", "type": "HAE_METER_v3_3", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentSensorStatus": "OPERATIONAL", "DeviceName": "HAE_METER_v3_3", "CurrentElectricityFlow": "363.00", "CurrentElectricityQuantity": "586811.00"}, "dev_4.4": {"uuid": "fd387322-0004-4254-8bbe-418102e7082d", "name": "HAE_METER_v3_4", "internalAddress": "4.4", "type": "HAE_METER_v3_4", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentSensorStatus": "OPERATIONAL", "DeviceName": "HAE_METER_v3_4", "CurrentElectricityFlow": "156.00", "CurrentElectricityQuantity": "5994390.00"}, "dev_4.5": {"uuid": "64459f73-79e0-425e-80d9-66b4a9e4be1a", "name": "HAE_METER_v3_5", "internalAddress": "4.5", "type": "HAE_METER_v3_5", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentSensorStatus": "OPERATIONAL", "DeviceName": "HAE_METER_v3_5", "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "4744289.00"}, "dev_4.6": {"uuid": "41c98ea5-b61e-4b73-b00e-aa947ae10df2", "name": "HAE_METER_v3_6", "internalAddress": "4.6", "type": "HAE_METER_v3_6", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentSensorStatus": "OPERATIONAL", "DeviceName": "HAE_METER_v3_6", "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "9748242.00"}, "dev_4.7": {"uuid": "f2ddcae8-6568-4675-8963-1971d1ab3b88", "name": "HAE_METER_v3_7", "internalAddress": "4.7", "type": "HAE_METER_v3_7", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentSensorStatus": "OPERATIONAL", "DeviceName": "HAE_METER_v3_7", "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "1848818.00"}, "dev_4.8": {"uuid": "54066ead-7b71-4517-88d9-c7630ea5a906", "name": "HAE_METER_v3_8", "internalAddress": "4.8", "type": "HAE_METER_v3_8", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentSensorStatus": "UNKNOWN", "DeviceName": "HAE_METER_v3_8", "CurrentHeatQuantity": "NaN", "CurrentHeatFlow": "NaN"}}
These are my variables:
19 UV_P1SmartMeterGasMeterStand String P1SmartMeterGasMeterStand 2021-04-15 15:32:54
18 UV_P1SmartMeterElectra String P1SmartMeterElectra 2021-04-15 15:32:35
17 UV_ToonBoilerPressure String BoilerPressure 2021-04-15 15:32:00
16 UV_ToonBoilerTempOut String BoilerTempOut 2021-04-15 15:31:38
15 UV_ToonBoilerTempIn String BoilerTempIn 2021-04-15 15:31:14
14 UV_ToonProgramInformationSensorName String ToonProgramInfo 2021-04-15 13:20:37
13 UV_ToonAutoProgramSensorName String ToonAutoProgram 2021-04-15 13:20:04
12 UV_ToonChangedByDomoticz Integer 1 2021-04-15 13:39:41
11 UV_ToonScenesSensorName String ToonScenes 2021-04-15 13:18:56
10 UV_ToonTemperatureSensorName String ToonTemperature 2021-04-15 13:18:32
9 UV_ToonThermostatSensorName String ToonThermostat 2021-04-15 13:17:47
8 UV_ToonBurnerName String ToonBranderInfo 2021-04-15 13:17:19
7 UV_ToonBoilerTempSetpointSensorName String ToonBoilerTempSetpoint 2021-04-15 13:16:55
6 UV_ToonBoilerModulation String Boiler Modulation Level 2021-04-15 15:34:20
5 UV_ToonIP String 192.168.2.200 2021-04-12 11:13:51
3 UV_DomoticzIP String 192.168.2.153:8084 2021-04-12 11:42:37
Showing 1 to 16 of 16 entries
My Toon script:
Code: Select all
commandArray = {}
ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
ToonTemperatureSensorName = uservariables['UV_ToonTemperatureSensorName'] -- Sensor showing current room temperature
ToonScenesSensorName = uservariables['UV_ToonScenesSensorName'] -- Sensor showing current program
ToonAutoProgramSensorName = uservariables['UV_ToonAutoProgramSensorName'] -- Sensor showing current auto program status
ToonBurnerName = uservariables['UV_ToonBurnerName']
ToonProgramInformationSensorName = uservariables['UV_ToonProgramInformationSensorName'] -- Sensor showing displaying program information status
ToonBoilerTempSetpoint = uservariables['UV_ToonBoilerTempSetpointSensorName'] -- Sensor showing current internal boiler temp
ToonIP = uservariables['UV_ToonIP']
DomoticzIP = uservariables['UV_DomoticzIP']
-- 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 "/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
local handle = assert(io.popen(string.format('curl -m 5 http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
local ThermostatInfo = handle:read('*all')
handle:close()
-- JSON data from Toon contains a extra "," which should not be there.
ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")
jsonThermostatInfo = json:decode(ThermostatInfo)
if jsonThermostatInfo ~= nil then
currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
currentProgramState = tonumber(jsonThermostatInfo.programState)
currentActiveState = tonumber(jsonThermostatInfo.activeState)
currentNextTime = jsonThermostatInfo.nextTime
currentBurnerInfo = tonumber(jsonThermostatInfo.burnerInfo)
currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
currentBoilerSetPoint = tonumber(jsonThermostatInfo.currentInternalBoilerSetpoint)
if currentSetpoint ~= nil then
-- Update the thermostat sensor to current setpoint
if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then
print('Updating thermostat sensor to new set point: ' ..currentSetpoint)
commandArray[1] = {['Variable:UV_ToonChangedByDomoticz'] = '1'} -- Set variable changed to 1 to prevent script ToonSetPoint from shooting an event at Toon
commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonThermostatSensorName], currentSetpoint)}
end
end
if currentTemperature ~= nil then
-- Update the temperature sensor to current room temperature
if otherdevices_svalues[ToonTemperatureSensorName]*100 ~= currentTemperature*100 then
print('Updating the temperature sensor to new value: ' ..currentTemperature)
commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonTemperatureSensorName], currentTemperature)}
end
end
if currentBoilerSetPoint ~= nil then
-- Update the temperature of boiler
if otherdevices_svalues[ToonBoilerTempSetpoint]*100 ~= currentBoilerSetPoint*100 then
print('Updating the boiler temperature to new value: ' ..currentBoilerSetPoint)
commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonBoilerTempSetpoint], currentBoilerSetPoint)}
end
end
if currentActiveState ~= nil then
-- Update the toon scene selector sensor to current program state
CurrentToonScenesSensorValue = otherdevices_svalues[ToonScenesSensorName]
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
if CurrentToonScenesSensorValue ~= currentActiveState then -- Update toon selector if it has changed
print ('Updating Toon Scenes selector')
commandArray[4] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonScenesSensorName], currentActiveState)}
end
end
if currentProgramState ~= nil then
-- Updates the toon auto program switch
CurrentToonAutoProgramSensorValue = otherdevices_svalues[ToonAutoProgramSensorName]
if currentProgramState == 0 then currentProgramState = '10' -- No
elseif currentProgramState == 1 then currentProgramState = '20' -- Yes
elseif currentProgramState == 2 then currentProgramState = '30' -- Temporary
end
if CurrentToonAutoProgramSensorValue ~= currentProgramState then -- Update toon auto program selector if it has changed
print ('Updating Toon Auto Program selector')
commandArray[5] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonAutoProgramSensorName], currentProgramState)}
end
end
if currentNextTime ~= nil and currentNextSetPoint ~= nil then
-- Updates the toon program information text box
CurrentToomProgramInformationSensorValue = otherdevices_svalues[ToonProgramInformationSensorName]
if currentNextTime == 0 or currentNextSetPoint == 0 then
ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
else
ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
end
if CurrentToomProgramInformationSensorValue ~= ToonProgramInformationSensorValue then
commandArray[6] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonProgramInformationSensorName], ToonProgramInformationSensorValue)}
end
end
-- Update the toon burner selector to current program state
CurrentToonBurnerValue = otherdevices_svalues[ToonBurnerName]
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
print ('Updating Toon burner info')
commandArray[7] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonBurnerName], currentBurnerInfo)}
end
end
--
return commandArray
My ToonSetpoint script:
Code: Select all
commandArray = {}
ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
ToonTemperatureSensorName = uservariables['UV_ToonTemperatureSensorName'] -- Sensor showing current room temperature
ToonScenesSensorName = uservariables['UV_ToonScenesSensorName'] -- Sensor showing current program
ToonAutoProgramSensorName = uservariables['UV_ToonAutoProgramSensorName'] -- Sensor showing current auto program status
ToonBurnerName = uservariables['UV_ToonBurnerName']
ToonProgramInformationSensorName = uservariables['UV_ToonProgramInformationSensorName'] -- Sensor showing displaying program information status
ToonBoilerTempSetpoint = uservariables['UV_ToonBoilerTempSetpointSensorName'] -- Sensor showing current internal boiler temp
ToonIP = uservariables['UV_ToonIP']
DomoticzIP = uservariables['UV_DomoticzIP']
-- 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 "/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
local handle = assert(io.popen(string.format('curl -m 5 http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
local ThermostatInfo = handle:read('*all')
handle:close()
-- JSON data from Toon contains a extra "," which should not be there.
ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")
jsonThermostatInfo = json:decode(ThermostatInfo)
if jsonThermostatInfo ~= nil then
currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
currentProgramState = tonumber(jsonThermostatInfo.programState)
currentActiveState = tonumber(jsonThermostatInfo.activeState)
currentNextTime = jsonThermostatInfo.nextTime
currentBurnerInfo = tonumber(jsonThermostatInfo.burnerInfo)
currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
currentBoilerSetPoint = tonumber(jsonThermostatInfo.currentInternalBoilerSetpoint)
if currentSetpoint ~= nil then
-- Update the thermostat sensor to current setpoint
if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then
print('Updating thermostat sensor to new set point: ' ..currentSetpoint)
commandArray[1] = {['Variable:UV_ToonChangedByDomoticz'] = '1'} -- Set variable changed to 1 to prevent script ToonSetPoint from shooting an event at Toon
commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonThermostatSensorName], currentSetpoint)}
end
end
if currentTemperature ~= nil then
-- Update the temperature sensor to current room temperature
if otherdevices_svalues[ToonTemperatureSensorName]*100 ~= currentTemperature*100 then
print('Updating the temperature sensor to new value: ' ..currentTemperature)
commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonTemperatureSensorName], currentTemperature)}
end
end
if currentBoilerSetPoint ~= nil then
-- Update the temperature of boiler
if otherdevices_svalues[ToonBoilerTempSetpoint]*100 ~= currentBoilerSetPoint*100 then
print('Updating the boiler temperature to new value: ' ..currentBoilerSetPoint)
commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonBoilerTempSetpoint], currentBoilerSetPoint)}
end
end
if currentActiveState ~= nil then
-- Update the toon scene selector sensor to current program state
CurrentToonScenesSensorValue = otherdevices_svalues[ToonScenesSensorName]
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
if CurrentToonScenesSensorValue ~= currentActiveState then -- Update toon selector if it has changed
print ('Updating Toon Scenes selector')
commandArray[4] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonScenesSensorName], currentActiveState)}
end
end
if currentProgramState ~= nil then
-- Updates the toon auto program switch
CurrentToonAutoProgramSensorValue = otherdevices_svalues[ToonAutoProgramSensorName]
if currentProgramState == 0 then currentProgramState = '10' -- No
elseif currentProgramState == 1 then currentProgramState = '20' -- Yes
elseif currentProgramState == 2 then currentProgramState = '30' -- Temporary
end
if CurrentToonAutoProgramSensorValue ~= currentProgramState then -- Update toon auto program selector if it has changed
print ('Updating Toon Auto Program selector')
commandArray[5] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonAutoProgramSensorName], currentProgramState)}
end
end
if currentNextTime ~= nil and currentNextSetPoint ~= nil then
-- Updates the toon program information text box
CurrentToomProgramInformationSensorValue = otherdevices_svalues[ToonProgramInformationSensorName]
if currentNextTime == 0 or currentNextSetPoint == 0 then
ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
else
ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
end
if CurrentToomProgramInformationSensorValue ~= ToonProgramInformationSensorValue then
commandArray[6] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonProgramInformationSensorName], ToonProgramInformationSensorValue)}
end
end
-- Update the toon burner selector to current program state
CurrentToonBurnerValue = otherdevices_svalues[ToonBurnerName]
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
print ('Updating Toon burner info')
commandArray[7] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonBurnerName], currentBurnerInfo)}
end
end
--
return commandArray
My Thermostat script:
Code: Select all
commandArray = {}
ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
ToonIP = uservariables['UV_ToonIP']
for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName == ToonThermostatSensorName) then
if uservariables['UV_ToonChangedByDomoticz'] == 1 then
commandArray['Variable:UV_ToonChangedByDomoticz'] = '0'
else
SetPoint = otherdevices_svalues[ToonThermostatSensorName]
ToonCommand = string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', ToonIP, SetPoint*100)
print('Setting Toon setpoint to '.. SetPoint)
commandArray['OpenURL'] = ToonCommand
end
end
end
return commandArray
And I created a separate data coollector script (based on what I read here):
Code: Select all
commandArray = {}
ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
ToonIP = uservariables['UV_ToonIP']
for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName == ToonThermostatSensorName) then
if uservariables['UV_ToonChangedByDomoticz'] == 1 then
commandArray['Variable:UV_ToonChangedByDomoticz'] = '0'
else
SetPoint = otherdevices_svalues[ToonThermostatSensorName]
ToonCommand = string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', ToonIP, SetPoint*100)
print('Setting Toon setpoint to '.. SetPoint)
commandArray['OpenURL'] = ToonCommand
end
end
end
return commandArray
The log still gives me:
Code: Select all
2021-04-15 16:48:00.513 Status: dzVents: Info: ------ Start internal script: Toon data collector:, trigger: "every minute"
2021-04-15 16:48:00.569 Status: dzVents: Info: Updating Boiler Pressure to current value: 15.0
2021-04-15 16:48:00.621 Status: dzVents: Info: ------ Finished Toon data collector
2021-04-15 16:48:00.621 Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2021-04-15 16:48:00.620 Error: dzVents: Error: (3.0.17) An error occurred when calling event handler Toon data collector
2021-04-15 16:48:00.620 Error: dzVents: Error: (3.0.17) ...cripts/dzVents/generated_scripts/Toon data collector.lua:64: attempt to index a nil value (field 'dev_37')
Hope you can help me here...