Controlling Toon via Domoticz

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

Moderators: marcelr, TheHogNL, Toonz

Post Reply
TerrorSource
Administrator
Administrator
Posts: 494
Joined: Thu May 04, 2017 9:28 pm

Re: Controlling Toon via Domoticz

Post by TerrorSource »

Markie13 wrote:
marcelr wrote:When you use the Ehoco script, go and ask there ...

Not sure what your web client is asking for, but whatever it is, it's not in the place where it is expected.
Okay, then I will change my question.

As mentioned in my post, scripts, tutorials etc like in the 1ste post here didn't work as well! These script don't read my Toon. Im not asking to make that script working. Im asking to make all of your scripts read out my Toon!
You need to lower your tone. Looks like you are demanding that we fix your ̶s̶h̶i̶t̶ scripts. Which we are not doing the way you're talking right now.

This is a "Community", where we help each other out in a nice way but also a place where you can find the information you need yourself and do it yourself.
That last thing is what you should do. find the info you need and do it yourself. How do you think that the creator of that script found out about it? Right, he did it himself....
Markie13
Starting Member
Starting Member
Posts: 19
Joined: Sat May 05, 2018 9:16 pm

Re: Controlling Toon via Domoticz

Post by Markie13 »

Okay sorry for my tone.
Please tell me where this was going wrong?

For the full support of Domoticaforum I smurfed everthing to the script from Boverdevest. I can manually switch the switches, so it set scenes, auto program manually.

But still no status, temperature, pressure readings.

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 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 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/mark/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)
         local CurrentElectricityFlowHoog = tonumber(jsonGasPower.dev_44.CurrentElectricityFlow )
         local CurrentElectricityQuantityHoog = tonumber(jsonGasPower.dev_44.CurrentElectricityQuantity)
         local CurrentElectricityFlowLaag = tonumber(jsonGasPower.dev_46.CurrentElectricityFlow )
         local CurrentElectricityQuantityLaag = tonumber(jsonGasPower.dev_46.CurrentElectricityQuantity)
         local CurrentGasFlow = tonumber(jsonGasPower.dev_41.CurrentGasFlow)
         local CurrentGasQuantity = tonumber(jsonGasPower.dev_41.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
}
Image

Image

Image

I uncommented my energy meters
The funny thing The date of the readings. They all from yesterday :)

Any ideas what I can do?

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

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

script 1: Toon_setpoint

Code: Select all

return {
	on = {
		devices = {
			'Toon Thermostaat'
		}
	},
	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
}
script 2: Toon_script

Code: Select all

return {
   logging = {
      level = domoticz.LOG_FORCE, -- Select one of LOG_INFO, LOG_DEBUG, LOG_ERROR, LOG_FORCE to override system log level
      marker = "-=# P1 Toon #=-"
},
   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 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 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 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_FORCE)
            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
        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:')
            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
}

User variables

Code: Select all

	UV_P1SmartMeterGasMeterStand	  String	P1 Gas
	UV_P1SmartMeterElectra	  String	P1 Elektra
	UV_ToonBoilerModulation	  String	ModulationLevel
	UV_ToonBoilerPressure	  String	Keteldruk
	UV_ToonBoilerTempOut	  String	Ketel Temp UIT
	UV_ToonBoilerTempIn	  String	Ketel Temp IN
	UV_ToonBurnerName	String	  Ketelstand
	UV_ToonBoilerTempSetpoint	  String	Ketel Setpoint
	UV_DomoticzIP	String	  192.168.1.1:9200
	UV_ToonProgramInformation	  String	Toon Information
	UV_ToonAutoProgram	  String	Toon Auto Program
	UV_ToonScenes	String	  Toon Scenes
	UV_ToonTemperature	  String	Temperatuur Kamer
	UV_ToonIP	String	  192.168.1.200
	UV_ToonThermostat	String	  Toon Thermostaat
I hope this helps. uncomment or comment the function you want by '--'
Credits to the original creator of the script : BOverdevest


Logfile

Code: Select all

