Page 5 of 12

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 2:40 pm
by Hypermobile
Adjusted somebody elses Script to get it to work with this new app:

It's for Domoticz:
1) make 5 UV_variables in domoticz
UV_ToonIP => {STRING} =192.168.x.x
UV_DomoticzIP => {STRING} = 192.168.x.x
UV_ToonboilerInTempName => {STRING} = BoilerInletTemp
UV_ToonboilerOutTempName => {STRING} = BoilerOutletTemp
UV_BoilerPressure => {STRINT} = BoilerPressure

2) Create 3 dummy sensor; with Name BoilerInletTemp, BoilerOutletTemp, BoilerPressure

3) Create a LUA TIME Event copy paste script.

Code: Select all

-- Time script runs every minute, intended to sync Domoticz with Toon in case the value is changed on the physical device.
-- Updates Toon ToonboilerOutTempName Sensor to value set on Toon
-- Updates Toon ToonboilerInTempName Sensor to value set on Toon
-- Updates Toon ToonboilerPressure sensor to value set on Toon 

commandArray = {}
    
    ToonboilerInTempName = uservariables['UV_ToonboilerInTempName'] -- Sensor inlet temperature
    ToonboilerOutTempName = uservariables['UV_ToonboilerOutTempName'] -- Sensor outlet temperature
    ToonboilerPressure  =   uservariables['UV_ToonboilerPressure'] -- ToonboilerPressure
    
  	ToonIP = uservariables['UV_ToonIP']
    DomoticzIP = uservariables['UV_DomoticzIP']

    json = assert(loadfile "/usr/local/domoticz/var/scripts/lua/JSON.lua")()  -- For Synology
    
local handle = assert(io.popen(string.format('curl http://%s/boilerstatus/boilervalues.txt', ToonIP)))
   local BoilerInfo = handle:read('*all')
handle:close()

-- JSON data from Toon contains a extra "," which should not be there.
BoilerInfo = string.gsub(BoilerInfo, ",}", "}")

jsonBoilerInfo = json:decode(BoilerInfo)
    
    currentboilerInTemp = tonumber(jsonBoilerInfo.boilerInTemp)
    currentboilerOutTemp = tonumber(jsonBoilerInfo.boilerOutTemp)
    currentboilerPressure = tonumber(jsonBoilerInfo.boilerPressure)
   
    -- Update the boilerInTemp
    if otherdevices_svalues[ToonboilerInTempName]*100 ~= currentboilerInTemp*100 then  
        print('Updating boiler inlet temp to new value: ' ..currentboilerInTemp)
        commandArray[1] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonboilerInTempName], currentboilerInTemp)}
    end
    
    -- Update the boilerOutTemp
    if otherdevices_svalues[ToonboilerOutTempName]*100 ~= currentboilerOutTemp*100 then 
        print('Updating boiler outlet temp to new value: ' ..currentboilerOutTemp)
        commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonboilerOutTempName], currentboilerOutTemp)}
    end

    -- Update the boilerPressure
    if otherdevices_svalues[ToonboilerPressure]*100 ~= currentboilerPressure*100 then 
        print('Updating boiler pressure to new value: ' ..currentboilerPressure)
        commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonboilerPressure], currentboilerPressure)}
    end

return commandArray
---EDITTED: added Pressure measurement
---EDITTED: added *100 to let the IF THEN work Correct

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 2:46 pm
by Hypermobile
To get more variables; i also adjusted this script found on this forum

You need to Make even more UV_Variables in Domoticz.
And also a Lua Time Script.

Code: Select all

-- Time script runs every minute, intended to sync Domoticz with Toon in case the value is changed on the physical device.
-- Updates Toon Thermostat Sensor to value set on Toon
-- Updates Toon Temperature Sensor to value set on Toon
-- Updates Toon Scenes switch based on program set on Toon
-- Updates Toon Auto Program switch to value set on Toon
-- Updates Toon program information text to value set on Toon
-- Updates Toon Burner status in order to see in domoticz if tyou boiler is on for the hotwater or heating or off (still is a undefined number which i must hunt down)

