Controlling Toon via Domoticz

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

Moderators: marcelr, TheHogNL, TerrorSource, Toonz

Re: Controlling Toon via Domoticz

Postby TerrorSource » Wed Jan 09, 2019 9:03 am

yjb wrote:
TerrorSource wrote:
madpatrick wrote:Hello TerrorSource,

Is it possible to share the DOC-file.
I can update the manual for the DzVents script, update it and correct a few errors.


You can contact me via PM or email so I can edit the modifications in the PDF files ;)


Just wondering, was the manual ever updated?


Well, this is v2 with some minor modifications from v1.

Never received any comments on this version via PM so had no need to make a v3.
TerrorSource
Member
Member
 
Posts: 274
Joined: May 2017

Re: Controlling Toon via Domoticz

Postby madpatrick » Wed Jan 09, 2019 7:00 pm

I’ve offered my services to update the .doc file.
Collecting the changes and summarize it to PM is more work then direct making the changes in the original file, especially with pictures and comments.
But no problem..... the information is on the forum :)
User avatar
madpatrick
Member
Member
 
Posts: 77
Joined: December 2017
Location: Zuid-Holland

Re: Controlling Toon via Domoticz

Postby pietpiet50 » Mon Feb 11, 2019 3:07 pm

a big thankyou for the manual and the scripts.

Everything is working i think, but there are some errors in the logfile:

2019-02-11 14:42:42.280 (Toon) Light/Switch (ToonScenes)

2019-02-11 14:42:42.448 EventSystem: Sending SetPoint to device....

2019-02-11 14:42:42.453 (Toon) Thermostat (ToonThermostat)

2019-02-11 14:42:42.625 EventSystem: Sending SetPoint to device....

2019-02-11 14:42:42.630 (Toon) Thermostat (ToonThermostat)

2019-02-11 14:42:42.265 Status: User: Admin initiated a switch command (5/ToonScenes/Set Level)

2019-02-11 14:42:42.443 Status: LUA: Updating thermostat sensor to new set point: 19

2019-02-11 14:42:42.454 Status: EventSystem: Script event triggered: Toon

2019-02-11 14:42:42.463 Status: LUA: Updating 'ToonScenes' selector to 'Sleep'

2019-02-11 14:42:42.469 Status: EventSystem: Script event triggered: ToonSetpoint

2019-02-11 14:42:42.620 Status: LUA: Updating thermostat sensor to new set point: 16.5

2019-02-11 14:42:42.631 Status: EventSystem: Script event triggered: Toon

2019-02-11 14:42:42.636 Status: EventSystem: Script event triggered: ToonThermostat

2019-02-11 14:42:42.781 Status: LUA: Setting Toon setpoint to 16.50

2019-02-11 14:42:42.781 Status: EventSystem: Fetching url http://192.168.1.174/happ_thermstat?act ... int=1650...

2019-02-11 14:42:42.781 Status: EventSystem: Script event triggered: ToonThermostat

2019-02-11 14:42:42.443 Error: EventSystem: in Toon: [string "commandArray = {} ..."]:50: attempt to perform arithmetic on field '?' (a nil value)

2019-02-11 14:42:42.620 Error: EventSystem: in Toon: [string "commandArray = {} ..."]:50: attempt to perform arithmetic on field '?' (a nil value)

2019-02-11 14:42:42.775 Error: EventSystem: in Toon: [string "commandArray = {} ..."]:50: attempt to perform arithmetic on field '?' (a nil value)

2019-02-11 14:42:45.365 (Toon) Light/Switch (ToonScenes)

2019-02-11 14:42:45.352 Status: User: Admin initiated a switch command (5/ToonScenes/Set Level)

2019-02-11 14:42:45.444 Error: EventSystem: in Toon: [string "commandArray = {} ..."]:50: attempt to perform arithmetic on field '?' (a nil value)

What is going wrong on that lines?
Also on the tab temperatur, the toontemperature is Always 0 degrees, strange

Maybe it comes because of toon is not Always connected to the wifi network, it loses the connection. Also it reboot 12 times a day, with only 2 apps installed.
pietpiet50
Starting Member
Starting Member
 
Posts: 1
Joined: February 2019

Re: Controlling Toon via Domoticz

Postby emielfellinger » Sun Feb 17, 2019 9:12 am

Hi,