2019-02-26 19:42:00.336 Status: dzVents: Debug: Event triggers:
2019-02-26 19:42:00.336 Status: dzVents: Debug: - Timer
2019-02-26 19:42:00.350 Status: dzVents: Info: -=# P1 Toon #=-: ------ Start internal script: Toon_script:, trigger: every minute
2019-02-26 19:42:00.459 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for P1 Elektra: P1 smart meter energy device adapter
2019-02-26 19:42:00.459 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for P1 Gas: Gas device adapter
2019-02-26 19:42:00.460 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for Ketel Temp IN: Temperature device adapter
2019-02-26 19:42:00.460 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for Ketel Temp UIT: Temperature device adapter
2019-02-26 19:42:00.460 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for Keteldruk: Pressure device adapter
2019-02-26 19:42:00.460 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for Ketelstand: Switch device adapter
2019-02-26 19:42:00.461 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for ModulationLevel: Percentage device adapter
2019-02-26 19:42:00.461 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for Ketel Setpoint: Temperature device adapter
2019-02-26 19:42:00.461 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for Toon Thermostaat: Thermostat setpoint device adapter
2019-02-26 19:42:00.462 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for Temperatuur Kamer: Temperature device adapter
2019-02-26 19:42:00.462 Status: dzVents: Info: -=# P1 Toon #=-: Updating the temperature sensor to new value: 20.3
2019-02-26 19:42:00.462 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for Toon Scenes: Switch device adapter
2019-02-26 19:42:00.462 Status: dzVents: Debug: -=# P1 Toon #=-: Processing device-adapter for Toon Auto Program: Switch device adapter
2019-02-26 19:42:00.462 Status: dzVents: Info: -=# P1 Toon #=-: ------ Finished Toon_script
2019-02-26 19:42:00.462 Status: dzVents: Debug: Commands sent to Domoticz:
2019-02-26 19:42:00.462 Status: dzVents: Debug: - UpdateDevice = {["sValue"]="3758467;3490538;205163;620326;964;0", ["idx"]=302, ["nValue"]=0}
2019-02-26 19:42:00.462 Status: dzVents: Debug: - UpdateDevice = {["sValue"]="3169706", ["idx"]=300, ["nValue"]=0}
2019-02-26 19:42:00.462 Status: dzVents: Debug: - UpdateDevice = {["sValue"]="1.69", ["idx"]=262, ["nValue"]=0}
2019-02-26 19:42:00.462 Status: dzVents: Debug: - UpdateDevice = {["sValue"]="20.3", ["idx"]=256, ["nValue"]=0, ["_trigger"]=true}
2019-02-26 19:42:00.462 Status: dzVents: Debug: =====================================================
2019-02-26 19:42:00.564 Status: dzVents: Debug: Dumping domoticz data to /var/domoticz/scripts/dzVents/domoticzData.lua
2019-02-26 19:42:00.587 Status: dzVents: Debug: Processing device-adapter for Temperatuur Kamer: Temperature device adapter
Markie13
Starting Member
Starting Member
Posts: 19
Joined: Sat May 05, 2018 9:16 pm

Re: Controlling Toon via Domoticz

Post by Markie13 »

Thanks Madpatrick,

I will give this a try. I will let you know if it works. Many thanks :D
witteherder
Starting Member
Starting Member
Posts: 25
Joined: Thu Jan 10, 2019 2:28 pm

Re: Controlling Toon via Domoticz

Post by witteherder »

Do I have to delete at ToonBranderInfo the Level Name 30?
This is step 5C
Attachments
Step 5C
Step 5C
Step 5C.JPG (60.22 KiB) Viewed 7915 times
Toon 2 Rooted User
Firmware version: 5.94.7
Raspberry Pi 3B+
Domoticz 2022.1
10 Neo Coolcam PowerPlus
Domotica Beginner (need little help in beginning)
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 »

witteherder wrote:Do I have to delete at ToonBranderInfo the Level Name 30?
This is step 5C
No need to.
If there is no level 30 if will no be activated.
Also it is not a switch, pure info
hansgrave
Starting Member
Starting Member
Posts: 49
Joined: Sat Dec 23, 2017 12:42 pm

Re: Controlling Toon via Domoticz

Post by hansgrave »

Strange... i have exact the same problem... Changes make in Domoticz are sending to Toon but there is no info back from Toon to Domoticz. No temperature, no scenes etc. I don't use Domoticz for Toon often but i am sure it works before. Could frmware 5.0.4 has to do with it?
Homey, rooted Toon 1 and HomeAssistent.
yjb
Member
Member
Posts: 211
Joined: Fri Apr 17, 2009 1:15 pm
Location: Venhuizen, Netherlands

