diff --git a/docs/source/Plugin/P000_Relay.rst b/docs/source/Plugin/P000_Relay.rst index 5208426db..d5f83d61b 100644 --- a/docs/source/Plugin/P000_Relay.rst +++ b/docs/source/Plugin/P000_Relay.rst @@ -207,7 +207,7 @@ Rules examples .. code-block:: none On Switch#State Do - if [Switch#State]=1 + if %eventvalue1%=1 GPIO,12,1 else GPIO,12,0 @@ -216,6 +216,10 @@ Rules examples This rule will turn the relay ON when the button is pressed, and OFF when released. +.. note:: + Events may be handled from an event queue, so by the time the event is being handled, the state of the switch can already be different. + Therefore it is best to use the state of the switch at the time the event was generated,using ``%eventvalue1%`` . + Indicators (recommended settings) --------------------------------- diff --git a/docs/source/Plugin/P000_Servo_motor.rst b/docs/source/Plugin/P000_Servo_motor.rst index 2ba751fbd..e320a166b 100644 --- a/docs/source/Plugin/P000_Servo_motor.rst +++ b/docs/source/Plugin/P000_Servo_motor.rst @@ -51,7 +51,7 @@ Rules examples .. code-block:: none On Switch#State Do - if [Switch#State]=1 + if %eventvalue1%=1 Servo,1,12,-45 Servo,2,14,45 else @@ -62,6 +62,11 @@ Rules examples This rule will tilt the servos 45° when the button is pressed, and it'll go back to 0 once released. +.. note:: + Events may be handled from an event queue, so by the time the event is being handled, the state of the switch can already be different. + Therefore it is best to use the state of the switch at the time the event was generated,using ``%eventvalue1%`` . + + Indicators (recommended settings) --------------------------------- diff --git a/docs/source/Plugin/P001_Switch.rst b/docs/source/Plugin/P001_Switch.rst index 25d251447..ff810c710 100644 --- a/docs/source/Plugin/P001_Switch.rst +++ b/docs/source/Plugin/P001_Switch.rst @@ -131,15 +131,19 @@ Rules examples .. code-block:: none on Switch#State do - if [Switch#State]=3 + if %eventvalue1%=3 //double click triggered! GPIO,12,0 else - GPIO,2,[Switch#State] + GPIO,2,%eventvalue1% GPIO,12,1 endif endon +.. note:: + Events may be handled from an event queue, so by the time the event is being handled, the state of the switch can already be different. + Therefore it is best to use the state of the switch at the time the event was generated,using ``%eventvalue1%`` . + .. Commands available .. ~~~~~~~~~~~~~~~~~~