Great manual. Makes it easy :)
But i have the same error
Error: EventSystem: in Toon: [string "commandArray = {}..."]:50: attempt to perform arithmetic on field '?' (a nil value)
I double checked everything but can't seem to find what I did wrong.
emielfellinger
Starting Member
Starting Member
 
Posts: 1
Joined: February 2019

Re: Controlling Toon via Domoticz

Postby witteherder » Fri Feb 22, 2019 3:33 pm

Hi TerrorSource,

I have a question.
What I need to do else in step 5A (see attached file)

I choosed the tabblad Switches because I dont see tabblad Sensors!!!
Maybe I m in the wrong tabblad?
Attachments
5A.JPG
Step 5A
5A.JPG (83.67 KiB) Viewed 1384 times
Root Toon 2 User
Firmware version: 5.04
5 Neo Coolcam PowerPlus
Domotica Beginner (need little help in beginning)
witteherder
Starting Member
Starting Member
 
Posts: 14
Joined: January 2019

Re: Controlling Toon via Domoticz

Postby TerrorSource » Fri Feb 22, 2019 8:49 pm

witteherder wrote:Hi TerrorSource,

I have a question.
What I need to do else in step 5A (see attached file)

I choosed the tabblad Switches because I dont see tabblad Sensors!!!
Maybe I m in the wrong tabblad?


You did not read the manual :D You created a wrong dummy device. Please re-do the steps.
TerrorSource
Member
Member
 
Posts: 274
Joined: May 2017

Re: Controlling Toon via Domoticz

Postby TerrorSource » Sat Feb 23, 2019 9:44 pm

Mmhmm guys help! haha

I've got some issues with the manual myself :roll:
It's all setup following the manual and setting the temperatue via "ToonThermostat" via the Domoticz webpage works but it doesn't work from Domoticz app on my phone or via Siri (via HomeBridge connected to Domoticz).

Anyone got a clue how i can fix it? Nothing usefull in the logs when i use Siri.

2019-02-23 21:43:09.635 Status: LUA: Setting Toon setpoint to 11.5
2019-02-23 21:43:09.635 Status: EventSystem: Fetching URL http://192.168.192.13/happ_thermstat?ac ... point=1150 after 0.2 seconds...
2019-02-23 21:43:09.635 Status: EventSystem: Script event triggered: ToonThermostat
2019-02-23 21:43:09.762 Status: LUA: Updating thermostat sensor to new set point: 12
2019-02-23 21:43:09.776 Status: EventSystem: Script event triggered: Toon
2019-02-23 21:43:09.976 Status: EventSystem: Script event triggered: ToonThermostat
2019-02-23 21:43:10.104 Status: EventSystem: Script event triggered: Toon
2019-02-23 21:43:10.299 Status: LUA: Setting Toon setpoint to 12.00
2019-02-23 21:43:10.299 Status: EventSystem: Fetching URL http://192.168.192.13/happ_thermstat?ac ... point=1200 after 0.2 seconds...
2019-02-23 21:43:10.299 Status: EventSystem: Script event triggered: ToonThermostat
2019-02-23 21:43:10.429 Status: LUA: Updating thermostat sensor to new set point: 11.5
2019-02-23 21:43:10.440 Status: EventSystem: Script event triggered: Toon
2019-02-23 21:43:10.636 Status: EventSystem: Script event triggered: ToonThermostat
2019-02-23 21:43:10.764 Status: LUA: Updating thermostat sensor to new set point: 12
2019-02-23 21:43:10.784 Status: EventSystem: Script event triggered: Toon
2019-02-23 21:43:10.979 Status: EventSystem: Script event triggered: ToonThermostat
TerrorSource
Member
Member
 
Posts: 274
Joined: May 2017

Re: Controlling Toon via Domoticz

Postby TerrorSource » Sat Feb 23, 2019 11:11 pm

BOverdevest wrote:Based on several posts, I combined getting all Toon data to Domoticz in a single DzVents script. So both boiler data, thermostat data and the P1 data.
Now that I have a rooted Toon2 :D I had to update the script, as the P1 data apparently changed in the http://<ToonIP>/hdrv_zwave?action=getDevices.json.

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/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)
         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
}