commandArray = {}

    ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
    ToonTemperatureSensorName = uservariables['UV_ToonTemperatureSensorName'] -- Sensor showing current room temperature
    ToonScenesSensorName  = uservariables['UV_ToonScenesSensorName'] -- Sensor showing current program
    ToonAutoProgramSensorName = uservariables['UV_ToonAutoProgramSensorName'] -- Sensor showing current auto program status
	ToonBurnerName = uservariables['UV_ToonBurnerName']
	ToonProgramInformationSensorName = uservariables['UV_ToonProgramInformationSensorName'] -- Sensor showing displaying program information status
	TooncurrentModulationLevel = uservariables['UV_TooncurrentModulationLevel'] -- Sensor showing displaying Current modulation leven
	ToonInternalBoilerSetpoint = uservariables['UV_ToonInternalBoilerSetpoint']
	ToonIP = uservariables['UV_ToonIP']
    DomoticzIP = uservariables['UV_DomoticzIP']

    json = assert(loadfile "/usr/local/domoticz/var/scripts/lua/JSON.lua")()  -- For Synology
    
local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
   local ThermostatInfo = handle:read('*all')
handle:close()

-- JSON data from Toon contains a extra "," which should not be there.
ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")

jsonThermostatInfo = json:decode(ThermostatInfo)
    
    currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
    currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
    currentProgramState = tonumber(jsonThermostatInfo.programState)
    currentActiveState = tonumber(jsonThermostatInfo.activeState)
    currentNextTime = jsonThermostatInfo.nextTime
	currentBurnerInfo = tonumber(jsonThermostatInfo.burnerInfo)
    currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
    currentModulationLevel = tonumber(jsonThermostatInfo.currentModulationLevel)
    currentInternalBoilerSetpoint = tonumber(jsonThermostatInfo.currentInternalBoilerSetpoint)
    
    -- Update the thermostat sensor to current setpoint
    if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then  
        print('Updating thermostat sensor to new set point: ' ..currentSetpoint)
        commandArray[1] = {['Variable:UV_ToonChangedByDomoticz'] = '1'} -- Set variable changed to 1 to prevent script ToonSetPoint from shooting an event at Toon
        commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonThermostatSensorName], currentSetpoint)}
    end
    
    -- Update the temperature sensor to current room temperature
    if otherdevices_svalues[ToonTemperatureSensorName]*100 ~= currentTemperature*100 then 
        print('Updating the temperature sensor to new value: ' ..currentTemperature)
        commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonTemperatureSensorName], currentTemperature)}
    end
    
    -- Update the toon scene selector sensor to current program state
    CurrentToonScenesSensorValue = otherdevices_svalues[ToonScenesSensorName]
    
    if currentActiveState == -1 then currentActiveState = '50' -- Manual
    elseif currentActiveState == 0 then currentActiveState = '40' -- Comfort
    elseif currentActiveState == 1 then currentActiveState = '30' -- Home
    elseif currentActiveState == 2 then currentActiveState = '20' -- Sleep
    elseif currentActiveState == 3 then currentActiveState = '10' -- Away
    end
    
    if CurrentToonScenesSensorValue ~= currentActiveState then  -- Update toon selector if it has changed
        print ('Updating Toon Scenes selector')
        commandArray[4] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonScenesSensorName], currentActiveState)}
    end
    
    -- Updates the toon auto program switch 
    CurrentToonAutoProgramSensorValue = otherdevices_svalues[ToonAutoProgramSensorName]
    
    if currentProgramState == 0 then currentProgramState = '10' -- No
    elseif currentProgramState == 1 then currentProgramState = '20' -- Yes
    elseif currentProgramState == 2 then currentProgramState = '30' -- Temporary       
    end
    
    if CurrentToonAutoProgramSensorValue ~= currentProgramState then -- Update toon auto program selector if it has changed
        print ('Updating Toon Auto Program selector')
        commandArray[5] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonAutoProgramSensorName], currentProgramState)}
    end
    
    -- Updates the toon program information text box
    CurrentToomProgramInformationSensorValue = otherdevices_svalues[ToonProgramInformationSensorName]
    if currentNextTime == 0 or currentNextSetPoint == 0 then
        ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
    else
        ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
    end
    
    if CurrentToomProgramInformationSensorValue ~= ToonProgramInformationSensorValue then
        commandArray[6] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonProgramInformationSensorName], ToonProgramInformationSensorValue)}
    end
	
 -- Update the toon burner selector to current program state
    CurrentToonBurnerValue = otherdevices_svalues[ToonBurnerName]  
	

	if currentBurnerInfo == 0 then currentBurnerInfo = '0' -- uit
    elseif currentBurnerInfo == 1 then currentBurnerInfo = '10' -- cv aan
    elseif currentBurnerInfo == 2 then currentBurnerInfo = '20' -- warmwater aan
    end
    
    if CurrentToonBurnerValue ~= currentBurnerInfo then  -- Update toon burner selector if it has changed
        print ('Updating Toon burner info')
        commandArray[7] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonBurnerName], currentBurnerInfo)}
    end
	

 -- Update the modulation level of the burner  
 
    if otherdevices_svalues[TooncurrentModulationLevel]+1 ~= currentModulationLevel+1 then 
        print('Updating the ModulationLevel to new value: ' ..currentModulationLevel)
        commandArray[8] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[TooncurrentModulationLevel], currentModulationLevel)}
    end
        
      -- Update the Internal Setpoint of the boiler  
    if otherdevices_svalues[ToonInternalBoilerSetpoint]+1 ~= currentInternalBoilerSetpoint+1 then 
        print('Updating the currentInternalBoilerSetpoint to new value: ' ..currentInternalBoilerSetpoint)
        commandArray[9] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonInternalBoilerSetpoint], currentInternalBoilerSetpoint)}
    end   
        
