Hi,
I added the arilux hardware and light, but needed a dummy switch to be able to have a switch in the app I could use to dim, setcolor etc.. Not sure if that is only an issue in my setup?
I now use the dummy switch with dzvents to relay the commands sent to the dumm onto the arilux light. Now for me on, off, dimming (set level) and setcolor works.
So basically the commands are sent to dummy device idx 32 (LED muurcirkel) and I relay them to idx 33.
Only thing I could not solve was the fact that I cannot find the arilux device light, the one with idx 33. Not by name or idx. However, targeting that idx with the api commands works fine. Maybe because the device shows up in the unused section of devices?
Another thing is that when the script starts running, the device.color is the color from the previous command. I did not find a very pretty solution, but by fetching via http response I could make it work .
Code: Select all
return
{
on =
{
devices =
{
'LED muurcirkel', -- idx or 'name' of your RGBW device
},
httpResponses = {
'httpLightInfo'
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'sendColor',
},
execute = function(domoticz, item)
if (item.isDevice) then
if item.sValue == 'On' then
domoticz.openURL({
url = "https://url_to_my_pi/json.htm?type=command¶m=switchlight&idx=33&switchcmd=On",
method = "GET"})
elseif item.sValue == 'Off' then
domoticz.openURL({
url = "https://url_to_my_pi/json.htm?type=command¶m=switchlight&idx=33&switchcmd=Off",
method = "GET"})
elseif string.find(item.sValue,"Set Level") then
domoticz.openURL({
url = "https://url_to_my_pi/json.htm?type=command¶m=switchlight&idx=33&switchcmd=Set%20Level&level=" .. item.levelVal .. "",
method = "GET"})
else
domoticz.openURL({
url = "https://url_to_my_pi/json.htm?type=devices&rid=32",
method = "GET",
callback = 'httpLightInfo'})
end
end
if (item.isJSON) then
json = domoticz.utils.fromJSON(item.data)
color_string = json.result[1].Color
domoticz.openURL({
url = "https://url_to_my_pi/json.htm?type=command¶m=setcolbrightnessvalue&idx=33&color=" .. color_string .. "",
method = "GET"})
end
end
}
Maybe this is useful for you as well.
Maureen