[RESOLVED] Motion Lighting not working properly

light
motion
piston

#1

1) Give a description of the problem
I have a bunch of lighting pistons based on motion but having an issue where this one is not updating the “programmatic” variable to true…

2) What is the expected behavior?
When motion occurs, turn light on to set value and then set variable to “true”. After inactivity for x period turn off and set variable to “false”.

3) What is happening/not happening?
Variable not being set to “True”

**4) Post a Green Snapshot of the piston!

5) Attach any logs (From ST IDE and by turning logging level to Full)
3/25/2019, 11:03:50 PM +840ms
+1ms ╔Received event [Upstairs Foyer Hallway].motion = active with a delay of 619ms
+184ms ║RunTime Analysis CS > 26ms > PS > 97ms > PE > 62ms > CE
+187ms ║Runtime (44352 bytes) successfully initialized in 97ms (v0.3.10a.20190223) (185ms)
+188ms ║╔Execution stage started
+238ms ║║Comparison (time) 83031033 is_between (time) 75600000 … (time) 1553514480000 = true (12ms)
+239ms ║║Time restriction check passed
+242ms ║║Condition #33 evaluated true (48ms)
+243ms ║║Condition group #null evaluated true (state did not change) (49ms)
+255ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+258ms ║║Cancelling condition #9’s schedules…
+259ms ║║Condition #9 evaluated true (13ms)
+270ms ║║Comparison (enum) off is (string) off = true (2ms)
+272ms ║║Condition #32 evaluated true (12ms)
+273ms ║║Cancelling condition #3’s schedules…
+275ms ║║Condition group #3 evaluated true (state changed) (29ms)
+278ms ║║Cancelling statement #29’s schedules…
+409ms ║║Executed physical command [Upstairs Hall Light].on() (128ms)
+411ms ║║Executed [Upstairs Hall Light].on (130ms)
+473ms ║║Executed physical command [Upstairs Hall Light].setLevel([1]) (58ms)
+474ms ║║Executed [Upstairs Hall Light].setLevel (60ms)
+482ms ║║Executed virtual command [Upstairs Hall Light].setVariable (3ms)
+496ms ║║Comparison (enum) active stays (string) inactive = false (2ms)
+498ms ║║Cancelling any timed trigger schedules for condition 47
+499ms ║║Cancelling statement #47’s schedules…
+500ms ║║Condition #47 evaluated false (14ms)
+502ms ║║Condition group #15 evaluated false (state did not change) (16ms)
+514ms ║║Comparison (enum) active stays (string) inactive = false (2ms)
+517ms ║║Cancelling any timed trigger schedules for condition 48
+518ms ║║Cancelling statement #48’s schedules…
+519ms ║║Condition #48 evaluated false (14ms)
+520ms ║║Condition group #25 evaluated false (state did not change) (15ms)
+530ms ║║Cancelling condition #43’s schedules…
+531ms ║║Condition #43 evaluated false (7ms)
+533ms ║║Cancelling condition #40’s schedules…
+534ms ║║Condition group #40 evaluated false (state changed) (11ms)
+538ms ║╚Execution stage complete. (349ms)
+539ms ╚Event processed successfully (539ms)


#2

Hi @pmjoen

I was looking at your piston
and i have a feeling that this piston can be more simple than what you have… Unless this is for learning, experimenting purposes…
Can you pls share what is it you want to accomplish in your house with this??


#3

I have 3 separate pistons that can probably move into a single one, but I haven’t gotten them to work 100% separately. Basically…

  • during a certain time frame
  • when motion is detected
  • turn the light on
  • then after a period of motion inactivity
  • turn off

The variable was there to tell the difference of when the webcore program triggered and when a manual toggle of switch triggered.


#4

This part is very simple:

IF motion sensor CHANGES TO ACTIVE (trigger)
AND
IF time is between X and Y (condition)
Then
With light bulb 
DO turn ON

(another IF block is to turn it OFF)
IF MOTION SENSOR stays INACTIVE FOR 3 MINUTES
Then
With light bulb
DO TURN OFF

Now I believe you have a smart switch and you want to monitor if the light bulb is turned ON with the switch correct?
if so, this example piston will take care of that to… no matter how the bulb turned ON if no motion for 3 minutes it will be OFF

if you want something like: If the light bulb is turned on with manual switch, no motion sensor interruption, yes variables are one of the ways to go… But keep the variable piston seperately,

IF my Switch CHANGES TO ON
Then
Set the globalvariable @lightstatus = true (this means someone turned the switch ON manually)

IF my Switch CHANGES TO OFF
Then
Set the globalvariable @lightstatus = FALSE (this means someone turned the switch OFF manually)

now lets go back to other piston and ADD another CONDITION to the IF block we created to turn it OFF

  IF motion sensor CHANGES TO ACTIVE (trigger)
    AND
    IF time is between X and Y (condition)
    Then
    With light bulb 
    DO turn ON

(another IF block is to turn it OFF)

IF MOTION SENSOR stays INACTIVE FOR 3 MINUTES
    AND
    **IF global variable @lightstatus = FALSE (meaning if not turned on via switch)**
    Then
    With light bulb
    DO TURN OFF

#5

I have this piston turning off with inactive motion at different times based on the variable.

IF motion is inactive for x seconds
AND light status = true
Then
With light bulb
DO turn OFF

IF motion is inactive for x minutes
AND light status = false
Then
With light bulb
DO turn OFF