dzVents: Interact with all switches and sensors using JSON with an optional delay argument
Posted: Tuesday 04 April 2017 10:07
This is a primarily a question for the author @dannybloe
Wouldn't it be nice to incorporate the following into Domoticz.lua ?
Some devices like the RGBW device seems to work best if controlled by API/Json URL commands. The small function below would help doing those commands and it also allows a delay (seconds).
I can make a pull request if you think this is useful ...
For controlling my RGBW ligt, it's essential for me. A pause of a few seconds seems needed after turning of a animation program and switching to a fixed color.
Wouldn't it be nice to incorporate the following into Domoticz.lua ?
Some devices like the RGBW device seems to work best if controlled by API/Json URL commands. The small function below would help doing those commands and it also allows a delay (seconds).
Code: Select all
-- Interact with all switches and sensors using JSON with an optional delay argument
function self.jsonAPI(apiCall, delay)
delay = delay or 0
local url = 'http://'..self.settings['Domoticz ip']..':'..self.settings['Domoticz port']..'/json.htm?'
if delay == 0 then
self.sendCommand('OpenURL', url..apiCall)
else
os.execute('(sleep '..delay..';curl -s "'..url..apiCall..'" > /dev/null)&')
end
end
For controlling my RGBW ligt, it's essential for me. A pause of a few seconds seems needed after turning of a animation program and switching to a fixed color.