Controlling Toon via Domoticz

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

Moderators: marcelr, TheHogNL, Toonz

User avatar
madpatrick
Member
Member
Posts: 104
Joined: Wed Dec 06, 2017 9:52 pm
Location: Zuid-Holland

Re: Controlling Toon via Domoticz

Post by madpatrick »

Edwin66 wrote:
Screen Shot 2018-11-04 at 22.16.18.png
When i enter a number like dev_2.1 it gives an error right after putting it in, complaining about " expected ')' near '0.1' "

Guess this is something I need to work on tomorrow. Now it's time for other fun things
Is this in Domoticz or another program ?

Remove "." between 2.1
mAiden
Member
Member
Posts: 330
Joined: Mon Jul 10, 2017 10:22 am

Re: Controlling Toon via Domoticz

Post by mAiden »

Edwin,

You will have to search for the right dev. I'll have a look tonight, if I get him working, I can tell you which column you should look at.
Member of the Toon Software Collective
Edwin66
Member
Member
Posts: 79
Joined: Mon Aug 13, 2018 10:50 pm

Re: Controlling Toon via Domoticz

Post by Edwin66 »

madpatrick wrote:
Edwin66 wrote:
Screen Shot 2018-11-04 at 22.16.18.png
When i enter a number like dev_2.1 it gives an error right after putting it in, complaining about " expected ')' near '0.1' "

Guess this is something I need to work on tomorrow. Now it's time for other fun things
Is this in Domoticz or another program ?

Remove "." between 2.1
Was for domoticz. I indeed removed the '.' and seems to be working now.
Toon® (rooted) | Hue bulbs | TRÅDFRI bulbs | Smart Plug | Domoticz latest BETA |

I'm not a programmer, just wish things work MY way
Edwin66
Member
Member
Posts: 79
Joined: Mon Aug 13, 2018 10:50 pm

Re: Controlling Toon via Domoticz

Post by Edwin66 »

mAiden wrote:Edwin,

You will have to search for the right dev. I'll have a look tonight, if I get him working, I can tell you which column you should look at.
I seem to have it working now. At least, I don't see any error's anymore.
Toon® (rooted) | Hue bulbs | TRÅDFRI bulbs | Smart Plug | Domoticz latest BETA |

I'm not a programmer, just wish things work MY way
Edwin66
Member
Member
Posts: 79
Joined: Mon Aug 13, 2018 10:50 pm

Re: Controlling Toon via Domoticz

Post by Edwin66 »

Nu merk ik dat de Toon-devices in Domoticz niet meer goed werkten. Dacht ze eventjes opnieuw te maken, maar... helaas... pindakaas, niet dus.

Deze devices zouden toch goed moeten zijn, in combinatie met de dzVents script?
Image
Toon® (rooted) | Hue bulbs | TRÅDFRI bulbs | Smart Plug | Domoticz latest BETA |

I'm not a programmer, just wish things work MY way
User avatar
madpatrick
Member
Member
Posts: 104
Joined: Wed Dec 06, 2017 9:52 pm
Location: Zuid-Holland

Re: Controlling Toon via Domoticz

Post by madpatrick »

Check your Uservariables and then yor devices

Gebruikersvariabelen
Image

Apparaten
Image

What is your logfile saying ?
Edwin66
Member
Member
Posts: 79
Joined: Mon Aug 13, 2018 10:50 pm

Re: Controlling Toon via Domoticz

Post by Edwin66 »

Logfile wasn't saying anything at all. I think I've recreated the UV's and the devices. Next to do is adding the correct things to some of the devices. But that will have to wait till later this evening. Now first... a backup is in order, and then family visit. You know.. sunday
Toon® (rooted) | Hue bulbs | TRÅDFRI bulbs | Smart Plug | Domoticz latest BETA |

I'm not a programmer, just wish things work MY way
Edwin66
Member
Member
Posts: 79
Joined: Mon Aug 13, 2018 10:50 pm

Re: Controlling Toon via Domoticz

Post by Edwin66 »

I think I;m going to give up.

Again I recreated all the user-variables:

Image

and devices:
Image

Using the following script:

Code: Select all

