(rooted) Toon thermostat combined Get and Set script

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

User avatar
madpatrick
Posts: 636
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Toon thermostat combined Get and Set script

Post by madpatrick »

HansieNL wrote: Saturday 31 August 2019 12:59 Thanks @madpatrick and @waaren for your help.
I use 2 scripts. Don't know how to make it using just one script. But it works for me ok. I'm using only 3 devices: Thermostat, Scenes and Temperature. I don't use scene states, so decided to use setpoint temperature to let switch the scenes.
Nice addition to the script.
-= HP server GEN8 Xeon(R) E3-1220L_V2 -=- OZW -=- Toon2 (rooted) -=- Domoticz v2024.7 -=- Dashticz v3.12b on Tab8" =-
User avatar
MadMedic
Posts: 31
Joined: Wednesday 26 October 2016 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Huizen, the Netherlands
Contact:

Re: (rooted) Toon thermostat combined Get and Set script

Post by MadMedic »

imdos wrote: Saturday 20 April 2019 14:48 Yes; @jjnj, only with a rooted Toon.
I think it might be a good idea to append that not unimportant fact to (the subject of) the first posting.
Saves a bunch of us with non-rooted Toons a lot of hassle.


Just a suggestion... ;)
.
"Life is too short for bad coffee"
Nickosz
Posts: 1
Joined: Friday 30 October 2020 14:30
Target OS: -
Domoticz version:
Contact:

Re: (rooted) Toon thermostat combined Get and Set script

Post by Nickosz »

Nice topic, i have only one question,

i can contol my toon.

only what is not working is getting the info from my toon to Domoticz.
So the Toon Temerature stay on 0 and when i try to update the device it's come with an error "No devices to Transfer too!"

who can help me?

some extra info, i'm using Domoticz from my Synology Nas.

Thanks all

Nick
User avatar
madpatrick
Posts: 636
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: (rooted) Toon thermostat combined Get and Set script

Post by madpatrick »

Nick,

I've just tested the script (i'm using a different myself) and it is working.
Your domoticz will be update every minute from your Toon

Can you provide more information, like a log
It looks like a name of device is not spelled correctly or not available.

Check all the names if there are available in your UserVariables and switches.
-= HP server GEN8 Xeon(R) E3-1220L_V2 -=- OZW -=- Toon2 (rooted) -=- Domoticz v2024.7 -=- Dashticz v3.12b on Tab8" =-
User avatar
madpatrick
Posts: 636
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: (rooted) Toon thermostat combined Get and Set script

Post by madpatrick »

waaren wrote: Wednesday 23 January 2019 1:45 Created for one of the Dutch forum members who experienced a problem with the two Lua scripts controlling the communication between a rooted Toon and domoticz after updating to a recent domoticz version. This script uses the same uservariables as the original Lua script. many thanks to @johan1974 for testing, patience and constructive feedback.
When switching from the Lua version to this one. Make sure you deactivate both Lua scripts and remove the actions from the selector switches.
  • uservariables used in this script
  • UV_ToonIP ............................................. -- Toon IP address
  • UV_ToonThermostatSensorName ................... -- virtual thermostat setpoint showing current setpoint
  • UV_ToonTemperatureSensorName .................. -- virtual temperature sensor showing current room temperature
  • UV_ToonScenesSensorName ......................... -- virtual selector switch showing current program
  • UV_ToonAutoProgramSensorName .................. -- virtual selector switch showing current auto program status
  • UV_ToonProgramInformationSensorName ......... -- virtual text sensor showing displaying program information status
Main advantage of this script is the use of the async communication between domoticz and Toon. No more blocking the eventsystem if Toon is busy Domoticz event system will just work on other fun stuff and gets signaled whenever Toon decides to answer :)
Waaren,

Your script is working smoother then my current copied/paste script from forums.
The only thing is that i've expended the script with extra functionality like : gas and power consumption, boiler status, boiler temperatures and pressure.
Are you willing to support is adding this to your script ?

This my current script where i've add info lines per funcionality

Code: Select all

