I hope my Question is not too stupid. I try to control a dimmer (FUD61NPN) with a switch (FT55).
- short press and release in direction 2 shall switch the Dimmer ON
- short press and release in direction 1 shall switch the Dimmer OFF
- long press in direction 2 shall start dimming UP and with release the dimming UP shall be stopped.
- long press in direction 1 shall start dimming DOWN and with release the dimming DOWN shall be stopped
I have OpenHabian 2.5.4-1 running on a Raspberry Pi 4 with an Enocean USB300 Stick and the Enocean Binding.
I have added the Dimmer and the Switch as Things in Paper UI.
In the .items file I have defined the Dimmer.
Dimmer EG_WZ_Stehlampe_Dimmer "Stehlampe Dimmer" {channel="enocean:centralCommand:28511a76:dimmer"}
With the help of other topics I can separate the short presses from the long ones by rules. (only on direction here as example)
rule "FT55 UP Pressed"
when Channel "enocean:rockerSwitch:ff84741e:rockerswitchB" triggered "DIR2_PRESSED"
then
pressDIR2Timestamp= now.millis
EG_WZ_Stehlampe_Dimmer.sendCommand(INCREASE)
end
rule "FT55 UP Released"
when Channel "enocean:rockerSwitch:ff84741e:rockerswitchB" triggered "DIR2_RELEASED"
then
if(now.millis - pressDIR2Timestamp < 500)
{
// Long PRESS
} else {
// Short PRESS
EG_WZ_Stehlampe_Dimmer.sendCommand(100)
}
end
But I did not yet found a solution how to Start dimming with just the press of the switch and stopp dimming with the release of the switch.
I hope someone can help me with my problem.
Best regards,
Thomas