return commandArray

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 4:22 pm
by ams123
Image

ok i get zero to

how can i solf this

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 4:25 pm
by Toonz
ams123 wrote:Image

ok i get zero to

how can i solf this
Hi Ams123,

this app only works if you have a boiler which is controlled via the OpenTherm interface, not via the on/off protocol (you can check that in your Toon settings)

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 4:34 pm
by Hypermobile
@toonz

when i hit http://192.168.x.x:10080/hcb_rrd/ReadRRD.html
and just hit SEND:

i see somewhere in the file a Switch from NaN to 0,00

Code: Select all

 NaN,"1515074400": NaN,"1515078000": NaN,"1515081600": 0.00,"1515085200": NaN,"1515088800": 0.00,"1515092400": 0.00,"1515096000": 0.00,"1515099600": 0.00,"1515103200": 0.00,"1515106800":
i think, my Boiler doesn't sent that value back on OpenTherm.

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 4:34 pm
by ams123
Toonz wrote:
ams123 wrote:Image

ok i get zero to

how can i solf this
Hi Ams123,

this app only works if you have a boiler which is controlled via the OpenTherm interface, not via the on/off protocol (you can check that in your Toon settings)
OpenTherm is on

but i have the same problem i downgraded to happ-thermstat_1.554-trunk_qb2 can i upgrade that again

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 4:57 pm
by Hypermobile
domoticaforum.eu/viewtopic.php?t=11671& ... 895#p84770

check this:
i think he got the same problem and a Easier fix for it.

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 6:17 pm
by ams123
happ-thermstat_1.554-trunk_qb2n i am not downgrade to this so i have a ather problem that i not can see the pressur

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 7:24 pm
by jeltel
Great!

Too bad I don't have an internal pressure sensor, so all I get to see with the screensaver screen is two big zeroes. Id like to see the percentage of the flame more up front. That changes more than the pressure.

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 7:37 pm
by Toonz
jeltel wrote:Great!

Too bad I don't have an internal pressure sensor, so all I get to see with the screensaver screen is two big zeroes. Id like to see the percentage of the flame more up front. That changes more than the pressure.
Ok. I will make it configurable which value to display on the tile in dim state

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 7:53 pm
by gijsje
If i go to /happ_thermstat?action=printTableInfo it only gives me 0 on all values.
If i go to /hcb_rrd/ReadRRD.html it says 404 not found.

If i look at the toon i does see it is otgw boiler but i also says it can not connect to the boiler
Is there something else t check to get this to work?


Image
Image

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 7:56 pm
by Hypermobile
Toonz wrote:
jeltel wrote:Great!

Too bad I don't have an internal pressure sensor, so all I get to see with the screensaver screen is two big zeroes. Id like to see the percentage of the flame more up front. That changes more than the pressure.
Ok. I will make it configurable which value to display on the tile in dim state
I already changed it in the Code ;-)
now it shows Modulation level

