Turning Off Porch Lights If Turned On During The Day


#1

Accomplish:

Turn off either porch light if they somehow go on during the day.

Issue:

The issue is that if I turn “White Bulb 1” on…it looks like the piston is firing twice and I receive the notification for “White Bulb 1” twice.

I’m not sure why this is happening other than (it could be?) “rule #20” is being triggered…evaluating to false…and continuing the script.

I’m not sure if that’s the case or not…but it also brings up the question of how do I efficiently run this script…to really only trigger it if the condition of:

  1. Between sunrise and sunset
  2. Switch turns on
  3. Don’t run the script otherwise

The other thought I had was to break this up into two separate pistons, but that seems inefficient too.

Just need some help here (still new to this) and trying to understand the architectural ins and out of this. I realize I may need another approach as well and I’m open to that. Thanks!


#3

Can you post a log of it firing twice?

One thing you can do quickly is change your IF conditions from “is on” to “changes to on”. That’s less likely to generate duplicate messages. But either way, turn on full logging and trip the piston to reveal what’s really happening.


#4

@michicago - Here you go…I press the button (in the Smartthings app) one time…it shuts off the light…and I get two notification messages.


1/22/2018, 2:19:55 PM +332ms
+2ms ╔Received event [Light: Back Porch].switch = on with a delay of 931ms
+10134ms ║RunTime Analysis CS > 24ms > PS > 10082ms > PE > 27ms > CE
+10134ms ║Piston waited at a semaphore for 10018ms
+10138ms ║Runtime (40085 bytes) successfully initialized in 10082ms (v0.2.102.20180116) (10135ms)
+10139ms ║╔Execution stage started
+10173ms ║║Comparison (time) 51605475 is_between (time) 1516632840000 … (time) 1516669980000 = true (7ms)
+10174ms ║║Time restriction check passed
+10175ms ║║Condition #1 evaluated true (33ms)
+10176ms ║║Condition group #null evaluated true (state did not change) (34ms)
+10185ms ║║Comparison (enum) off is (string) on = false (1ms)
+10187ms ║║Condition #11 evaluated false (8ms)
+10187ms ║║Condition group #2 evaluated false (state did not change) (9ms)
+10194ms ║║Comparison (enum) on is (string) on = true (1ms)
+10195ms ║║Cancelling condition #10’s schedules…
+10196ms ║║Condition #10 evaluated true (5ms)
+10196ms ║║Cancelling condition #6’s schedules…
+10197ms ║║Condition group #6 evaluated true (state changed) (7ms)
+10199ms ║║Cancelling statement #7’s schedules…
+10212ms ║║Executed physical command [Light: Back Porch].off() (9ms)
+10213ms ║║Executed [Light: Back Porch].off (11ms)
+10229ms ║║Executed virtual command [Light: Back Porch].sendNotificationToContacts (11ms)
+10232ms ║╚Execution stage complete. (94ms)
+10233ms ╚Event processed successfully (10233ms)


1/22/2018, 2:19:55 PM +819ms
+2ms ╔Received event [Light: Back Porch].switch = off with a delay of 1007ms
+117ms ║RunTime Analysis CS > 23ms > PS > 69ms > PE > 25ms > CE
+121ms ║Runtime (40001 bytes) successfully initialized in 69ms (v0.2.102.20180116) (117ms)
+121ms ║╔Execution stage started
+151ms ║║Comparison (time) 51595944 is_between (time) 1516632840000 … (time) 1516669980000 = true (7ms)
+152ms ║║Time restriction check passed
+154ms ║║Condition #1 evaluated true (29ms)
+155ms ║║Condition group #null evaluated true (state did not change) (29ms)
+164ms ║║Comparison (enum) off is (string) on = false (1ms)
+166ms ║║Condition #11 evaluated false (9ms)
+167ms ║║Condition group #2 evaluated false (state did not change) (11ms)
+174ms ║║Comparison (enum) off is (string) on = false (2ms)
+175ms ║║Cancelling condition #10’s schedules…
+176ms ║║Condition #10 evaluated false (6ms)
+177ms ║║Cancelling condition #6’s schedules…
+178ms ║║Condition group #6 evaluated false (state changed) (9ms)
+181ms ║╚Execution stage complete. (60ms)
+182ms ╚Event processed successfully (182ms)


1/22/2018, 2:19:55 PM +316ms
+1ms ╔Received event [Light: Back Porch].switch = on with a delay of 932ms
+85ms ║RunTime Analysis CS > 24ms > PS > 43ms > PE > 19ms > CE
+88ms ║Runtime (40004 bytes) successfully initialized in 43ms (v0.2.102.20180116) (87ms)
+89ms ║╔Execution stage started
+115ms ║║Comparison (time) 51595409 is_between (time) 1516632840000 … (time) 1516669980000 = true (7ms)
+116ms ║║Time restriction check passed
+118ms ║║Condition #1 evaluated true (26ms)
+119ms ║║Condition group #null evaluated true (state did not change) (26ms)
+128ms ║║Comparison (enum) off is (string) on = false (2ms)
+129ms ║║Condition #11 evaluated false (8ms)
+130ms ║║Condition group #2 evaluated false (state did not change) (10ms)
+136ms ║║Comparison (enum) on is (string) on = true (2ms)
+137ms ║║Cancelling condition #10’s schedules…
+138ms ║║Condition #10 evaluated true (6ms)
+139ms ║║Cancelling condition #6’s schedules…
+139ms ║║Condition group #6 evaluated true (state changed) (7ms)
+141ms ║║Cancelling statement #7’s schedules…
+148ms ║║Executed physical command [Light: Back Porch].off() (4ms)
+149ms ║║Executed [Light: Back Porch].off (6ms)
+165ms ║║Executed virtual command [Light: Back Porch].sendNotificationToContacts (11ms)
+168ms ║╚Execution stage complete. (80ms)
+169ms ╚Event processed successfully (169ms)


#5

Looks like ST received two on notifications and one off with 1 second. Your piston would have notified you of each of the On conditions.

Try changing your piston to “switch changes to on” instead of “is on” and see if that resolves it? Otherwise will need to see more logs to understand what’s going on so we can fix it.


#6

I tried “changes to on” and get two notifications when I try to turn on “White Bulb 1”



1/22/2018, 2:26:23 PM +286ms
+2ms ╔Received event [Light: Back Porch].switch = off with a delay of 625ms
+10161ms ║RunTime Analysis CS > 24ms > PS > 10109ms > PE > 28ms > CE
+10162ms ║Piston waited at a semaphore for 10043ms
+10165ms ║Runtime (40099 bytes) successfully initialized in 10109ms (v0.2.102.20180116) (10163ms)
+10166ms ║╔Execution stage started
+10199ms ║║Comparison (time) 51993456 is_between (time) 1516632840000 … (time) 1516669980000 = true (8ms)
+10200ms ║║Time restriction check passed
+10201ms ║║Condition #1 evaluated true (31ms)
+10202ms ║║Condition group #null evaluated true (state did not change) (33ms)
+10212ms ║║Condition #11 evaluated false (8ms)
+10213ms ║║Condition group #2 evaluated false (state did not change) (9ms)
+10219ms ║║Comparison (enum) off changes_to (string) on = false (0ms)
+10220ms ║║Cancelling condition #10’s schedules…
+10221ms ║║Condition #10 evaluated false (4ms)
+10222ms ║║Cancelling condition #6’s schedules…
+10222ms ║║Condition group #6 evaluated false (state changed) (7ms)
+10224ms ║╚Execution stage complete. (58ms)
+10225ms ╚Event processed successfully (10225ms)


1/22/2018, 2:26:22 PM +844ms
+1ms ╔Received event [Light: Back Porch].switch = on with a delay of 607ms
+10142ms ║RunTime Analysis CS > 22ms > PS > 10086ms > PE > 33ms > CE
+10142ms ║Piston waited at a semaphore for 10029ms
+10145ms ║Runtime (40101 bytes) successfully initialized in 10086ms (v0.2.102.20180116) (10143ms)
+10146ms ║╔Execution stage started
+10176ms ║║Comparison (time) 51992994 is_between (time) 1516632840000 … (time) 1516669980000 = true (8ms)
+10177ms ║║Time restriction check passed
+10178ms ║║Condition #1 evaluated true (28ms)
+10179ms ║║Condition group #null evaluated true (state did not change) (29ms)
+10188ms ║║Condition #11 evaluated false (6ms)
+10188ms ║║Condition group #2 evaluated false (state did not change) (7ms)
+10194ms ║║Comparison (enum) on changes_to (string) on = true (0ms)
+10195ms ║║Cancelling condition #10’s schedules…
+10195ms ║║Condition #10 evaluated true (4ms)
+10196ms ║║Cancelling condition #6’s schedules…
+10197ms ║║Condition group #6 evaluated true (state changed) (7ms)
+10199ms ║║Cancelling statement #7’s schedules…
+10210ms ║║Executed physical command [Light: Back Porch].off() (8ms)
+10211ms ║║Executed [Light: Back Porch].off (9ms)
+10223ms ║║Executed virtual command [Light: Back Porch].sendNotificationToContacts (7ms)
+10225ms ║╚Execution stage complete. (79ms)
+10226ms ╚Event processed successfully (10226ms)


1/22/2018, 2:26:23 PM +261ms
+1ms ╔Received event [Light: Back Porch].switch = off with a delay of 584ms
+292ms ║RunTime Analysis CS > 12ms > PS > 258ms > PE > 21ms > CE
+294ms ║Runtime (40018 bytes) successfully initialized in 258ms (v0.2.102.20180116) (292ms)
+295ms ║╔Execution stage started
+321ms ║║Comparison (time) 51983560 is_between (time) 1516632840000 … (time) 1516669980000 = true (7ms)
+322ms ║║Time restriction check passed
+324ms ║║Condition #1 evaluated true (25ms)
+325ms ║║Condition group #null evaluated true (state did not change) (26ms)
+333ms ║║Condition #11 evaluated false (6ms)
+334ms ║║Condition group #2 evaluated false (state did not change) (7ms)
+339ms ║║Comparison (enum) off changes_to (string) on = false (0ms)
+341ms ║║Cancelling condition #10’s schedules…
+341ms ║║Condition #10 evaluated false (4ms)
+342ms ║║Cancelling condition #6’s schedules…
+343ms ║║Condition group #6 evaluated false (state changed) (7ms)
+345ms ║╚Execution stage complete. (50ms)
+346ms ╚Event processed successfully (346ms)


1/22/2018, 2:26:22 PM +831ms
+1ms ╔Received event [Light: Back Porch].switch = on with a delay of 618ms
+78ms ║RunTime Analysis CS > 11ms > PS > 40ms > PE > 27ms > CE
+81ms ║Runtime (40016 bytes) successfully initialized in 40ms (v0.2.102.20180116) (79ms)
+82ms ║╔Execution stage started
+107ms ║║Comparison (time) 51982917 is_between (time) 1516632840000 … (time) 1516669980000 = true (7ms)
+108ms ║║Time restriction check passed
+109ms ║║Condition #1 evaluated true (24ms)
+110ms ║║Condition group #null evaluated true (state did not change) (25ms)
+119ms ║║Condition #11 evaluated false (6ms)
+119ms ║║Condition group #2 evaluated false (state did not change) (7ms)
+125ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+126ms ║║Cancelling condition #10’s schedules…
+127ms ║║Condition #10 evaluated true (5ms)
+128ms ║║Cancelling condition #6’s schedules…
+128ms ║║Condition group #6 evaluated true (state changed) (6ms)
+130ms ║║Cancelling statement #7’s schedules…
+138ms ║║Executed physical command [Light: Back Porch].off() (5ms)
+139ms ║║Executed [Light: Back Porch].off (7ms)
+150ms ║║Executed virtual command [Light: Back Porch].sendNotificationToContacts (6ms)
+152ms ║╚Execution stage complete. (71ms)
+153ms ╚Event processed successfully (153ms)


#7

Hmm this is strange…any of my lighting appliances (switches, plugs, bulbs) appear to be doubling up in the SmartThings “Recently Tab” (on/off logs) regardless of brand when they’re switched “on” or “off”


