Play a certain music playlist when someone arrives home


#1

1) Give a description of the problem
I want to play a certain playlist when someone arrives home.

2) What is the expected behavior?
My sonos will start playing my playlist when we arrive home.

3) What is happening/not happening?
It isn’t working at all.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
10/4/2018, 5:58:55 PM +847ms
+1ms ╔Received event [Home].mode = Home with a delay of 82ms
+146ms ║RunTime Analysis CS > 20ms > PS > 70ms > PE > 55ms > CE
+148ms ║Runtime (39768 bytes) successfully initialized in 70ms (v0.3.108.20180906) (147ms)
+150ms ║╔Execution stage started
+170ms ║║Comparison (time) 64736003 is_between (time) 43200000 … (time) 72000000 = true (11ms)
+171ms ║║Time restriction check passed
+174ms ║║Cancelling condition #9’s schedules…
+175ms ║║Condition #9 evaluated true (18ms)
+179ms ║║Comparison (string) :062a023dd7333a8b86feb07f041dfd0c: changes_to (string) :062a023dd7333a8b86feb07f041dfd0c: = false (1ms)
+181ms ║║Cancelling condition #10’s schedules…
+183ms ║║Condition #10 evaluated false (6ms)
+184ms ║║Condition group #1 evaluated false (state did not change) (28ms)
+186ms ║╚Execution stage complete. (37ms)
+188ms ╚Event processed successfully (188ms)

I don’t know why I can’t get this to work. It seems so simple but I have tried everything. Here is what is happening…I have a radio station that plays for the dogs when we are not home but I want a playlist to play once someone gets home. It doesn’t work. Any help would be greatly appreciated.

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Anybody have any suggestions for this?


#3

The log shows that one of the two conditions were false.
But I cannot tell which one because you have your Trace turned off.

You can turn it on up top, and then send a new green snapshot.

temp


#4

It will be false right now because nobody is Home and our house is in Away status. This is what I can’t figure out. It should just work when the Location Mode changes to Home.


#5

I do not structure my pistons the way you did, so I don’t have a good explanation, but this should work as intended:

temp

Coming home is the trigger, and the time is acting as a condition.


#6

Ah! OK, I see what you mean. I will change this and let you know if it worked. Thanks!


#7

Why do you have async turned on? You only have one action so that is unnecessary. I think that if you removed that it would work.


#8

I added async because it wasn’t working. I thought that it might help it to work, but it didn’t.


#9

Did import code “jht2” work for you?


#10

You don’t have to have the 2 separate ifs. They can go in the same statement.
IF
Location mode changes to Home
AND
Time is between x and y
THEN
DO z.


#11

You just posted the exact piston that was not working for her…


#12

Because of the asyn…i have almost the exact same piston and it works fine. You don’t need two separate ifs.


#13

@WCmore this didn’t work. Here are the logs and the piston. I can’t figure out why this won’t work.

10/10/2018, 3:57:09 PM +103ms
+0ms ╔Received event [Home].mode = Home with a delay of 83ms
+160ms ║RunTime Analysis CS > 23ms > PS > 87ms > PE > 50ms > CE
+163ms ║Runtime (39997 bytes) successfully initialized in 87ms (v0.3.108.20180906) (162ms)
+165ms ║╔Execution stage started
+178ms ║║Comparison (string) :062a023dd7333a8b86feb07f041dfd0c: changes_to (string) :062a023dd7333a8b86feb07f041dfd0c: = true (2ms)
+181ms ║║Cancelling condition #10’s schedules…
+182ms ║║Condition #10 evaluated true (9ms)
+184ms ║║Cancelling condition #1’s schedules…
+186ms ║║Condition group #1 evaluated true (state changed) (13ms)
+215ms ║║Comparison (time) 57429295 is_between (time) 43200000 … (time) 72000000 = true (18ms)
+218ms ║║Time restriction check passed
+222ms ║║Cancelling condition #12’s schedules…
+224ms ║║Condition #12 evaluated true (31ms)
+226ms ║║Cancelling condition #11’s schedules…
+227ms ║║Condition group #11 evaluated true (state changed) (37ms)
+232ms ║║Cancelling statement #7’s schedules…
+246ms ║║Sending internal web request to: 192.168.1.100:5005/preset/Jane
+251ms ║║Executed virtual command httpRequest (6ms)
+253ms ║║Requesting a wake up for Wed, Oct 10 2018 @ 3:57:29 PM EDT (in 20.0s)
+263ms ║╚Execution stage complete. (99ms)
+265ms ║Setting up scheduled job for Wed, Oct 10 2018 @ 3:57:29 PM EDT (in 19.99s)
+275ms ╚Event processed successfully (274ms)


#14

Please repost the pic with Trace turned on so I can see the numbers in grey.

Thanks


#15

Just hold on. It might be an issue with the GET request. I am just going to test this.


#16

It looks like your log shows every statement evaluating as true, so I agree with you. Testing the web address in a regular browser sounds like the next step.

You can also search here for Sonos Playlist to see some pistons that others have created.


#17

You could also make the action something simple, like turning on a light for example, just for testing.


#18

It worked today! I think once I changed the piston to @WCmore piston and then corrected the GET problem it works! Thanks for the help!


#19

what does this part actually do? I understand the URL has been masked.
image


#20

This is the GET request to my sonos speakers using Node server. I use this because you can set presets and group speakers. It looks like this https://IP address:5005/preset/Jane.