I'm using several shelly trv thermostats and as I want to use them without any cloud connections I have set up some script to retract temperature and and send a setpoint. For all additional information I would like to gather this in a single textbox and as something changes this will update.
So far I managed to create a script that gets me the batt status from a single shelly in to a textbox and from this point I'm stuck....
I any of you can help me out that would be great.
Script I use,
Code: Select all
return {
on = {
timer = {
'every hour'
},
httpResponses = {
'trigger' -- must match with the callback passed to the openURL command
}
},
logging = {
level = domoticz.LOG_INFO,
marker = 'template',
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'http://192.168.1.83/status',
method = 'GET',
callback = 'trigger', -- see httpResponses above.
})
end
if (item.isHTTPResponse) then
if (item.ok) then
if (item.isJSON) then
local BattValue = item.json.bat.value
--local mytext = 'Shelly slaapkamer battery level''..BattValue..'
domoticz.devices(258).updateText('Shelly slaapkamer battery level= '..BattValue..'%')
end
else
domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
domoticz.log(item, domoticz.LOG_ERROR)
end
end
end
}