return {

        on      =   { 
                    timer         = { 
                        "every minute"      
                    },
                                    
        logging = {
                    level = domoticz.LOG_ERROR, -- Select one of LOG_INFO, LOG_DEBUG, LOG_ERROR, LOG_FORCE to override system log level
                    marker = "-=# Toon #=-"
                    },  

},
   execute = function(domoticz)
        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 ToonBoilerSetpoint     = domoticz.variables('UV_ToonBoilerTempSetpoint').value -- Sensor showing current boiler set point
        local ToonBurnerName         = domoticz.variables('UV_ToonBurnerName').value
        local ToonIP                 = domoticz.variables('UV_ToonIP').value
        local DomoticzIP             = domoticz.variables('UV_DomoticzIP').value
        local P1SmartMeterPower      = domoticz.variables('UV_P1SmartMeterElectra').value
        local P1SmartMeterGas1       = domoticz.variables('UV_P1SmartMeterGasMeterStand').value
--        local ToonProgramInformation = domoticz.variables('UV_ToonProgramInformation').value -- Sensor showing displaying program information status  

-- Handle json
        -- local json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux
        local json = assert(loadfile "/var/domoticz/scripts/lua/JSON.lua")()  -- For Linux (ClearOS)
        
        local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
        local ThermostatInfo = handle:read('*all')
        handle:close()
        
        local jsonThermostatInfo = json:decode(ThermostatInfo)
        
        if jsonThermostatInfo == nil then
            return
        end
        
        local handle2 = assert(io.popen(string.format('curl http://%s/boilerstatus/boilervalues.txt', ToonIP)))
        local BoilerInfo = handle2:read('*all')
        handle2: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 handle4 = assert(io.popen(string.format('curl http://%s/hdrv_zwave?action=getDevices.json', ToonIP)))
        local GasPowerInfo = handle4:read('*all')
        handle4:close()
        
-- JSON data from Toon contains a extra "." which should not be there.
        GasPowerInfo = string.gsub(GasPowerInfo, "dev_2.", "dev_2")
        GasPowerInfo = string.gsub(GasPowerInfo, "dev_2:", "dev_2\":")
        
        local jsonGasPower = json:decode(GasPowerInfo)
        
-- Update the powerconsumption
         local CurrentElectricityFlowHoog       = tonumber(jsonGasPower.dev_24.CurrentElectricityFlow)          --stroomverbruik momenteel hoogtarief
         local CurrentElectricityFlowLaag       = tonumber(jsonGasPower.dev_26.CurrentElectricityFlow)          --stroomverbruik momenteel laagtarief
         local CurrentElectricityQuantityHoog   = tonumber(jsonGasPower.dev_24.CurrentElectricityQuantity)      --stroomverbruik totaal hoogtarief
         local CurrentElectricityQuantityLaag   = tonumber(jsonGasPower.dev_26.CurrentElectricityQuantity)      --stroomverbruik totaal laagtarief
         local CurrentElectricityDeliveredHoog  = tonumber(jsonGasPower.dev_25.CurrentElectricityQuantity)      --stroomgeleverd momenteel hoogtarief
         local CurrentElectricityDeliveredLaag  = tonumber(jsonGasPower.dev_27.CurrentElectricityQuantity)      --stroomgeleverd momenteel laagtarief   
         local CurrentElectricityQuantity       =   CurrentElectricityFlowHoog + CurrentElectricityFlowLaag     --stroomverbruik totaal aktueel
         local totalDeliveredPower              = 0
         local totalDeliveredPower2             = CurrentElectricityDeliveredHoog/1000 + CurrentElectricityDeliveredLaag/1000      --stroomverbruik totaal geleverd
         local CurrentGasFlow                   = tonumber(jsonGasPower.dev_21.CurrentGasFlow)
         local CurrentGasQuantity               = tonumber(jsonGasPower.dev_21.CurrentGasQuantity)
         
        domoticz.devices(P1SmartMeterPower).updateP1(CurrentElectricityQuantityLaag, CurrentElectricityQuantityHoog, CurrentElectricityDeliveredLaag, CurrentElectricityDeliveredHoog, CurrentElectricityQuantity, totalDeliveredPower).silent()
        domoticz.devices(P1SmartMeterGas1).updateGas(CurrentGasQuantity).silent()
        --domoticz.log('*** P1 from toon: ' .. CurrentElectricityQuantityLaag/1000 .. 'kwh USAGE1 | ' ..CurrentElectricityQuantityHoog/1000 .. 'kwh USAGE2 | ' .. CurrentElectricityDeliveredLaag/1000 .. 'kwh RETURN1 | ' .. CurrentElectricityDeliveredHoog/1000 .. 'kwh RETURN2 | ' .. CurrentElectricityQuantity .. 'w consumed | '.. totalDeliveredPower2 .. 'w produced', domoticz.LOG_FORCE)


-- Update the Boiler Water In to current value
        local currentboilerInTemp = tonumber(jsonBoilerInfo.boilerInTemp)
        currentboilerInTemp = tonumber(string.format("%.0f", currentboilerInTemp))  -- afgeronde getallen is voldoende [PdB]
        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)
        currentboilerOutTemp = tonumber(string.format("%.0f", currentboilerOutTemp))  -- afgeronde getallen is voldoende [PdB]
        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)
