Help with plex piston


#1

I created a piston that checks the status of my plex devices in my bedroom (I have two in my bedroom), If the device is playing than the piston closes my blinds.

Than if plex is not playing and is at a set time it opens my blinds up to a set level.

The problem is that the statements conflicts because I dont know how to sepearte a device so when I am playing a movie in my bedroom from one device but not the other the blind goes crazy trying to close and open at the same time.

I removed my second plex device so it does not go crazy…

Here is what I got so far:

Ideas welcome!


#2

would this work?

if roku 1 or roku 2 status is playing
   with master bedroom shade
      set level to 0%
else
    with master bedroom shade
      set level to 40% only when location mode is Home
end if

#3

@bangaliI Thanks. Going to try it when I get home from work.


#4

you are welcome. look forward to hearing the results. :slight_smile:


#5

Bad news… Didn’t work… I figure because we are not stating otherwise… It just going straight to the next statement which say that if is home open… So still a no go… :frowning:


#6

please share the latest snapshot. in piston view mode click the green button to get snapshot.


#7

Actually I found my mistake!
At least I think…

Give me a min to test and ill post back with the code!

TIA!


#8

ok, no problem :slight_smile:


#9

Well I thought I had a mistake but no… It behaved the same.
Here is what i got:


#10

so, one of the 2 devices is playing and master bedroom shade switch is on but it is still executing the else condition? is that what you see in the trace?

which of the 2 conditions showed as evaluating false in the trace?


#11

Here is what I got…
Not sure if this helps us find what you are asking?
Sorry for the noobnes :blush:

