1) Give a description of the problem
I’m wondering if this is the most efficient way of writing this piston. I have it shown below. Can you all take a look and let me know if there is a better technique or an gotchas that I’m not seeing.
I’m new to webCoRE but not new to logic. I’m used to Windows PowerShell so some stuff translates. I’ll post more looking for other general help but I’ll keep this one to this specific piston.
2) What is the expected behavior?
Using two presence sensors, turn off one of two groups of lights depending on if someone leaves or both people leave.
- No need to take action if everyone is home
- If Andrew leaves but Rachel is present: turn off entry light and send SMS that “Andrew left but Rachel is still home. turned off entry lights”
- If Rachel leaves but Andrew is present: turn off entry light and send SMS that “Rachel left but Andrew is still home. turned off entry lights”
- if Andrew and Rachel leave: turn off switch entry, driveway, christmas tree and send SMS that “Everyone left and {noOneHome} turned off.”
3) What is happening/not happening?
This piston does work I’m wondering if there is a better way.
4) Post a Green Snapshot of the piston!
5) Attach any logs (From ST IDE and by turning logging level to Full)
Logs from webCoRE and not IDE. I turned the three lights on and presence on both sensors was present
- I set Andrew to not present and entry light went off and SMS was sent.
1a. I set Andrew to present and turned entry light on. - I set Rachel to not present and entry light went off and SMS was sent.
3 I set Andrew to not present (Rachel remained not present) and Entry, Driveway and Christmas Tree lights went off and SMS was sent.
12/3/2017, 9:45:35 PM +343ms +2ms ╔Received event [_A-Presence].presence = not present with a delay of 70ms +141ms ║RunTime Analysis CS > 15ms > PS > 81ms > PE > 44ms > CE +355ms ║Runtime (44414 bytes) successfully initialized in 81ms (v0.2.0ff.20171129) (351ms) +356ms ║╔Execution stage started +374ms ║║Comparison (enum) not present is (string) present = false (2ms) +376ms ║║Comparison (enum) not present is (string) present = false (1ms) +379ms ║║Cancelling condition #2's schedules... +446ms ║║Cancelling statement #12's schedules... +460ms ║║Executed virtual command setVariable (4ms) +462ms ║║Condition #2 evaluated false (98ms) +464ms ║║Cancelling condition #1's schedules... +465ms ║║Condition group #1 evaluated false (state changed) (101ms) +476ms ║║Comparison (enum) not present changes_to (string) not present = true (1ms) +479ms ║║Condition #25 evaluated false (12ms) +480ms ║║Condition group #24 evaluated false (state did not change) (13ms) +488ms ║║Comparison (boolean) false is (boolean) true = false (2ms) +490ms ║║Cancelling condition #9's schedules... +491ms ║║Condition #9 evaluated false (8ms) +492ms ║║Cancelling condition #6's schedules... +493ms ║║Condition group #6 evaluated false (state changed) (10ms) +501ms ║║Comparison (boolean) false is (boolean) true = false (2ms) +504ms ║║Cancelling condition #17's schedules... +505ms ║║Condition #17 evaluated false (9ms) +507ms ║║Condition group #23 evaluated false (state did not change) (10ms) +516ms ║║Comparison (boolean) false is (boolean) false = true (1ms) +517ms ║║Cancelling condition #33's schedules... +518ms ║║Condition #33 evaluated true (8ms) +519ms ║║Cancelling condition #28's schedules... +520ms ║║Condition group #28 evaluated true (state changed) (10ms) +523ms ║║Cancelling statement #29's schedules... +551ms ║║Executed physical command [Christmas Tree].off() (21ms) +552ms ║║Executed [Christmas Tree].off (23ms) +576ms ║║Executed physical command [Driveway Lights].off() (20ms) +577ms ║║Executed [Driveway Lights].off (22ms) +584ms ║║Skipped execution of physical command [Entry Lights].off([]) because it would make no change to the device. (3ms) +584ms ║║Executed [Entry Lights].off (5ms) +588ms ║║Cancelling statement #31's schedules... +600ms ║║Calculating (string) Everyone left and + (string) Christmas Tree, Driveway Lights and Entry Lights >> (string) Everyone left and Christmas Tree, Driveway Lights and Entry Lights +603ms ║║Calculating (string) Everyone left and Christmas Tree, Driveway Lights and Entry Lights + (string) turned off >> (string) Everyone left and Christmas Tree, Driveway Lights and Entry Lights turned off +621ms ║║Executed virtual command sendSMSNotification (11ms) +625ms ║╚Execution stage complete. (269ms) +633ms ╚Event processed successfully (633ms) 12/3/2017, 9:45:16 PM +58ms +1ms ╔Received event [_R-Presence].presence = not present with a delay of 64ms +133ms ║RunTime Analysis CS > 15ms > PS > 78ms > PE > 40ms > CE +153ms ║Runtime (44412 bytes) successfully initialized in 78ms (v0.2.0ff.20171129) (151ms) +154ms ║╔Execution stage started +170ms ║║Comparison (enum) present is (string) present = true (1ms) +173ms ║║Cancelling statement #3's schedules... +179ms ║║Executed virtual command setVariable (2ms) +181ms ║║Condition #2 evaluated true (21ms) +182ms ║║Condition group #1 evaluated true (state did not change) (22ms) +190ms ║║Comparison (boolean) true is (boolean) true = true (1ms) +191ms ║║Condition #9 evaluated true (6ms) +196ms ║║Comparison (enum) not present changes_to (string) not present = true (1ms) +197ms ║║Cancelling condition #10's schedules... +198ms ║║Condition #10 evaluated true (6ms) +199ms ║║Cancelling condition #6's schedules... +200ms ║║Condition group #6 evaluated true (state changed) (15ms) +203ms ║║Cancelling statement #7's schedules... +228ms ║║Executed physical command [Entry Lights].off() (20ms) +229ms ║║Executed [Entry Lights].off (21ms) +232ms ║║Cancelling statement #19's schedules... +240ms ║║Calculating (string) Rachel left but Andrew is home so + (string) Entry Lights >> (string) Rachel left but Andrew is home so Entry Lights +243ms ║║Calculating (string) Rachel left but Andrew is home so Entry Lights + (string) turned off >> (string) Rachel left but Andrew is home so Entry Lights turned off +257ms ║║Executed virtual command sendSMSNotification (8ms) +265ms ║║Comparison (boolean) true is (boolean) true = true (2ms) +267ms ║║Condition #17 evaluated true (5ms) +274ms ║║Condition #18 evaluated false (7ms) +275ms ║║Condition group #23 evaluated false (state did not change) (15ms) +283ms ║║Comparison (boolean) true is (boolean) false = false (1ms) +284ms ║║Condition #33 evaluated false (6ms) +288ms ║║Comparison (boolean) true changes_to (boolean) false = false (1ms) +290ms ║║Condition #34 evaluated false (4ms) +291ms ║║Condition group #28 evaluated false (state did not change) (13ms) +293ms ║╚Execution stage complete. (139ms) +301ms ╚Event processed successfully (301ms) 12/3/2017, 9:45:12 PM +455ms +1ms ╔Received event [_A-Presence].presence = present with a delay of 97ms +140ms ║RunTime Analysis CS > 16ms > PS > 82ms > PE > 43ms > CE +150ms ║Runtime (44410 bytes) successfully initialized in 82ms (v0.2.0ff.20171129) (148ms) +151ms ║╔Execution stage started +167ms ║║Comparison (enum) present is (string) present = true (1ms) +170ms ║║Cancelling statement #3's schedules... +179ms ║║Executed virtual command setVariable (6ms) +181ms ║║Condition #2 evaluated true (23ms) +182ms ║║Condition group #1 evaluated true (state did not change) (24ms) +189ms ║║Comparison (boolean) true is (boolean) true = true (2ms) +190ms ║║Condition #9 evaluated true (5ms) +197ms ║║Condition #10 evaluated false (6ms) +198ms ║║Condition group #6 evaluated false (state did not change) (14ms) +206ms ║║Comparison (boolean) true is (boolean) true = true (2ms) +208ms ║║Condition #17 evaluated true (6ms) +214ms ║║Comparison (enum) present changes_to (string) not present = false (1ms) +216ms ║║Cancelling condition #18's schedules... +217ms ║║Condition #18 evaluated false (8ms) +219ms ║║Cancelling condition #23's schedules... +220ms ║║Condition group #23 evaluated false (state changed) (19ms) +229ms ║║Comparison (boolean) true is (boolean) false = false (3ms) +231ms ║║Condition #33 evaluated false (6ms) +235ms ║║Comparison (boolean) true changes_to (boolean) false = false (1ms) +236ms ║║Condition #34 evaluated false (5ms) +237ms ║║Condition group #28 evaluated false (state did not change) (13ms) +240ms ║╚Execution stage complete. (88ms) +248ms ╚Event processed successfully (247ms) 12/3/2017, 9:45:00 PM +873ms +1ms ╔Received event [_A-Presence].presence = not present with a delay of 93ms +102ms ║RunTime Analysis CS > 11ms > PS > 57ms > PE > 33ms > CE +116ms ║Runtime (44412 bytes) successfully initialized in 57ms (v0.2.0ff.20171129) (114ms) +118ms ║╔Execution stage started +135ms ║║Comparison (enum) not present is (string) present = false (2ms) +137ms ║║Comparison (enum) present is (string) present = true (1ms) +142ms ║║Cancelling statement #3's schedules... +148ms ║║Executed virtual command setVariable (2ms) +150ms ║║Condition #2 evaluated true (25ms) +151ms ║║Condition group #1 evaluated true (state did not change) (27ms) +158ms ║║Comparison (boolean) true is (boolean) true = true (1ms) +160ms ║║Condition #9 evaluated true (6ms) +167ms ║║Condition #10 evaluated false (6ms) +168ms ║║Condition group #6 evaluated false (state did not change) (14ms) +175ms ║║Comparison (boolean) true is (boolean) true = true (2ms) +176ms ║║Condition #17 evaluated true (5ms) +181ms ║║Comparison (enum) not present changes_to (string) not present = true (1ms) +183ms ║║Cancelling condition #18's schedules... +184ms ║║Condition #18 evaluated true (7ms) +185ms ║║Cancelling condition #23's schedules... +186ms ║║Condition group #23 evaluated true (state changed) (16ms) +188ms ║║Cancelling statement #15's schedules... +210ms ║║Executed physical command [Entry Lights].off() (16ms) +210ms ║║Executed [Entry Lights].off (18ms) +213ms ║║Cancelling statement #21's schedules... +222ms ║║Calculating (string) Andrew left but Rachel is home so + (string) Entry Lights >> (string) Andrew left but Rachel is home so Entry Lights +225ms ║║Calculating (string) Andrew left but Rachel is home so Entry Lights + (string) turned off >> (string) Andrew left but Rachel is home so Entry Lights turned off +243ms ║║Executed virtual command sendSMSNotification (11ms) +251ms ║║Comparison (boolean) true is (boolean) false = false (2ms) +253ms ║║Condition #33 evaluated false (6ms) +257ms ║║Comparison (boolean) true changes_to (boolean) false = false (0ms) +259ms ║║Condition #34 evaluated false (5ms) +260ms ║║Condition group #28 evaluated false (state did not change) (14ms) +263ms ║╚Execution stage complete. (145ms) +275ms ╚Event processed successfully (275ms) Clear Full
REMOVE BELOW AFTER READING