--      currentBoilerPressure = tonumber(string.format("%.1f", currentBoilerPressure))  -- 1 decimaal is voldoende [PdB]
        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.LOG_INFO)
            domoticz.devices(ToonBoilerPressure).updatePressure(currentBoilerPressure).silent()
        end
        
-- Update the current temperature setpoint
        local currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
        local currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
              currentTemperature = tonumber(string.format("%.1f", currentTemperature))  -- 1 decimaal is voldoende [PdB]
              
-- Update the current auto program
        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 the current scene by temperature
		local  currentActiveTemp = tonumber(jsonThermostatInfo.currentSetpoint) / 100
		    if currentActiveTemp == 20.5    then currentActiveState = 40 -- Comfort
		elseif currentActiveTemp == 20      then currentActiveState = 30 -- Home
		elseif currentActiveTemp == 17      then currentActiveState = 20 -- Sleep
		elseif currentActiveTemp == 18.5    then currentActiveState = 10 -- Away
		else   currentActiveState = 50 -- Manual
		end     

-- Update the current scene by state
        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
            elseif currentBurnerInfo == 3 then currentBurnerInfo = 30 -- voorverwarmen volgend setpoint
        end
        
-- Update toon burner selector if it has changed            
        if CurrentToonBurnerValue ~= currentBurnerInfo then  
            domoticz.log('Updating Toon burner info:' ..currentBurnerInfo,domoticz.LOG_FORCE)
            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.LOG_FORCE)
            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: ' ..temperature,domoticz.LOG_FORCE)
            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.LOG_FORCE)
            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.LOG_FORCE)
            domoticz.devices(ToonAutoProgram).switchSelector(currentProgramState).silent()
        end
        
   end
}
-= HP server GEN8 Xeon(R) E3-1220L_V2 -=- OZW -=- Toon2 (rooted) -=- Domoticz v2024.7 -=- Dashticz v3.12b on Tab8" =-
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: (rooted) Toon thermostat combined Get and Set script

Post by waaren »

madpatrick wrote: Tuesday 03 November 2020 19:45 The only thing is that i've expended the script with extra functionality like : gas and power consumption, boiler status, boiler temperatures and pressure.
Are you willing to support is adding this to your script ?
Sure; do you have a pointer to the version of the script I created and that you want to extend with the missing functionality that you now have in your script?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
madpatrick
Posts: 636
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: (rooted) Toon thermostat combined Get and Set script

Post by madpatrick »

I'm tested your version version 0.117
The exta functionality i like to have is:

Code: Select all

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 ToonBoilerSetpoint     = domoticz.variables('UV_ToonBoilerTempSetpoint').value -- Sensor showing current boiler set point
local ToonBurnerName         = domoticz.variables('UV_ToonBurnerName').value
local P1SmartMeterPower      = domoticz.variables('UV_P1SmartMeterElectra').value
local P1SmartMeterGas1       = domoticz.variables('UV_P1SmartMeterGasMeterStand').value

Code: Select all

-- Update the current scene by temperature
		local  currentActiveTemp = tonumber(jsonThermostatInfo.currentSetpoint) / 100
		    if currentActiveTemp == 20.5    then currentActiveState = 40 -- Comfort
		elseif currentActiveTemp == 20      then currentActiveState = 30 -- Home
		elseif currentActiveTemp == 17      then currentActiveState = 20 -- Sleep
		elseif currentActiveTemp == 18.5    then currentActiveState = 10 -- Away
		else   currentActiveState = 50 -- Manual
		end     

Code: Select all

        local handle2 = assert(io.popen(string.format('curl http://%s/boilerstatus/boilervalues.txt', ToonIP)))
        local BoilerInfo = handle2:read('*all')
        handle2: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 handle4 = assert(io.popen(string.format('curl http://%s/hdrv_zwave?action=getDevices.json', ToonIP)))
        local GasPowerInfo = handle4:read('*all')
        handle4:close()
        
-- JSON data from Toon contains a extra "." which should not be there.
        GasPowerInfo = string.gsub(GasPowerInfo, "dev_2.", "dev_2")
        GasPowerInfo = string.gsub(GasPowerInfo, "dev_2:", "dev_2\":")
        
        local jsonGasPower = json:decode(GasPowerInfo)
        
