First of all, Thank you for your reply.
the devices are RGBWW.
ive found a script that is working for a milight i think.
The lights i'm using are flashed with tasmota. so i can change color true http, or mqtt.
ive found a script that is kinda working. only thing is i dont get the colors thrue. dimming is working.
Code: Select all
--[[ LEDSlaveDemo.lua (tested and working on dzVents 2.4.6) but probably also working on earlier versions
]]--
return {
on = { devices = {"Woonkamer lamp" } },
logging = { level = domoticz.LOG_DEBUG, -- switch to LOG_INFO when results are OK
marker = "LEDSlaveDemo" },
data = { setColor = { initial = true }, -- This is necessary because color does not follow in the first pass
dimLevel = { initial = 50 },
color = { initial = {} }},
execute = function(dz, trigger)
local slave = dz.devices("LED 1")
local slave1 = dz.devices("LED 2")
local slave2 = dz.devices("LED 3")
dz.log("Master ( name / state / level / color ) ( " ..
trigger.name .. " / " ..
trigger.state .. " / " ..
trigger.level .. " / " ..
trigger.color .. " )",dz.LOG_DEBUG)
colorTable = dz.utils.fromJSON(trigger.color) -- convert color (a json string) to a Lua table
if trigger.state ~= "Off" and trigger.level > 0 then -- State can be "On", "Off" or "set Color"
dz.data.dimLevel = trigger.level
dz.data.color = trigger.color
slave.setRGB( colorTable.r, colorTable.g, colorTable.b )
slave1.setRGB( colorTable.r, colorTable.g, colorTable.b )
slave2.setRGB( colorTable.r, colorTable.g, colorTable.b )
slave.dimTo(tonumber(dz.data.dimLevel))
slave1.dimTo(tonumber(dz.data.dimLevel))
slave2.dimTo(tonumber(dz.data.dimLevel))
if dz.data.setColor then -- We need to trigger the script another time as the color
dz.data.dimLevel = trigger.level -- does not follow the first pass. Does not seem timing but looks like
trigger.dimTo(dz.data.dimLevel) -- dzVents is not yet updated with right color values from master
dz.data.setColor = false
else
dz.data.setColor = true
end
else
slave.switchOff()
slave1.switchOff()
slave2.switchOff()
end
end
}
trying to get this to work properly. ive already seen functions Getcolor and Setcolor in dzvents.
ive done a lot of programming, never done lua.
i will see what you have made me.
thank you for your time.
Server running MQTT and Google assistent.
Server 2 running domoticz. 20+ lsc gu10 rgb bulbs.
Pir sensors. Nest hello, nest thermostat.Many more to come