Toon app: boiler status

Forum about forum-provided applications on Toon

Moderators: marcelr, TheHogNL, Toonz

Post Reply
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon app: boiler status

Post by Hypermobile »

I think you need to choose from these to make it work.

Code: Select all

json = assert(loadfile "C:\\Program Files (x86)\\Domoticz\\scripts\\lua\\json.lua")()  -- For Windows
json = assert(loadfile "/usr/local/domoticz/var/scripts/lua/JSON.lua")()  -- For Synology
json = assert(loadfile "/opt/domoticz/scripts/lua/JSON.lua")()  -- For Linux (LEDE)
Emacee
Starting Member
Starting Member
Posts: 5
Joined: Sat Jan 20, 2018 5:05 pm

Re: Toon app: boiler status

Post by Emacee »

gijsje wrote: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
I had exactly the same issue. The http://192.168.x.x/boilerstatus/boilervalues.txt shows this output (mostly zeroes except room temperature and setpoint):

Code: Select all

{"sampleTime":"22-01-2018 15:55:00","boilerSetpoint":0,"roomTempSetpoint":22,"boilerPressure":0,"roomTemp":21.63,"boilerOutTemp":0,"boilerInTemp":0,"boilerModulationLevel":35}
I then removed the Boiler Status app, let the Toon restart en reinstalled. Turned out that my Toon was set to on/off-mode rather then OpenTherm. After putting that back on it is working (except for the pressure but I'm not sure my boiler supports it). So you can try reinstalling the boiler app and restarting Toon. Maybe switch from OpenTherm to on/off and back to make sure that it is set correctly.

Code: Select all

{"sampleTime":"22-01-2018 16:18:00","boilerSetpoint":42.66,"roomTempSetpoint":22,"boilerPressure":0,"roomTemp":21.71,"boilerOutTemp":45,"boilerInTemp":44,"boilerModulationLevel":0}
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: boiler status

Post by Toonz »

Hi all,

A small update of the boilerstatus app (1.0.3) is available on ToonStore.
Changelog 1.0.3:
- you can select which value to display in dim state by clicking on the tile (when not in dim state obviously).
toggle between water pressure and relative burner modulation level.
The same value will be displayed again after reboot / restart of the gui.

It is bit creative to change the 'config' like this but is saves a separate config screen and therefor has a smaller memory footprint.

Kind regardz,

Toonz
member of the Toon Software Collective
gielie
Member
Member
Posts: 70
Joined: Thu Nov 02, 2017 11:06 am

Re: Toon app: boiler status

Post 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
The script works great, accept the pressure because i dont have that value.
Could you add the other parameters to the script like %modulation?
I tried it myself but it doesnt work, i replaced the pressure items for the Modulation parts with no luck.
Rudolf
Member
Member
Posts: 136
Joined: Mon Dec 04, 2017 8:50 pm

Re: Toon app: boiler status

Post by Rudolf »

For those with Home Assistant this might be helpful:

sensors.yaml

Code: Select all

- platform: rest
  name: Boiler Status
  json_attributes:
    - sampleTime
    - boilerSetpoint
    - roomTempSetpoint
    - boilerPressure
    - roomTemp
    - boilerOutTemp
    - boilerInTemp
    - boilerModulationLevel
  resource: http://toon/boilerstatus/boilervalues.txt
  value_template: '{{ value_json.sampleTime }}'

- platform: template
  sensors:
    sampleTime:
      friendly_name: 'SampleTime'
      value_template: '{{ states.sensor.boiler_status.attributes["sampleTime"] }}'

odelay99
Starting Member
Starting Member
Posts: 20
Joined: Thu May 11, 2017 11:07 am

Re: Toon app: boiler status

Post by odelay99 »

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
I also implemented this script in Domoticz but in the log it shows an error:

EventSystem: in toon_boiler: [string "-- Time script runs every minute, intended to..."]:31: attempt to perform arithmetic on field '?' (a nil value)

Does anone know how to correct this or give me a hint what I did wrong?
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon app: boiler status

Post by Hypermobile »

gielie wrote:
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
The script works great, accept the pressure because i dont have that value.
Could you add the other parameters to the script like %modulation?
I tried it myself but it doesnt work, i replaced the pressure items for the Modulation parts with no luck.
Current Setpoint
Current temp
Current programstate
Burner info
Modulation level;
Next setpoint.

I grab those from another IPTOON/happ_thermstat?action=getThermostatInfo
The BoilerStatus grabs Modulation levels; also from this location;
So i thought it's more usefull to get it at it's source

Check allso this Forum
https://www.domoticz.com/forum/viewtopic.php?t=11421

This is my LUA TIME EVENT:

You Need to create a WHole Bunch of USER Variables. to get it to work

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

if(ThermostatInfo ~= "") then

-- 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 
    
else
print ('Geen data terug')
end    
        
return commandArray
Attachments
uv_variabeles.JPG
uv_variabeles.JPG (73.43 KiB) Viewed 11918 times
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon app: boiler status

Post by Hypermobile »

GAS and Electricity

are done with PHP TimeScripts

but that maybe also possieble with a Lua Script
Hypermobile
Member
Member
Posts: 76
Joined: Sun Jan 14, 2018 5:12 pm

Re: Toon app: boiler status

Post by Hypermobile »

Minor issue:

IPTOON/boilerstatus/boilervalues.txt AFTER a FULL reboot

Code: Select all

"roomTempSetpoint":null,"boilerPressure":null
Pushed Comfort;

Code: Select all

"roomTempSetpoint":20.5,"boilerPressure":null
so after a Reboot; RoomTempSetpoint needs to change to be able to see it in the Boilervalues.txt

Also noticed that Boiler Pressure is now "NULL" or "NaN"
That was definitely 0.0 yesterday.
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: boiler status

Post by Toonz »

Hypermobile wrote:Minor issue:

IPTOON/boilerstatus/boilervalues.txt AFTER a FULL reboot

Code: Select all

"roomTempSetpoint":null,"boilerPressure":null
Pushed Comfort;

Code: Select all

"roomTempSetpoint":20.5,"boilerPressure":null
so after a Reboot; RoomTempSetpoint needs to change to be able to see it in the Boilervalues.txt

Also noticed that Boiler Pressure is now "NULL" or "NaN"
That was definitely 0.0 yesterday.
This is because the app is retrieving data from the rra databases of the last three seconds.
After a full reboot the app is starting up faster then the rra databases are getting populated.
This should automatically resolve itself pretty quickly after a full reboot.
member of the Toon Software Collective
glsf91
Member
Member
Posts: 184
Joined: Fri Sep 15, 2017 9:25 pm

Re: Toon app: boiler status

Post by glsf91 »

Hypermobile wrote:
Current Setpoint
Current temp
Current programstate
Burner info
Modulation level;
Next setpoint.

I grab those from another IPTOON/happ_thermstat?action=getThermostatInfo
The BoilerStatus grabs Modulation levels; also from this location;
So i thought it's more usefull to get it at it's source

Check allso this Forum
https://www.domoticz.com/forum/viewtopic.php?t=11421

This is my LUA TIME EVENT:

You Need to create a WHole Bunch of USER Variables. to get it to work

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

if(ThermostatInfo ~= "") then

-- 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 
    
else
print ('Geen data terug')
end    
        
return commandArray
Which kind of device type did you use for Modulation level and Next setpoint ?
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Toon app: boiler status

Post by RDNZL »

Great work!

I want to get this boilerstatus info from toon and implement it in my hass component, but I rather not install the boiler status app from toon app store.
Is it possible to install the app manually, outside the store?
If so where can I get the bin/src code for it?
Regards, Ron.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Toon app: boiler status

Post by RDNZL »

Oh wait, I probably only need the html code to get the json data, will try that first, thanks.
Regards, Ron.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Toon app: boiler status

Post by RDNZL »

No that's the rrd data lol...
Regards, Ron.
Emacee
Starting Member
Starting Member
Posts: 5
Joined: Sat Jan 20, 2018 5:05 pm

Re: Toon app: boiler status

Post by Emacee »

Rudolf wrote:For those with Home Assistant this might be helpful:

sensors.yaml

Code: Select all

- platform: rest
  name: Boiler Status
  json_attributes:
    - sampleTime
    - boilerSetpoint
    - roomTempSetpoint
    - boilerPressure
    - roomTemp
    - boilerOutTemp
    - boilerInTemp
    - boilerModulationLevel
  resource: http://toon/boilerstatus/boilervalues.txt
  value_template: '{{ value_json.sampleTime }}'

- platform: template
  sensors:
    sampleTime:
      friendly_name: 'SampleTime'
      value_template: '{{ states.sensor.boiler_status.attributes["sampleTime"] }}'

Works like a charm, thanks! Would be nice to split the attributes into different sensors so you are able to use it for graphing and grouping. I would have no idea where to start with that tough :lol:
Post Reply

Return to “Toon Apps”