Please Help Me Write This Piston


#1

1) Give a description of the problem
This is what I want to do in English:
IF lamp module is turned on by Alexa or Smart Things App THEN deactivate motion sensor 1 (which controls the lamp module) UNTIL lamp module is turned off through Alexa or Smart Things app

2) What is the expected behaviour?
See above

3) What is happening/not happening?
I am getting frustrated! I have found similar examples of what I want to do, and imported the code, but can’t get to work.

4) Post a Green Snapshot of the pistonimage
No image to attached
5) Attach logs after turning logging level to Full
(No logs to date


#2

Maybe something like this:

IF Sensor's motion changes to active
Then
    IF LampModule is on
    Then
        Do stuff
    END IF
END IF

Generally speaking, the control should only go one way. Either:

  • LampModule controls the MotionSensor
    or
  • MotionSensor controls the LampModule

Trying to do both at once will be a nightmare.


#3

Id take it one step further!

IF Sensor’s motion changes to active
Then
IF LampModule is off
Then
Turn Lamp On
Else
Do nothing (Meaning something else already has Light turned on)
END IF
END IF


#5

That would work as well, just be extra careful whenever using ELSE blocks. If you edit this piston at a later time, the ELSE portion may no longer do what you expect it to…


Generally speaking, I never recommend using ELSE until many months down the road when you are quite fluent in webCoRE logic (I know you’ve been here for awhile @logeox, so this advice is for others)