I'm getting an errors using the script
Issue 1:
2019-02-23 23:16:00.445 Status: dzVents: Info: getSceneState: ------ Finished Slapen
2019-02-23 23:16:00.445 Status: dzVents: Info: ------ Start internal script: Toon:, trigger: every minute
2019-02-23 23:16:00.652 Status: dzVents: Error (2.4.14): An error occured when calling event handler Toon
2019-02-23 23:16:00.652 Status: dzVents: Error (2.4.14): /home/pi/domoticz/scripts/lua/JSON.lua:660: html passed to JSON:decode(): <?xml version="1.0" encoding="iso-8859-1"?>
2019-02-23 23:16:00.652 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2019-02-23 23:16:00.652 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2019-02-23 23:16:00.652 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
2019-02-23 23:16:00.652 <head>
2019-02-23 23:16:00.652 <title>404 - Not Found</title>
2019-02-23 23:16:00.652 </head>
2019-02-23 23:16:00.652 <body>
2019-02-23 23:16:00.652 <h1>404 - Not Found</h1>
2019-02-23 23:16:00.652 </body>
2019-02-23 23:16:00.652 </html>
2019-02-23 23:16:00.652
2019-02-23 23:16:00.652 Status: dzVents: Info: ------ Finished Toon

FIXED: Had to install ToonStore app "Boilerstatus"


Issue 2:
2019-02-24 00:08:00.478 Status: dzVents: Info: ------ Start internal script: Toon:, trigger: every minute
2019-02-24 00:08:00.809 Status: dzVents: Error (2.4.14): An error occured when calling event handler Toon
2019-02-24 00:08:00.809 Status: dzVents: Error (2.4.14): /home/pi/domoticz/dzVents/runtime/Domoticz.lua:169: attempt to perform arithmetic on local 'x' (a nil value)
2019-02-24 00:08:00.809 Status: dzVents: Info: ------ Finished Toon

Issue 3:
Cannot set temperature by using ToonThermostat. it doesn't send it to the Toon2.
FIXED: Used the DzVents script to set the setpoint, see https://www.domoticaforum.eu/viewtopic. ... =30#p88055

Issue 4:
ToonProgramInformation is not edited. looks like the function in the script is not working.



Also found out that the p1 data used is this:
Go to http://TOON_IP/hdrv_zwave?action=getDevices.json
copy the data to https://jsonlint.com/ to make it more readable and check the following:
For me it was dev_3, it can be dev_2 and dev_4 also.

