Blame | Last modification | View Log | Download
return {on = {timer = {'every 5 minutes' -- just an example to trigger the request},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) thendomoticz.openURL({url = 'http://somedomain/someAPI?param=1',method = 'GET',callback = 'trigger', -- see httpResponses above.})endif (item.isHTTPResponse) thenif (item.ok) thenif (item.isJSON) thenlocal someValue = item.json.someValue -- just an example-- update some device in Domoticzdomoticz.devices('myTextDevice').updateText(someValue)endelsedomoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)domoticz.log(item, domoticz.LOG_ERROR)endendend}