#8

Yeah, what kind of switches and device type handler are you using?

The dirty option, but it works, is to set a variable called “MessageRestrict” to addSeconds($now, 15) when a message is pushed. Then inside your IF condition add a condition that $now is after Messagerestrict before pushing another message.


#9

I just entered a chat session with SmartThings and they’re investigating. Will update once I have more info…


#10

Their first level support wasn’t able to resolve my issue and have escalated it up the chain. Waiting to hear back…


#11

I’m curious to hear what they come back with. The fact you’re seeing it across multiple devices makes it unlikely it’s a device type handler issue on your end.


#12

Here’s what they came back with…

In replies all text above this line is added to the ticket

Regina B. (SmartThings)

Feb 8, 12:02 PM MST

Hi,

Thanks for waiting, I know that it’s been a while since you have heard from us but I wanted to make sure that you knew we hadn’t forgotten about you. My name is Regina and I’m a technical lead assisting Dominic with this issue concerning duplicated device events.

We were able to pull some back-end logs for your events and passed them along to our engineers and found that this is more or less how the Hub behaves with these devices on your location. At this time, this is not something that we can correct.

As I understand it, this issue is impacting the functionality of WebCoRE. As you may already know, we did not create WebCoRE so we are unable to support it or provide guidance. However, you may be able to find a workaround for this duplicated device event issue on the SmartThings community: SmartThings Community.

Please let me know if you have any questions and I would be happy to provide any insight.

Thank you!

Regina B.
Technical Support Lead
SmartThings Support


#13

Sheesh, what a perfectly useless answer. The part where they try to redirect attention to webCoRE is of no help either… if the device is misbehaving with your hub, webCoRE has nothing to do with it.


#14

After some back and forth with their support, this is where things were left (for now). The issue is not isolated to just my hub…(read from bottom to top). I suppose if anyone else comes across this issue, they can reference my post and log another ticket with Smartthings support.


Hi Regina,

The best starting place I can give is this Sengled bulb: http://amzn.to/2HePW0K

The interesting thing is that this is officially supported by Smartthings: https://support.smartthings.com/hc/en-us/articles/115000523063-Sengled-Element-Classic-and-Plus

So hopefully that might help shed some light on things since Samsung does support this brand and its exhibiting the behavior that I describe.

Thanks for passing this along. In addition, I did reach out to the Webcore community and since these events are duplicating at the exact same time…there’s nothing they can do either. I know the creator of Webcore works for Smartthings now…and I hear Webcore is here to stay within the Samsung / Smartthings family.


Regina B. (SmartThings)

Feb 13, 4:58 PM MST

This is a good question. It is not specifically isolated to you. I can’t say for sure whether it is the brand of the devices you’re using since we have many users who have those devices but aren’t reporting these issues. On the same token though, they might not be using WebCoRE so they might not be seeing the negative impact. In short, we can usually deal with duplicated events from devices, but it looks like the reports from your devices are too close together for the Hub to deduplicate.

I have passed this along to our engineers, but I don’t have any timeline for when we will be able to correct this. In the meantime, you may want to reach out to the WebCoRE community and see if anyone else has faced this issue, and what they have done to work around it for now. You can check it out at https://community.webcore.co

Thanks,

Regina B.
Technical Support Lead
SmartThings Support


Feb 12, 11:48 AM MST

Is this isolated only to me? The brand of products I’m using? I know of at least one other person who can reproduce this behavior with their hub.

Regina B. (SmartThings)


Feb 10, 11:25 AM MST

I realize that it’s not an ideal situation to be in, and I am sorry for the bad news. Reading my previous reply, I realize I might have reported back to you in a way that made it sound like this was intentional behavior, but it is not. That is my bad for the miscommunication and I wanted to make sure that you are clear that it’s not an intentional behavior, but that we do not have a simple solution for it at this time. Thank you for understanding.

Best,

Regina B.
Technical Support Lead
SmartThings Support


Feb 8, 12:16 PM MST

Hi,

I would like to understand why you think it should behave this way as this does not make any sense to me. I do not find this to be an acceptable answer.