-- Update the powerconsumption
         local CurrentElectricityFlowHoog       = tonumber(jsonGasPower.dev_24.CurrentElectricityFlow)          --stroomverbruik momenteel hoogtarief
         local CurrentElectricityFlowLaag       = tonumber(jsonGasPower.dev_26.CurrentElectricityFlow)          --stroomverbruik momenteel laagtarief
         local CurrentElectricityQuantityHoog   = tonumber(jsonGasPower.dev_24.CurrentElectricityQuantity)      --stroomverbruik totaal hoogtarief
         local CurrentElectricityQuantityLaag   = tonumber(jsonGasPower.dev_26.CurrentElectricityQuantity)      --stroomverbruik totaal laagtarief
         local CurrentElectricityDeliveredHoog  = tonumber(jsonGasPower.dev_25.CurrentElectricityQuantity)      --stroomgeleverd momenteel hoogtarief
         local CurrentElectricityDeliveredLaag  = tonumber(jsonGasPower.dev_27.CurrentElectricityQuantity)      --stroomgeleverd momenteel laagtarief   
         local CurrentElectricityQuantity       =   CurrentElectricityFlowHoog + CurrentElectricityFlowLaag     --stroomverbruik totaal aktueel
         local totalDeliveredPower              = 0
         local totalDeliveredPower2             = CurrentElectricityDeliveredHoog/1000 + CurrentElectricityDeliveredLaag/1000      --stroomverbruik totaal geleverd
         local CurrentGasFlow                   = tonumber(jsonGasPower.dev_21.CurrentGasFlow)
         local CurrentGasQuantity               = tonumber(jsonGasPower.dev_21.CurrentGasQuantity)
         
        domoticz.devices(P1SmartMeterPower).updateP1(CurrentElectricityQuantityLaag, CurrentElectricityQuantityHoog, CurrentElectricityDeliveredLaag, CurrentElectricityDeliveredHoog, CurrentElectricityQuantity, totalDeliveredPower).silent()
        domoticz.devices(P1SmartMeterGas1).updateGas(CurrentGasQuantity).silent()
        --domoticz.log('*** P1 from toon: ' .. CurrentElectricityQuantityLaag/1000 .. 'kwh USAGE1 | ' ..CurrentElectricityQuantityHoog/1000 .. 'kwh USAGE2 | ' .. CurrentElectricityDeliveredLaag/1000 .. 'kwh RETURN1 | ' .. CurrentElectricityDeliveredHoog/1000 .. 'kwh RETURN2 | ' .. CurrentElectricityQuantity .. 'w consumed | '.. totalDeliveredPower2 .. 'w produced', domoticz.LOG_FORCE)


-- Update the Boiler Water In to current value
        local currentboilerInTemp = tonumber(jsonBoilerInfo.boilerInTemp)
        currentboilerInTemp = tonumber(string.format("%.0f", currentboilerInTemp))  -- afgeronde getallen is voldoende [PdB]
        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)
        currentboilerOutTemp = tonumber(string.format("%.0f", currentboilerOutTemp))  -- afgeronde getallen is voldoende [PdB]
        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)
--      currentBoilerPressure = tonumber(string.format("%.1f", currentBoilerPressure))  -- 1 decimaal is voldoende [PdB]
        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.LOG_INFO)
            domoticz.devices(ToonBoilerPressure).updatePressure(currentBoilerPressure).silent()
            
-- Update toon burner selector if it has changed            
        if CurrentToonBurnerValue ~= currentBurnerInfo then  
            domoticz.log('Updating Toon burner info:' ..currentBurnerInfo,domoticz.LOG_FORCE)
            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            
I hope this answer your question.
And i did not forget to give you the proper information
-= HP server GEN8 Xeon(R) E3-1220L_V2 -=- OZW -=- Toon2 (rooted) -=- Domoticz v2024.7 -=- Dashticz v3.12b on Tab8" =-
User avatar
madpatrick
Posts: 636
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: (rooted) Toon thermostat combined Get and Set script

Post by madpatrick »

For the people who are interested, the Plugin has been adjusted a bit.

Checkout the other thread for more info
viewtopic.php?p=296916#p296916

Pleaser give us your feedback
-= HP server GEN8 Xeon(R) E3-1220L_V2 -=- OZW -=- Toon2 (rooted) -=- Domoticz v2024.7 -=- Dashticz v3.12b on Tab8" =-
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests