Re: Using Xiaomi Cube for dimming LED strip.
Posted: Saturday 03 August 2019 12:27
Can you try this ?Mayki wrote: Friday 02 August 2019 16:01 I need help with the script for dimming LED strip using Xiaomi Cube. Cube has states Rotate Left and Rotate Right. I wrote this script, but it doesn't work. Can you help me?
Code: Select all
return {
on = {
devices = {
'Zigbee - Cube'
}
},
execute = function(domoticz, device)
local HW = domoticz.devices('Hyperion Wall - RGB Light')
domoticz.log('Current dim level of ' .. HW.name .. ' = ' .. HW.level .. ' ; Cube action = ' .. device.state)
if device.state == 'Rotate Right' then
HW.dimTo(math.max((HW.level-10),0))
elseif device.state == 'Rotate Left' then
HW.dimTo(math.min((HW.level+10),100))
end
end
}