Hi everyone,
I’m new to OpenHAB, so please forgive me when I ask stupid questions
I’m trying to implement smooth dimming of a Fibaro Dimmer 2 controlled with a Z-Wave Me wall controller. The controller sends different codes depending if a button is pressed, held or released.
What I’m trying to achieve is:
When I hold a button, I want the brightness to in-/decrease smoothly until the button is released.
My best working attempt so far is:
var int percent = 0
var Button1state = false
rule "Dim up"
when
Item ZWaveNode7_SceneNumber changed to 1.2
then
Button1state = true
var percent = ((ZWaveNode8FGD212Dimmer2_Dimmer.state as DecimalType)).intValue
while (percent < 100 && Button1state) {
percent = percent + 2
sendCommand("ZWaveNode8FGD212Dimmer2_Dimmer", new Integer(percent).toString)
Thread::sleep(100)
}
end
rule "Dim up end"
when
Item ZWaveNode7_SceneNumber changed to 1.1
then
Button1state=false
end
The problem is, when I put a sleep duration and brightness step that would look smooth and is reasonably fast (like 0-100 in 5s in steps of 2), the dimmer lags behind considerably and continues to change the brightness for quite some time (30-40s) after releasing the button. From logging I found that the dimmer only securely executes a new command every 1.5-2s which is clearly insufficient to achieve what I want.
Do you know any way I could get what I’m trying to do with rules?
Or alternatively: do you know any hardware dimmers (220V) that can react quickly enough for this kind of thing or wall controllers that allow dimming directly by slider or knob? Doesn’t necessarily have to be Z-wave; anything that does not require extra wiring is fine for me as I haven’t really decided yet what to put into the house.
Many thanks.