I purchased a 4 pack of the red dimmers to use with my LIFX bulbs. I was hoping that being able to disable the internal relay would mean that I could still change what the “dimming level” of the switch was without actually decreasing power going to my smart bulbs and just Group the dimmer and my bulbs together so controlling one would update the other. That turned out not to be the case, though I’m still hoping they can squeeze that functionality in with a firmware update or at least let us control the indicator level. I put together a rule that mostly does what I wanted, though it isn’t as smooth of a dimming as it could be and I’d be able to accomplish the exact same with the switch as with the dimmer.
Basically I’ve setup the switches so 1 tap up or down turns the light on or off. 2 taps up turns the lights to 100% and 2 taps down turns them to 30%. Holding up or down dims or brightens the lights. And 3 taps controls the power to the lights just in case the LIFX bulbs stop communicating and need rebooted.
var Timer timer = null
val dim= [ GroupItem item, Integer amount |
val brightness = item.state as Number
var Boolean bool = false
if (brightness + amount > 100) item.sendCommand(100)
else if (brightness + amount < 0) item.sendCommand(0)
else {
item.sendCommand(brightness + amount)
bool = true
}
bool
]
// If using a color item directly:
// val dim= [ ColorItem item, Integer amount |
// val brightness = (item.state as HSBType).getBrightness()
// var Booleen bool = false
// if (brightness + amount > 100) item.sendCommand(100)
// else if (brightness + amount < 0) item.sendCommand(OFF)
// else {
// item.sendCommand(brightness + amount)
// bool = true
// }
// bool
// ]
rule "Bedroom Switch Scenes"
when
Item BRE_Dimmer_01_SceneNumber received update
then
switch BRE_Dimmer_01_SceneNumber.state {
case 1.0: {
GRP_BRE_Dimmer.sendCommand(OFF)
}
case 1.2: {
var dimAmount = -5
dim.apply(GRP_BRE_Dimmer, dimAmount)
timer = createTimer(now.plusMillis(500), [ |
dimAmount = dimAmount - 5
if (BRE_Dimmer_01_SceneNumber.state == 1.2) {
if (dim.apply(GRP_BRE_Dimmer, dimAmount)) timer.reschedule(now.plusMillis(500))
else timer = null
}
else timer = null
])
}
case 1.3: {
GRP_BRE_Dimmer.sendCommand(30)
}
case 1.4: {
BRE_Dimmer_01_Dimmer.sendCommand(OFF)
}
case 2.0: {
GRP_BRE_Dimmer.sendCommand(ON)
}
case 2.2: {
var dimAmount = 5
dim.apply(GRP_BRE_Dimmer, dimAmount)
timer = createTimer(now.plusMillis(500), [ |
dimAmount = dimAmount + 5
if (BRE_Dimmer_01_SceneNumber.state == 2.2) {
if (dim.apply(GRP_BRE_Dimmer, dimAmount)) timer.reschedule(now.plusMillis(500))
else timer = null
}
else timer = null
])
}
case 2.3: {
GRP_BRE_Dimmer.sendCommand(100)
}
case 2.4: {
BRE_Dimmer_01_Dimmer.sendCommand(ON)
}
}
end
GPR_BRE_Dimmer is an item group with a default type of dimmer that I put the LIFX bulbs color channel in. BRE_Dimmer_01 is the inovelli dimmer switch. I commented out some code that was applying the dimming to the Lifx bulb directly. I hope this helps someone. I’m sure it could be tweaked a bit to get a smoother dimming action. Not sure how short of a timer you can get away with without breaking something. And you can change the dimAmount = dimAmount + 5 line to control the ramp rate.