/7/2017, 8:02:24 PM +531ms
+2ms â•”Received event [ROKU Master].status = stopped with a delay of 65ms
+168ms â•‘Runtime (37063 bytes) successfully initialized in 76ms (v0.2.0e7.20170906) (165ms)
+168ms â•‘â•”Execution stage started
+231ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (43ms)
+232ms ║╚Execution stage complete. (64ms)
+240ms ╚Event processed successfully (240ms)
9/7/2017, 8:02:16 PM +200ms
+2ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 58ms
+200ms â•‘Runtime (37066 bytes) successfully initialized in 85ms (v0.2.0e7.20170906) (198ms)
+201ms â•‘â•”Execution stage started
+280ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (51ms)
+282ms ║╚Execution stage complete. (81ms)
+288ms ╚Event processed successfully (288ms)
9/7/2017, 8:02:15 PM +705ms
+0ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 52ms
+400ms â•‘Piston waited at a semaphore for 255ms
+402ms â•‘Runtime (37135 bytes) successfully initialized in 297ms (v0.2.0e7.20170906) (400ms)
+402ms â•‘â•”Execution stage started
+462ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (39ms)
+464ms ║╚Execution stage complete. (62ms)
+471ms ╚Event processed successfully (471ms)
9/7/2017, 8:02:15 PM +196ms
+1ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 54ms
+414ms â•‘Piston waited at a semaphore for 255ms
+416ms â•‘Runtime (37130 bytes) successfully initialized in 307ms (v0.2.0e7.20170906) (415ms)
+417ms â•‘â•”Execution stage started
+485ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (45ms)
+487ms ║╚Execution stage complete. (70ms)
+494ms ╚Event processed successfully (494ms)
9/7/2017, 8:02:14 PM +650ms
+2ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 60ms
+447ms â•‘Piston waited at a semaphore for 258ms
+449ms â•‘Runtime (37132 bytes) successfully initialized in 333ms (v0.2.0e7.20170906) (446ms)
+449ms â•‘â•”Execution stage started
+529ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (54ms)
+531ms ║╚Execution stage complete. (82ms)
+537ms ╚Event processed successfully (537ms)
9/7/2017, 8:02:14 PM +3ms
+1ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 58ms
+539ms â•‘Piston waited at a semaphore for 253ms
+547ms â•‘Runtime (37130 bytes) successfully initialized in 320ms (v0.2.0e7.20170906) (546ms)
+547ms â•‘â•”Execution stage started
+656ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (84ms)
+658ms ║╚Execution stage complete. (110ms)
+664ms ╚Event processed successfully (664ms)
9/7/2017, 8:02:13 PM +467ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 56ms
+432ms â•‘Piston waited at a semaphore for 259ms
+434ms â•‘Runtime (37135 bytes) successfully initialized in 330ms (v0.2.0e7.20170906) (433ms)
+434ms â•‘â•”Execution stage started
+510ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (51ms)
+511ms ║╚Execution stage complete. (77ms)
+517ms ╚Event processed successfully (517ms)
9/7/2017, 8:02:12 PM +967ms
+0ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 47ms
+405ms â•‘Piston waited at a semaphore for 257ms
+406ms â•‘Runtime (37133 bytes) successfully initialized in 300ms (v0.2.0e7.20170906) (405ms)
+407ms â•‘â•”Execution stage started
+468ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (38ms)
+469ms ║╚Execution stage complete. (63ms)
+476ms ╚Event processed successfully (476ms)
9/7/2017, 8:02:12 PM +421ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 58ms
+457ms â•‘Piston waited at a semaphore for 258ms
+459ms â•‘Runtime (37132 bytes) successfully initialized in 323ms (v0.2.0e7.20170906) (457ms)
+459ms â•‘â•”Execution stage started
+527ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (45ms)
+529ms ║╚Execution stage complete. (69ms)
+535ms ╚Event processed successfully (535ms)
9/7/2017, 8:02:11 PM +922ms
+1ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 56ms
+402ms â•‘Piston waited at a semaphore for 253ms
+404ms â•‘Runtime (37133 bytes) successfully initialized in 316ms (v0.2.0e7.20170906) (402ms)
+404ms â•‘â•”Execution stage started
+472ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (44ms)
+473ms ║╚Execution stage complete. (69ms)
+481ms ╚Event processed successfully (481ms)
9/7/2017, 8:02:01 PM +581ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 97ms
+10246ms â•‘Piston waited at a semaphore for 10083ms
+10247ms â•‘Runtime (37140 bytes) successfully initialized in 10144ms (v0.2.0e7.20170906) (10245ms)
+10248ms â•‘â•”Execution stage started
+10314ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (43ms)
+10315ms ║╚Execution stage complete. (68ms)
+10321ms ╚Event processed successfully (10321ms)
9/7/2017, 8:02:01 PM +255ms
+2ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 64ms
+10089ms â•‘Piston waited at a semaphore for 9836ms
+10091ms â•‘Runtime (37135 bytes) successfully initialized in 9911ms (v0.2.0e7.20170906) (10089ms)
+10091ms â•‘â•”Execution stage started
+10165ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (50ms)
+10166ms ║╚Execution stage complete. (75ms)
+10172ms ╚Event processed successfully (10172ms)
9/7/2017, 8:02:00 PM +718ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 100ms
+435ms â•‘Piston waited at a semaphore for 258ms
+437ms â•‘Runtime (37133 bytes) successfully initialized in 330ms (v0.2.0e7.20170906) (436ms)
+437ms â•‘â•”Execution stage started
+502ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (42ms)
+504ms ║╚Execution stage complete. (67ms)
+510ms ╚Event processed successfully (511ms)
9/7/2017, 8:01:59 PM +892ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 80ms
+448ms â•‘Piston waited at a semaphore for 257ms
+450ms â•‘Runtime (37135 bytes) successfully initialized in 343ms (v0.2.0e7.20170906) (448ms)
+450ms â•‘â•”Execution stage started
+521ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (48ms)
+523ms ║╚Execution stage complete. (72ms)
+530ms ╚Event processed successfully (530ms)
9/7/2017, 8:01:59 PM +421ms
+1ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 59ms
+421ms â•‘Piston waited at a semaphore for 258ms
+423ms â•‘Runtime (37130 bytes) successfully initialized in 319ms (v0.2.0e7.20170906) (422ms)
+423ms â•‘â•”Execution stage started
+488ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (42ms)
+490ms ║╚Execution stage complete. (67ms)
+496ms ╚Event processed successfully (496ms)
9/7/2017, 8:01:58 PM +671ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 45ms
+653ms â•‘Piston waited at a semaphore for 510ms
+655ms â•‘Runtime (37132 bytes) successfully initialized in 555ms (v0.2.0e7.20170906) (654ms)
+655ms â•‘â•”Execution stage started
+715ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (38ms)
+717ms ║╚Execution stage complete. (62ms)
+724ms ╚Event processed successfully (724ms)
9/7/2017, 8:01:58 PM +319ms
+1ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 55ms
+675ms â•‘Piston waited at a semaphore for 513ms
+677ms â•‘Runtime (37133 bytes) successfully initialized in 577ms (v0.2.0e7.20170906) (676ms)
+677ms â•‘â•”Execution stage started
+737ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (37ms)
+739ms ║╚Execution stage complete. (62ms)
+745ms ╚Event processed successfully (745ms)
9/7/2017, 8:01:57 PM +887ms
+2ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 259ms
+697ms â•‘Piston waited at a semaphore for 515ms
+699ms â•‘Runtime (37131 bytes) successfully initialized in 595ms (v0.2.0e7.20170906) (697ms)
+699ms â•‘â•”Execution stage started
+777ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (54ms)
+778ms ║╚Execution stage complete. (79ms)
+785ms ╚Event processed successfully (785ms)
9/7/2017, 8:01:57 PM +984ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 83ms
+231ms â•‘Runtime (37068 bytes) successfully initialized in 43ms (v0.2.0e7.20170906) (230ms)
+232ms â•‘â•”Execution stage started
+299ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (44ms)
+301ms ║╚Execution stage complete. (69ms)
+308ms ╚Event processed successfully (308ms)
9/7/2017, 8:01:57 PM +147ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 91ms
+441ms â•‘Piston waited at a semaphore for 257ms
+443ms â•‘Runtime (37135 bytes) successfully initialized in 339ms (v0.2.0e7.20170906) (441ms)
+443ms â•‘â•”Execution stage started
+579ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (112ms)
+580ms ║╚Execution stage complete. (137ms)
+711ms ╚Event processed successfully (712ms)
9/7/2017, 8:01:56 PM +905ms
+2ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 57ms
+185ms â•‘Runtime (37066 bytes) successfully initialized in 66ms (v0.2.0e7.20170906) (183ms)
+185ms â•‘â•”Execution stage started
+257ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (50ms)
+258ms ║╚Execution stage complete. (73ms)
+264ms ╚Event processed successfully (264ms)
9/7/2017, 8:01:56 PM +308ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 91ms
+495ms â•‘Piston waited at a semaphore for 255ms
+497ms â•‘Runtime (37135 bytes) successfully initialized in 298ms (v0.2.0e7.20170906) (495ms)
+497ms â•‘â•”Execution stage started
+563ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (45ms)
+565ms ║╚Execution stage complete. (68ms)
+572ms ╚Event processed successfully (572ms)
9/7/2017, 8:01:55 PM +765ms
+1ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 57ms
+506ms â•‘Piston waited at a semaphore for 258ms
+508ms â•‘Runtime (37130 bytes) successfully initialized in 322ms (v0.2.0e7.20170906) (506ms)
+508ms â•‘â•”Execution stage started
+566ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (36ms)
+568ms ║╚Execution stage complete. (59ms)
+574ms ╚Event processed successfully (574ms)
9/7/2017, 8:01:55 PM +457ms
+1ms â•”Received event [Master Bedroom Shades].switch = on with a delay of 63ms
+198ms â•‘Runtime (37065 bytes) successfully initialized in 89ms (v0.2.0e7.20170906) (196ms)
+199ms â•‘â•”Execution stage started
+286ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (62ms)
+287ms ║╚Execution stage complete. (89ms)
+298ms ╚Event processed successfully (298ms)
9/7/2017, 8:01:54 PM +877ms
+2ms â•”Received event [Master Bedroom Shades].switch = off with a delay of 53ms
+464ms â•‘Piston waited at a semaphore for 257ms
+465ms â•‘Runtime (37130 bytes) successfully initialized in 314ms (v0.2.0e7.20170906) (463ms)
+466ms â•‘â•”Execution stage started
+547ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (56ms)
+548ms ║╚Execution stage complete. (83ms)
+555ms ╚Event processed successfully (555ms)
9/7/2017, 8:01:54 PM +593ms
+1ms â•”Received event [ROKU Master].status = playing with a delay of 68ms
+173ms â•‘Runtime (37062 bytes) successfully initialized in 75ms (v0.2.0e7.20170906) (172ms)
+174ms â•‘â•”Execution stage started
+268ms â•‘â•‘Executed [Master Bedroom Shades].setLevel (70ms)
+270ms ║╚Execution stage complete. (97ms)
+275ms ╚Event processed successfully (275ms)


#12

master bedroom shade switch is on - why do you need that condition? i ask because if thats a typical shade switch, the switch should only be on while the shade is being adjusted, then it will turn off. thats why in my original snippet i had left that out.

dont worry about it. :slight_smile:


#13

Well I am still learning so i figure that I need it to tell the system that the switch state has to be on so it can ignore it if its allready off.

I cant take it off and test? :smiley:

Thanks for been patient! :smiley:

Edit:

Ok I see your edit. Ill test.

Thanks!


#14

yep, delete that condition and it should work :slight_smile:

EDIT: sounds good.


#15

Does this look right?


#16

does it work? :slight_smile:


#17

:slight_smile: :slight_smile: :slight_smile:

Yup! Work like a charm.

Thanks again!


#18

awesome.

you are welcome!


#19

@ffuentes now that this is sorted out would you mind sharing what you used to connect ST to your Roku and Plex? This could be fairly useful to me in the future since we have several Rokus and almost exclusively use Plex.


#20

Sure!