This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

[PUBLISHED] Plex Notify

MarkSwiftMarkSwift Member
edited December 2016 in Apps
Hi Guys,

I've submitted my Plex notify app for approval.

NOTE: The app only supports PMS version 1.3.0 and above (due to JSON changes made by the Plex team).

This app allows you to trigger flows based on Plex player status - play, pause, stop.
It works for all Plex players as the flow card uses tokens.

Available tokens are - player, title, username.

Once it's approved I'll let you all know.

P.S. I'm a new coder so please work with me if you find issues :smile: 

Comments

  • jordenjorden Member
    edited December 2016

    [WEBSOCKET] Detected state:  paused

    [LISTENER] Homey session listener detected event

    [DATA] Sessions Data: { MediaContainer: { size: 1, Video: [ [Object] ] } }


    It does sense that I am watching and when I pause, but it doesn't seem to work if I try to make a trigger with it... 

    It seems to stop at:

    var session = result.MediaContainer.Metadata.filter(item => item.sessionKey === event.key)

     Because it doesn't show this for me:

    console.log('[INFO] Detected session:')

            

  • i don't know how to use this app? any hint please? ;-)
  • MarkSwiftMarkSwift Member
    edited December 2016
    @jorden that's very odd, what version of PMS are you running? My guess by the JSON output of the server is an older version than 1.3.0?

    @phil_s It's a simple app to use Plex player states as triggers, you add your Plex (owner) credentials, and the use the tags to setup flows, i.e. on play, dim lights.
  • @MarkSwift ;PlexMediaServer-1.3.2.3112-1751929-x86 from my Synology. Client is my Android TV (didn't check if the client was up2date).
  • That's odd, your JSON result is different to the Linux and Windows versions...
  • Ah okay thank you @MarkSwift   I will try the app
  • MarkSwiftMarkSwift Member
    edited December 2016
    @jorden think I found the issue...

    Can you check the version on my github? It seems Plex changed things again.
  • Yeah, awesome, that works! 
  • @jorden Good to hear, I've submitted an update to the appstore...
  • @MarkSwift No succes yet for me. 

    I'm running the latest PMS on a windows unit. I do see your app in my PMS devices list:



    so the credentials are fine. Does this also means it found the server on my network or how could I check this? I'm pretty sure I entered the right IP and port.
  • MarkSwiftMarkSwift Member
    edited December 2016
    @Qx5 ; It means you have successfully authorised the app.

    Can you run the github version from CLI and let me know the debug? Also confirm your PMS version...
  • My PMS version is 1.3.2.3112.
    I'll see if I can do it remotely from work today, but I'm new to the CLI thing so bare with me  ;)
  • Seems to work now with the latest git version! Seems like the master branch already contained the fix.
     
    I did get this error: api.js:1 POST http://192.168.178.13/api/app/com.plex.notify/restart/?_=1481535572620 net::ERR_EMPTY_RESPONSE
    when stopping a movie.  
    And a warning that the dutch locale was missing but that one makes sense ;)

    Nice work! I like that the tokens in the flows very much. 
    Maybe you can also make a plex.tv pin procedure for linking the app with plex like MikeOne did. 

    Great work in each case!

  • I'm really glad it works, that's a relief!

    I'll certainly look at implementing the PIN auth, but I'm still new to coding :)
  • Another enhancement idea:

    Maybe you could implement a AND flow card for selecting Plex players. The reason is that I don't want every plex player to trigger my living room lighting. 

    It might be a bit hard since you're not allowed to make a flow card with multiple checkboxes to select for which players it should be true. But maybe a dropdown with the registered players? 

    Seems like some solid coding you did anyway!
  • @Qx5 I do this now by dragging the Player tag into the logic card, and specifying 'exactly' and then enter the player name. Works for me :)
  • True I tried that too :) 

    But it needs some extra work because you need to find out all the player names you use. It's also a bit more tricky if I i.e. have 3 players that should trigger the flow and 2 that shouldn't. Since OR is not available in a flow you're bound to inverting some cards to exclude the players you don't want to trigger. 

    Don't really need it right now but it just came to mind as some cool extra functionality.
  • I have made flows to dim my Hue lights when Plex starts playing, and set to 100% brightness when paused/stopped. Yesterday for the first time since this app I watched a movie, and it worked flawlessly! I love the speed of it as well.

    Now just have to append the flows to make sure only my main TV will control the lights, then this is another simple-but-awesome set of flows. Thanks a lot!
  • Qx5Qx5 Member
    Hey @MarkSwift

    I saw you updated to 1.0.3. Any interesting changes? For me to let the app work I have to go to the settings screen before I watch a movie and press the save button again to trigger the connection to plex .  Any idea what could cause this?
  • @Qx5 Not sure what's up, works for everyone else I'm sure? Check the release notes ;-)
  • Qx5Qx5 Member
    Haha i actualy did but didnt saw an item for the latest update. Guess its a typo in the version number of the changelog that made me confused  :) Will see if I can log some errors. 
  • rjbaatrjbaat Member
    edited March 2017
    Hi, i have a question. Is this app using the new webhooks plex offers? https://support.plex.tv/hc/en-us/articles/115002267687-Webhooks. And is it possible to have a condition card based on the plex player ID? Because then i can dim the lights in the livingroom based on the Chromecast livingroom ID and this wont happen with the Chromecast Bedroom ID. 
  • Is there any way to identify two different Chromecasts? I have one in my bedroom and one in living room, but both are called "Chromecast" as player name. When using living room, I would like to turn lights off in living room, and on when pauzes/stops... but when in bedroom I don't want to use this...
  • bvdbosbvdbos Member
    Did you rename the chromecasts in Homey?
Sign In or Register to comment.