Blame | Last modification | View Log | Download
local myResponsereturn {on = {devices = {'test'},shellCommandResponses = {'myResponse', -- must match with the callback passed to the executeShellCommand},},logging = {level = domoticz.LOG_INFO,marker = 'template',},execute = function(domoticz, item)if (item.isDevice) thendomoticz.executeShellCommand({command = 'speedtest-cli --json', -- just an examplecallback = 'myResponse', -- see shellCommandResponses above.timeout = 50, -- Max runtime 50 seconds})endif (item.isShellCommandResponse) thenif (item.statusCode==0) thenif (item.isJSON) thendomoticz.log('Download speed is '.. item.json.download,domoticz.LOG_INFO) -- 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}