I use a Fibaro FGS-223 and activated scenes. I basically want to have the switch on channel 1 to trigger the light connected to S2 when the toggle button / push button is held and released. Therefore I put “15” in the scene configuration of the FGS, which gives me correctly all scenes (also double press, etc.). Now I have the following rule:
rule "Light scene"
when
Item SCENE_LIGHT received update 1.0
then
if (LIGHT_2.state == ON) {
LIGHT_2.send(OFF)
} else {
LIGHT_2.send(ON)
}
end
Problem here is, that the “1.0” for press and hold is fired twice. First time when I press and hold the button and second time when I release it. This results in turning the light on shortly and then turning it off again. I am not able to press and hold the button to turn the light on and then subsequently do the same again to turn the light off.
Any idea how I could avoid the update being sent either too early (when I still hold the button) or after I release the button?
If the device is really sending this, then there’s probably not a lot you can do to stop it. It might pay to grab a debug log and provide it here showing the two events so I can check that they are decoded correctly since in general, the decimal part of this should change with the different events (ie key-down, key-up etc.).
I’ll look into the logs and if I don’t get further will send them here. But obviously - as the rule is only triggered on 1.0 I doubt then there’s a lot I can do.
One thing I use as a workaround now is that I’ve changed the rule to “changed to 1.0”, which then - clearly - doesn’t accept the same scene twice, so I have added a timer that sets the scene to 0 after 5 seconds. But that’s just a workaround.
Could you please let me know how I can best provide you the logs? When I look in the logfile, the scene number doesn’t change at all (thus I used the received update in the rule) when pressing / holding or releasing the button.
If I go in Karaf and set log:set debug it’s a huge mess and I don’t see anything any more.
Please just let me know what and how to provide, so I can send it over. Sorry for bothering, but I’m not too well at the debugging.
15:39:19.420 [INFO ] [marthome.event.ItemStateChangedEvent] - SCENE_LIGHT changed from NULL to 1.0
in the logs after a fresh start. Nothing else is reported. If I press the button short (as when I normally turn on the light) it changes to 1.3. But on press and hold it goes again to 1.0 and no further log entry.
Seems the “update” is sent when it goes into the state and when I release the key. But no change in value.
@chris and all others: I got a hint from @meschmesch who pointed me to change from “Toggle Switch” to “Momentary Switch” and – tadaa! It works now and the reported values are as reported by @sihui who also had that Toggle Switch setting as Momentary.
Thanks a lot for your help guys!
Still - as German speaker I have not understood the difference between momentary and toggle switch. Could somebody enlighten me, please? In German I would have translated both to “Taster”.
Edit: although a “Kippschalter” could also be technically a momentary switch from hardware side. But it is meant as “ON/OFF Switch”, “EIN/AUS Schalter”.
ah - I didn’t get that distinction, since there is a stable toggle switch and a toggle (without stable) switch and a momentary switch; so I thought that toggle and stable toggle are Taster vs. Schalter; I still don’t get then the difference between toggle and stable toggle.
Thanks a lot for your explanation. That helped me a lot!