Away lighting simulator not triggering automatically

triggers

#1

Hi everyone, hoping I can get some help with a ‘vacation lighting’ type piston I’ve put together (from other examples). The first issue I have is that it doesn’t seem to get triggered automatically. As you can see from the screenshot, my conditions are SHM is Away and a specific time window. While we were out I checked these conditions were true but the piston hadn’t triggered. I also noticed earlier on in the day that unlike other pistons there was no countdown timer showing when it would be next executed so I had a feeling something wasn’t right. Can anyone help shed some light please?

I’ll ask the other questions later… :slight_smile:


#2

Add an IF statement that surrounds your while loop.

If all of present sensor 1, 2, and 3 are away
Then
(Put your while loop in here)
End if
(Your other IF follows here)


#3

Ah right ok will try that, thanks! The other two issues I found were:

  1. The light referenced in the push notifications to say it was turned on seemed to be different to the light which actually turned on. I need to test this a bit more closely but can you see any reason why that might happen?
  2. When we got home, there was a light still on even though my if logic at the end is supposed to turn all lights off. Is this something that might be resolved if I restructure the logic as you suggest above?

#4
  1. you are getting different results because you are calling the variable 3 separate times. In that variable you have the random function. So it’s giving a random light each time. You can solve this by using $currentEventDevice instead

  2. you should try the turn off command instead of turn all off. It also might help to after the restructure. So try that first. If still not working then try changing the command


#5

I will try that for 2. For 1, do you mean I use $currentEventDevice in the push notification?


#6

Correct. Use $currentEventDevice in the push notifications


#7

Appreciate the help @c1arkbar I have made those changes and will report back with results. Hopefully all sorted!


#8

Sorry, one other question. All of the lights in the ‘AvailableDevices’ variable except one are dimmable. What I’d like to include as part of the turn on logic is to set the light to 30% dim level but for the one light which isn’t dimmable, will this command just do nothing or will it cause some issue? The light in question is wired with a Fibaro double switch 2 module in case that helps.


#9

It will likely just skip that command if it is not a valid command for that device


#10

Perfect - that’ll work then. Thanks!


#11

OK so I’ve had a chance to test this Piston while we were out and I’ve got the following issue:

The notifications I was getting had the word “Home” instead of name of the light being switched on or off. I thought currentEventDevice should work but something is obviously not right.

Anyone know what I need to update please? Thanks!

Initially I was referring to the ‘RandomDevice’ variable in my notification message but that didn’t work.


#12

Anybody have an idea what I need to change in this please?


#13

I was also away last week and mine stopped working. The lights would turn off after the random time and then turn back on again without waiting for a random period. (Mine is a ‘while’ loop as well BTW).
I had an ‘IF’ like you have as well in mine but it was doing different things.
EDIT: Better clarify above statement. I had recently put an ‘IF’ in and that must have been the problem. It wasn’t part of the ‘WHILE’ though. It was a separate expression.
I deleted the ‘IF’ so that the piston only had a ‘WHILE’ in it.
It then started to work OK again.
Was yours doing similar and could this be the cause of your issue?


#14

Hmm I’m not convinced. The Piston functions fine, just the way I want it to and I tested it over several hours recently and it worked fine, switching lights on and off. It’s just the notification isn’t picking up the light which has been randomly selected to turn on. I thought currentEventDevice was the function to use for that kind of thing but it’s not working.


#15

OK. Yep. Different from my scenario.


#16

$currentEventDevice is just too deep. Is there a need to know which lights are turning on and off?


#17

I would have thought using the device held in the ‘RandomDevice’ variable would do it but when I had that in there before, the notification was giving me the name of a random light and not the one which was turned on or off. I’m guessing that’s because the variable had been re-evaluated.


#18

Ideally yes, I’d want to know, and it also helps me test the Piston in the early stages and make sure it’s working.


#19

OK so here is the Piston as it currently stands and again, it hasn’t triggered automatically and I can’t tell why. All the presence sensors are away and the time condition has also been met. Can anyone help please? I’ve also pasted the log.

Logs
9/22/2017, 7:12:47 PM +160ms
+1ms ╔Received event [John Doe1].presence = not present with a delay of 131ms
+219ms ║RunTime Analysis CS > 20ms > PS > 51ms > PE > 149ms > CE
+228ms ║Runtime (43165 bytes) successfully initialized in 51ms (v0.2.0e8.20170918) (227ms)
+229ms ║╔Execution stage started
+253ms ║║Comparison (enum) not present is (string) not present = true (3ms)
+256ms ║║Comparison (enum) not present is (string) not present = true (2ms)
+259ms ║║Comparison (enum) not present is (string) not present = true (2ms)
+262ms ║║Cancelling condition #20’s schedules…
+263ms ║║Condition #20 evaluated true (24ms)
+264ms ║║Cancelling condition #17’s schedules…
+265ms ║║Condition group #17 evaluated true (state changed) (27ms)
+275ms ║║Comparison (string) off is (string) away = false (3ms)
+277ms ║║Condition #5 evaluated false (9ms)
+278ms ║║Condition group #18 evaluated false (state did not change) (11ms)
+297ms ║║Comparison (enum) not present changes_to (string) present = false (1ms)
+300ms ║║Condition #15 evaluated false (16ms)
+301ms ║║Condition group #12 evaluated false (state did not change) (19ms)
+304ms ║╚Execution stage complete. (75ms)
+311ms ╚Event processed successfully (312ms)
9/22/2017, 7:11:40 PM +50ms
+1ms ╔Received event [John Doe2].presence = not present with a delay of 168ms
+238ms ║RunTime Analysis CS > 23ms > PS > 58ms > PE > 158ms > CE
+246ms ║Runtime (43161 bytes) successfully initialized in 58ms (v0.2.0e8.20170918) (244ms)
+248ms ║╔Execution stage started
+275ms ║║Comparison (enum) present is (string) not present = false (2ms)
+277ms ║║Condition #20 evaluated false (20ms)
+279ms ║║Condition group #17 evaluated false (state did not change) (21ms)
+301ms ║║Comparison (enum) not present changes_to (string) present = false (1ms)
+303ms ║║Condition #15 evaluated false (20ms)
+305ms ║║Condition group #12 evaluated false (state did not change) (21ms)


#20

Click the trace toggle to turn it on then use that green photo button. The green button will attach condition #s so the logs are actually readable. The trace will show you visually how the piston is evaluating.

So this is just a guess without the above info.

+275ms ║║Comparison (string) off is (string) away = false (3ms)

Pretty sure this is referring to your SHM status in the while statement. It looks like your SHM is not arming or it is not arming before this piston checks