Re: Toon app: boiler status

Posted: Sun Jan 21, 2018 8:50 pm
by Templar
Hypermobile wrote: I already changed it in the Code ;-)
now it shows Modulation level
In OpenTherm, the modulation levels are shown without the decimal fraction. So you can show it without the decimal separator & fraction.

Re: Toon app: boiler status

Posted: Mon Jan 22, 2018 12:45 pm
by gielie
Hypermobile wrote:Adjusted somebody elses Script to get it to work with this new app:

It's for Domoticz:
1) make 5 UV_variables in domoticz
UV_ToonIP => {STRING} =192.168.x.x
UV_DomoticzIP => {STRING} = 192.168.x.x
UV_ToonboilerInTempName => {STRING} = BoilerInletTemp
UV_ToonboilerOutTempName => {STRING} = BoilerOutletTemp
UV_BoilerPressure => {STRINT} = BoilerPressure

2) Create 3 dummy sensor; with Name BoilerInletTemp, BoilerOutletTemp, BoilerPressure

3) Create a LUA TIME Event copy paste script.

Code: Select all

-- Time script runs every minute, intended to sync Domoticz with Toon in case the value is changed on the physical device.
-- Updates Toon ToonboilerOutTempName Sensor to value set on Toon
-- Updates Toon ToonboilerInTempName Sensor to value set on Toon
-- Updates Toon ToonboilerPressure sensor to value set on Toon 

commandArray = {}
    
    ToonboilerInTempName = uservariables['UV_ToonboilerInTempName'] -- Sensor inlet temperature
    ToonboilerOutTempName = uservariables['UV_ToonboilerOutTempName'] -- Sensor outlet temperature
    ToonboilerPressure  =   uservariables['UV_ToonboilerPressure'] -- ToonboilerPressure
    
  	ToonIP = uservariables['UV_ToonIP']
    DomoticzIP = uservariables['UV_DomoticzIP']

    json = assert(loadfile "/usr/local/domoticz/var/scripts/lua/JSON.lua")()  -- For Synology
    
local handle = assert(io.popen(string.format('curl http://%s/boilerstatus/boilervalues.txt', ToonIP)))
   local BoilerInfo = handle:read('*all')
handle:close()

-- JSON data from Toon contains a extra "," which should not be there.
BoilerInfo = string.gsub(BoilerInfo, ",}", "}")

jsonBoilerInfo = json:decode(BoilerInfo)
    
    currentboilerInTemp = tonumber(jsonBoilerInfo.boilerInTemp)
    currentboilerOutTemp = tonumber(jsonBoilerInfo.boilerOutTemp)
    currentboilerPressure = tonumber(jsonBoilerInfo.boilerPressure)
   
    -- Update the boilerInTemp
    if otherdevices_svalues[ToonboilerInTempName]*100 ~= currentboilerInTemp*100 then  
        print('Updating boiler inlet temp to new value: ' ..currentboilerInTemp)
        commandArray[1] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonboilerInTempName], currentboilerInTemp)}
    end
    
    -- Update the boilerOutTemp
    if otherdevices_svalues[ToonboilerOutTempName]*100 ~= currentboilerOutTemp*100 then 
        print('Updating boiler outlet temp to new value: ' ..currentboilerOutTemp)
        commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonboilerOutTempName], currentboilerOutTemp)}
    end

    -- Update the boilerPressure
    if otherdevices_svalues[ToonboilerPressure]*100 ~= currentboilerPressure*100 then 
        print('Updating boiler pressure to new value: ' ..currentboilerPressure)
        commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonboilerPressure], currentboilerPressure)}
    end

return commandArray
---EDITTED: added Pressure measurement
---EDITTED: added *100 to let the IF THEN work Correct
Nice script but you wrote this to run on a synology, what do i need to change to make this work for a raspberry pi?
And how do i get the percentage in the dim screen instead of the pressure (my Tzerra doesn't report pressure :()

Re: Toon app: boiler status

Posted: Mon Jan 22, 2018 12:52 pm
by Toonz
gielie wrote:And how do i get the percentage in the dim screen instead of the pressure (my Tzerra doesn't report pressure :()
Will make this configurable in next release (soon) and remove the decimal digit for the percentage. Hang on.... :)