return {
   on = {
      timer = {
         'every minute'
      }
   },
   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 boiler pressure
        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                     -- ToonIP
        local DomoticzIP            = domoticz.variables('UV_DomoticzIP').value                 -- DomoticzIP
        local ToonBurnerName        = domoticz.variables('UV_ToonBurnerName').value             --
        local P1SmartMeterPower     = domoticz.variables('UV_P1SmartMeterElectra').value        --
        local P1SmartMeterGas1      = domoticz.variables('UV_P1SmartMeterGasMeterStand').value  --
        local ToonBoilerSetpoint    = domoticz.variables('UV_ToonBoilerTempSetpoint').value     -- Sensor showing current boiler set point water temp out
    
        -- Handle json
        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 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_4.", "dev_4")
        GasPowerInfo = string.gsub(GasPowerInfo, "dev_4:", "dev_4\":")
        
        local jsonGasPower = json:decode(GasPowerInfo)
        
        domoticz.log(jsonGasPower)                -- Lines disabled due to lack of working P1 connection
            local CurrentElectricityFlowHoog         = tonumber(jsonGasPower.dev_22.CurrentElectricityFlow )
            local CurrentElectricityQuantityHoog     = tonumber(jsonGasPower.dev_22.CurrentElectricityQuantity)
            local CurrentElectricityFlowLaag         = tonumber(jsonGasPower.dev_26.CurrentElectricityFlow )
            local CurrentElectricityQuantityLaag     = tonumber(jsonGasPower.dev_26.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(P1SmartMeterGas1).updateGas(CurrentGasQuantity).silent()

-- 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

        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
        
        -- 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
   end
}
The only thing I can get working are the auto program and scenes .
Toon® (rooted) | Hue bulbs | TRÅDFRI bulbs | Smart Plug | Domoticz latest BETA |

I'm not a programmer, just wish things work MY way
User avatar
madpatrick
Member
Member
Posts: 104
Joined: Wed Dec 06, 2017 9:52 pm
Location: Zuid-Holland

Re: Controlling Toon via Domoticz

Post by madpatrick »

Don’t give up. It took me also some frustration and time to get it working smoothly.

Do you have the setpoint script enabled for the temparature setting.

Code: Select all

return {
	on = {
		devices = {
			'Toon Thermostat'
		}
	},
	execute = function(domoticz, device)
		domoticz.openURL(string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', domoticz.variables('UV_ToonIP').value, device.setPoint*100))
				domoticz.log('Setting Toon setpoint to '.. device.setPoint)
	end
}
If you need help to check on your system, just let me know.

Does the Boilerapp on your Toon gives you the boiler information ?
mAiden
Member
Member
Posts: 330
Joined: Mon Jul 10, 2017 10:22 am

Re: Controlling Toon via Domoticz

Post by mAiden »

I have a closer look at your script and user variable.

You miss the following user variable:

UV_ToonThermostat
* Create a setpoint dummy. with the name: ToonThermostat (By user variable you give it the name: UV_ToonThermostat and select string and add the name of the sensor, in this case: ToonThermostat.)
UV_ToonTemperature
* Create a temp sensor dummy with the name: ToonTemperature (By user variable you give it the name: UV_ToonTemperature and select string and add the name of the sensor, in this case: ToonTemperature.)
UV_P1SmartMeterElectra
* Create a P1 smart meter sensor dummy with the name: Stroom (By user variable you give it the name: UV_P1SmartMeterElectra and select string and add the name of the sensor, in this case: Stroom.)
UV_P1SmartMeterGasMeterStand
* Create a Gas sensor dummy with the name: Gas (By user variable you give it the name: UV_P1SmartMeterGasMeterStand and select string and add the name of the sensor, in this case: Gas.)

Replace this script, with the one do you have now. I have edited him for you, to you user variable. (back up the old one. ;) )

Code: Select all

return {
   on = {
      timer = {
         'every minute'
      }
   },
   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_ToonboilerOutTempname').value          -- Sensor showing current water temp out
        local ToonBoilerPressure    = domoticz.variables('UV_ToonBoilerPressure').value         -- Sensor showing current boiler pressure
        local ToonBoilerModulation  = domoticz.variables('UV_ToonBoilerModulationLevel').value       -- Sensor showing current Boiler Modulation
        local ToonScenes            = domoticz.variables('UV_ToonScenesSensorName').value                 -- Sensor showing current program
        local ToonAutoProgram       = domoticz.variables('UV_ToonAutoProgramSensorName').value            -- Sensor showing current auto program status
        local ToonProgramInformation= domoticz.variables('UV_ToonProgramInformationSensorName').value     -- Sensor showing displaying program information status
        local ToonIP                = domoticz.variables('UV_ToonIP').value                     -- ToonIP
        local DomoticzIP            = domoticz.variables('UV_DomoticzIP').value                 -- DomoticzIP
        local ToonBurnerName        = domoticz.variables('UV_ToonBurnerName').value             --
        local P1SmartMeterPower     = domoticz.variables('UV_P1SmartMeterElectra').value        --
        local P1SmartMeterGas1      = domoticz.variables('UV_P1SmartMeterGasMeterStand').value  --
        local ToonBoilerSetpoint    = domoticz.variables('UV_ToonBoilerTempSetpointSensorName').value     -- Sensor showing current boiler set point water temp out
    
        -- Handle json
        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 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_21.", "dev_21")
        GasPowerInfo = string.gsub(GasPowerInfo, "dev_21:", "dev_21\":")
        
        local jsonGasPower = json:decode(GasPowerInfo)
        
        domoticz.log(jsonGasPower)                -- Lines disabled due to lack of working P1 connection
            local CurrentElectricityFlowHoog         = tonumber(jsonGasPower.dev_25.CurrentElectricityFlow )
            local CurrentElectricityQuantityHoog     = tonumber(jsonGasPower.dev_25.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(P1SmartMeterGas1).updateGas(CurrentGasQuantity).silent()

-- 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

        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
        
        -- 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
   end
}
Member of the Toon Software Collective
TerrorSource
Administrator
Administrator
Posts: 494
Joined: Thu May 04, 2017 9:28 pm

Re: Controlling Toon via Domoticz

Post by TerrorSource »

Please let me know if there’s a typo or error in the manual so I can edit it if needed.
Edwin66
Member
Member
Posts: 79
Joined: Mon Aug 13, 2018 10:50 pm

Re: Controlling Toon via Domoticz

Post by Edwin66 »

madpatrick wrote:Don’t give up. It took me also some frustration and time to get it working smoothly.

Do you have the setpoint script enabled for the temparature setting.
i thought the dzVents script was replacing all the seprate scripts.

Does the Boilerapp on your Toon gives you the boiler information ?
Nope.

Trying with mAiden's edited script now.
Toon® (rooted) | Hue bulbs | TRÅDFRI bulbs | Smart Plug | Domoticz latest BETA |

I'm not a programmer, just wish things work MY way
Edwin66
Member
Member
Posts: 79
Joined: Mon Aug 13, 2018 10:50 pm

Re: Controlling Toon via Domoticz

Post by Edwin66 »

mAiden wrote:I have a closer look at your script and user variable.

You miss the following user variable:

UV_ToonThermostat
UV_ToonTemperature
UV_P1SmartMeterElectra
UV_P1SmartMeterGasMeterStand
Strange. I thought I had created those, must have clicked update instead of add . Added them, and now running your script. Hope it will work. Time will tell.

Maybe it's because I'm a little autistic that I don't get those things right off.
Toon® (rooted) | Hue bulbs | TRÅDFRI bulbs | Smart Plug | Domoticz latest BETA |

I'm not a programmer, just wish things work MY way
mAiden
Member
Member
Posts: 330
Joined: Mon Jul 10, 2017 10:22 am

Re: Controlling Toon via Domoticz

Post by mAiden »

Edwin66 wrote:
mAiden wrote:I have a closer look at your script and user variable.

You miss the following user variable:

UV_ToonThermostat
UV_ToonTemperature
UV_P1SmartMeterElectra
UV_P1SmartMeterGasMeterStand
Strange. I thought I had created those, must have clicked update instead of add . Added them, and now running your script. Hope it will work. Time will tell.

Maybe it's because I'm a little autistic that I don't get those things right off.
I hope it will work, Otherwise you know I am here to help you, we are going to get it fully working ;)
Member of the Toon Software Collective
User avatar
madpatrick
Member
Member
Posts: 104
Joined: Wed Dec 06, 2017 9:52 pm
Location: Zuid-Holland

Re: Controlling Toon via Domoticz

Post by madpatrick »

mAiden wrote:
Edwin66 wrote:
mAiden wrote:I have a closer look at your script and user variable.

You miss the following user variable:

UV_ToonThermostat
UV_ToonTemperature
UV_P1SmartMeterElectra
UV_P1SmartMeterGasMeterStand
Strange. I thought I had created those, must have clicked update instead of add . Added them, and now running your script. Hope it will work. Time will tell.

Maybe it's because I'm a little autistic that I don't get those things right off.
Check you log files. This always give you a lot of information.
Put logging on "debug" to see everything.


I hope it will work, Otherwise you know I am here to help you, we are going to get it fully working ;)
Post Reply

Return to “Toon external control”