Re: Controlling Toon via Domoticz

Post by yjb »

Mine works fine with 5.04.

I'm using 2 scripts:
Toon-DZVents (Name doesn't matter, but you might need to change the device numbers in 60-65)

Code: Select all

return {
   on = {
      timer = {
         'every minute'
      }
   },
   execute = function(domoticz)
        local ToonThermostat        = domoticz.variables('UV_ToonThermostatSensorName').value          -- Sensor showing current setpoint
        local ToonTemperature       = domoticz.variables('UV_ToonTemperatureSensorName').value         -- Sensor showing current room temperature
        local ToonBoilerTempIn      = domoticz.variables('UV_ToonBoilerTempInName').value        -- Sensor showing water temp return
        local ToonBoilerTempOut     = domoticz.variables('UV_ToonBoilerTempOutName').value       -- Sensor showing current water temp out
        local ToonBoilerPressure    = domoticz.variables('UV_ToonboilerPressure').value      -- Sensor showing current Boiler Modulation
        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
        local DomoticzIP            = domoticz.variables('UV_DomoticzIP').value
        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 "C:\\Program Files (x86)\\Domoticz\\scripts\\lua\\json.lua")()  -- For Windows
        -- local json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux
        local json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Raspberry

        
        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)
         -- local CurrentElectricityFlowHoog = tonumber(jsonGasPower.dev_44.CurrentElectricityFlow )
         -- local CurrentElectricityQuantityHoog = tonumber(jsonGasPower.dev_44.CurrentElectricityQuantity)
         -- local CurrentElectricityFlowLaag = tonumber(jsonGasPower.dev_46.CurrentElectricityFlow )
         -- local CurrentElectricityQuantityLaag = tonumber(jsonGasPower.dev_46.CurrentElectricityQuantity)
         -- local CurrentGasFlow = tonumber(jsonGasPower.dev_41.CurrentGasFlow)
         -- local CurrentGasQuantity = tonumber(jsonGasPower.dev_41.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
            elseif currentBurnerInfo == 2 then currentBurnerInfo = 20 -- warmwater aan
            elseif currentBurnerInfo == 3 then currentBurnerInfo = 30 -- cv preheat
        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
}
And the second one: thermostat

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 the list of variables:

Code: Select all

"UV_ToonBoilerTempSetpointSensorName", "UV_ToonBurnerName", "UV_DomoticzIP", "UV_ToonThermostatSensorName", "UV_ToonIP", "UV_ToonTemperatureSensorName", "UV_ToonScenesSensorName", "UV_ToonChangedByDomoticz", "UV_ToonAutoProgramSensorName", "UV_ToonProgramInformationSensorName", "UV_ToonboilerModulationLevel", "UV_ToonboilerPressure", "UV_ToonBoilerTempInName", "UV_ToonBoilerTempOutName",
Make sure that you match the case, as I remember it di make a difference.
anconakip
Starting Member
Starting Member
Posts: 16
Joined: Sun Feb 24, 2019 11:07 am

Re: Controlling Toon via Domoticz

Post by anconakip »

Are these scripts for the toon 1?
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Controlling Toon via Domoticz

Post by marcelr »

I think they will work for both types. The interfacing software is the same.

... and that's a thousand :D
mAiden
Member
Member
Posts: 330
Joined: Mon Jul 10, 2017 10:22 am

Re: Controlling Toon via Domoticz

Post by mAiden »

Do not matter which Toon you have. Important is that the path to JSON file is correct and good.
And that the variable is set well, with the correct names. (The right information must also be present in the variable.)
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 »

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"}}
mAiden
Member
Member
Posts: 330
Joined: Mon Jul 10, 2017 10:22 am

Re: Controlling Toon via Domoticz

Post by mAiden »

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

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:
Your dev_numbers are in 3x and mine in 2x, so change 2 into 3 and it should work
anconakip
Starting Member
Starting Member
Posts: 16
Joined: Sun Feb 24, 2019 11:07 am

Re: Controlling Toon via Domoticz

Post by anconakip »

I still get the folowing error:

Status: dzVents: Error (2.4.15): -=# P1 Toon #=-: /home/pi/domoticz/scripts/lua/JSON.lua:660: html passed to JSON:decode(): <?xml version="1.0" encoding="iso-8859-1"?>

Does someone know what to do whit this?
Post Reply

Return to “Toon external control”