"dev_3.1": {
"type": "gas", - gas
"dev_3.4": {
"type": "elec_delivered_nt", - afname normaal
"dev_3.5": {
"type": "elec_received_nt", - levering normaal
"dev_3.6": {
"type": "elec_delivered_lt", - afname laag
"dev_3.7": {
"type": "elec_received_lt",- levering laag

I had to fill in:
-- domoticz.log(jsonGasPower)
local CurrentElectricityFlowHoog = tonumber(jsonGasPower.dev_34.CurrentElectricityFlow )
local CurrentElectricityQuantityHoog = tonumber(jsonGasPower.dev_34.CurrentElectricityQuantity)
local CurrentElectricityFlowLaag = tonumber(jsonGasPower.dev_36.CurrentElectricityFlow )
local CurrentElectricityQuantityLaag = tonumber(jsonGasPower.dev_36.CurrentElectricityQuantity)
local CurrentGasFlow = tonumber(jsonGasPower.dev_31.CurrentGasFlow)
local CurrentGasQuantity = tonumber(jsonGasPower.dev_31.CurrentGasQuantity)
local CurrentElectricityQuantity = CurrentElectricityFlowHoog + CurrentElectricityFlowLaag
local CurrentElectricityDeliveredLaag = 0
local CurrentElectricityDeliveredHoog = 0
local totalDeliveredPower = 0
TerrorSource
Member
Member
 
Posts: 274
Joined: May 2017

Re: Controlling Toon via Domoticz

Postby anconakip » Mon Feb 25, 2019 3:05 pm

i have a Toon 1 rooted. But how can i get mij energy meters shown into domoticz?
anconakip
Starting Member
Starting Member
 
Posts: 16
Joined: February 2019

Re: Controlling Toon via Domoticz

Postby Markie13 » Mon Feb 25, 2019 9:36 pm

Hello people,

The following.
Is use a script from Ehoco.nl as last resort right now.
I would like to use this mode of operation on my Domoticz. Everything (scripts) seems to have been loaded properly, because I see no errors. Only the information will not been read by domoticz from my Toon. So no pressures readings, temperatures readings, statuses etc. Only manual temperature higher and lower succeeds.
All virtual sensors are correctly created as well as my user variables. My ToonIP is also known in Domoticz.
I also tried various scripts / manuals on domoticz forum and domoticaforum.eu.

I run Domoticz on an Ubuntu server because I had a spare NUC.

Can someone help me with this?

Thanks in advance

Image

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_ToonboilerInTempName').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 room temperature
        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 "/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)
        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 = domoticz.utils.round(tonumber(jsonThermostatInfo.currentTemp) / 100,1)
        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<br>                elseif currentActiveState == 4 then currentActiveState = 60 -- Holiday
            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<br>            elseif currentBurnerInfo == 3 then currentBurnerInfo = 10 -- voorverwarmen volgend setpoint
        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
}
Markie13
Starting Member
Starting Member
 
Posts: 19
Joined: May 2018

Re: Controlling Toon via Domoticz

Postby TerrorSource » Mon Feb 25, 2019 9:52 pm

Markie13 wrote:Hello people,

The following.
Is use a script from Ehoco.nl as last resort right now.
I would like to use this mode of operation on my Domoticz. Everything (scripts) seems to have been loaded properly, because I see no errors. Only the information will not been read by domoticz from my Toon. So no pressures readings, temperatures readings, statuses etc. Only manual temperature higher and lower succeeds.
All virtual sensors are correctly created as well as my user variables. My ToonIP is also known in Domoticz.
I also tried various scripts / manuals on domoticz forum and domoticaforum.eu.

I run Domoticz on an Ubuntu server because I had a spare NUC.

Can someone help me with this?

Thanks in advance



You know that Ehoco "steals" all the information from this forum without a proper source underneath it?

The script you copied is EXACTLY the one from Boverdevest on page 2/3.
TerrorSource
Member
Member
 
Posts: 274
Joined: May 2017

Re: Controlling Toon via Domoticz

Postby Markie13 » Mon Feb 25, 2019 9:58 pm

TerrorSource wrote:
You know that Ehoco "steals" all the information from this forum without a proper source underneath it?

The script you copied is EXACTLY the one from Boverdevest on page 2/3.


In that way I saw some similarities. But I didn't know. Sorry for that.
Markie13
Starting Member
Starting Member
 
Posts: 19
Joined: May 2018

Re: Controlling Toon via Domoticz

Postby anconakip » Tue Feb 26, 2019 1:18 pm

Markie13 wrote:
TerrorSource wrote:
You know that Ehoco "steals" all the information from this forum without a proper source underneath it?

The script you copied is EXACTLY the one from Boverdevest on page 2/3.


In that way I saw some similarities. But I didn't know. Sorry for that.


When i use this script i get the next error:

Status: dzVents: Info: ------ Start internal script: Toon:, trigger: every minute
2019-02-26 13:09:01.611 Status: dzVents: Error (2.4.14): An error occured when calling event handler Toon
2019-02-26 13:09:01.611 Status: dzVents: Error (2.4.14): /home/pi/domoticz/scripts/lua/JSON.lua:660: html passed to JSON:decode(): <?xml version="1.0" encoding="iso-8859-1"?>
2019-02-26 13:09:01.611 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2019-02-26 13:09:01.611 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2019-02-26 13:09:01.611 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
2019-02-26 13:09:01.611 <head>
2019-02-26 13:09:01.611 <title>404 - Not Found</title>
2019-02-26 13:09:01.611 </head>
2019-02-26 13:09:01.611 <body>
2019-02-26 13:09:01.611 <h1>404 - Not Found</h1>
2019-02-26 13:09:01.611 </body>
2019-02-26 13:09:01.611 </html>
2019-02-26 13:09:01.611
2019-02-26 13:09:01.612 Status: dzVents: Info: ------ Finished Toon

What should i do?
anconakip
Starting Member
Starting Member
 
Posts: 16
Joined: February 2019

Re: Controlling Toon via Domoticz

Postby marcelr » Tue Feb 26, 2019 3:46 pm

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.
marcelr
Global Moderator
Global Moderator
 
Posts: 1061
Joined: May 2012
Location: Ehv

Re: Controlling Toon via Domoticz

Postby Markie13 » Tue Feb 26, 2019 4:46 pm

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!
Markie13
Starting Member
Starting Member
 
Posts: 19
Joined: May 2018

PreviousNext

Return to Toon external control

Who is online

Users browsing this forum: No registered users and 1 guest

cron