iharosi / homebridge-plex-webhooks

Plex Webhooks Server plugin for Homebridge
GNU Affero General Public License v3.0
48 stars 6 forks source link

Multiple sensors for pause/resume and play/stop events #13

Open ianiv opened 3 years ago

ianiv commented 3 years ago

I made a sensor that triggers when media starts playing. And it works fine, but the sensor never resets so if I stop playback and start again my automation does not re-run.

Maybe I'm missing something, but it would be useful if the sensors reset after a configurable amount of time, or to have a filter set that turns off a sensor.

Thanks!

iharosi commented 3 years ago

The sensor should be inactivated by stopping the media. If it's not happening somehow, you should open a bug ticket and give some details about your config.

steveredden commented 3 years ago

I'm trying to accomplish the same - maybe we just need some more documentation or examples of useful sensors?

Here's me trying to just monitor for when a device is playing/paused/etc:

image

Obviously I'm not checking on player.uuid (or any other player characterstics), but to start I wanted it simple:

[12/04/2021, 15:38:04] [Plex Webhooks Platform] Checking filter rulesets of [Plex Streaming - Theater] sensor:
[12/04/2021, 15:38:04] [Plex Webhooks Platform]  > filter group #1
[12/04/2021, 15:38:04] [Plex Webhooks Platform]  + looking for "media.play" at "event", found "media.play"
[12/04/2021, 15:38:04] [Plex Webhooks Platform] [Plex Streaming - Theater] is active

pausing:

[12/04/2021, 15:38:26] [Plex Webhooks Platform] Checking filter rulesets of [Plex Streaming - Theater] sensor:
[12/04/2021, 15:38:26] [Plex Webhooks Platform]  > filter group #1
[12/04/2021, 15:38:26] [Plex Webhooks Platform]  - looking for "media.play" at "event", found "media.pause"

^^is there any way to turn the sensor off when a particular criteria is met? e.g. 'event=media.pause'

Ultimately, the problem becomes the sensor never disengages - here it is 10min after i've paused:

image

What other sensors do you use? not sure how to make the most of this integration yet! :)

iharosi commented 3 years ago

Could you please copy-paste the homebridge-plex-webhooks part from the json config from homebridge UI instead of sharing the screenshot?

steveredden commented 3 years ago

sure thing!

{
    "name": "Plex Webhooks Platform",
    "sensors": [
        {
            "name": "Plex Streaming - Theater",
            "filters": [
                [
                    {
                        "path": "event",
                        "value": "media.play"
                    }
                ]
            ]
        }
    ],
    "verbose": false,
    "platform": "PlexWebhooks"
}
iharosi commented 3 years ago

Ah okay I can see the problem. So, the plugin is taking care of the media.play / media.resume and media.stop / media.pause events so, you should not add these to the filters. You should add for example:

"filters": [
        [
          {
            "path": "Account.title",
            "value": "YourPlexUsername"
          }
        ],
]

You can find more examples in the README.

steveredden commented 3 years ago

Gotcha - so the entire plugin resolves around lib\constants.js and the values of:

const PLAY_EVENTS = [
  'media.play',
  'media.resume'
];
const PAUSE_EVENTS = [
  'media.pause',
  'media.stop'
];

https://github.com/iharosi/homebridge-plex-webhooks/blob/master/lib/constants.js#L8

as the initial triggers? and just gets filtered based on the supplied filters?

iharosi commented 3 years ago

That's correct!

steveredden commented 3 years ago

it would be nice to have a stateful switch for 'paused' (event = media.paused):

I'm envisioning if event=media.paused i'll set my lights to 50% brightness, if event=media.stopped i'll set them to 100%, and resume/start = off.

the current binary (encapsulating 2 states each) is not flexible to handle something like this - if I pause I don't want 100% lights...

maybe a config option for whether or not to treat pause and resume as start and stop events??? (remove them from the CONSTS if so)

Is that feasible in current state at all? or am i just trying to over-automate things πŸ˜…

ianiv commented 3 years ago

I was also filtering on the media.play event so the above explains why it wasn't working as expected.

iharosi commented 3 years ago

Yes that would be a nice thing to have, however sensors in the Home app can be triggered or inactive. Because of this the implementation of the behavior what you've described can be problematic.

iharosi commented 3 years ago

I was also filtering on the media.play event so the above explains why it wasn't working as expected.

Yes, that's right.

steveredden commented 3 years ago

could we have a per-sensor boolean for 'treat pause and resume as stop and start events'?

iharosi commented 3 years ago

Yes that would be a nice thing to have, however sensors in the Home app can be triggered or inactive. Because of this the implementation of the behavior what you've described can be problematic.

I can imagine to have multiple sensors for pause/resume and play/stop events maybe.

iharosi commented 3 years ago

could we have a per-sensor boolean for 'treat pause and resume as stop and start events'?

Thinking of the same. I'll add this as a feature request.

steveredden commented 3 years ago

I would also suggest adding to the README.md the importance of the four event=media.____ -> sounds like us requestors both needed that crucial information πŸ˜„

iharosi commented 3 years ago

I would also suggest adding to the README.md the importance of the four event=media.____ -> sounds like us requestors both needed that crucial information πŸ˜„

Yes agree! πŸ˜ƒ Thanks for pointing this out. ☺️

yjeanrenaud commented 3 years ago

Yes that would be a nice thing to have, however sensors in the Home app can be triggered or inactive. Because of this the implementation of the behavior what you've described can be problematic.

digging out this, I also ran into trouble because I assumed I would need to configure event.play as filter criteria myself. I think homebridge switches can be on or off or stateless. So maybe it would be an option to have a webhook implemented as a switch instead of a sensor. That would indeed enable such behaviour where the user configuration takes care of the event.play and event.pause logic. I would also love to have something else done in case of pausing a movie than when I stop a movie. It would give a lot more flexibility.

RaunoT commented 2 years ago

Also stumbled on this while looking for ways to add seperate stop and pause configs, hope it will be implemented some time soon! Thanks for all the hard work.

icepod commented 2 years ago

Hi All,

TL:DR: I'm here to give this topic my upvote!

A little Background:

Non-tech stuff

I just renovated an entire room to becoma a cinema, including the following features:

(There is also a separate TV in the kitchen, FYI)

I setup Homebridge just to make this whole thing as automated as possible. I'm barely a noob in coding, but got this far:

Tech stuff

In Homekit (with Homebridge) I'm using dummy switches and logic to create a pseudo-program that automatically adjusts many scenes based on a variety of inputs.

For the ideal lighting automation, the inclusion of separate 'resume', 'pause', 'stop' from this plug-in would be great! That way every change, from opening Plex to finishing a movie, would have an accompanying light state. These are meant to be different for Movies or TV.

I spent a bunch of time creating these settings, only to find out that the 'pause' and 'stop' sensors didn't react. See attached.

As a further question, I'd like to ask if anyone knows if the "event": "device.new" flag is actually sent by the webhook? And should it trigger a sensor with known devices or does it only apply to devices connecting for the first time?

@iharosi Thanks for the great plug-in! Here's the code I'd really want to work. And a sample of the return I get at the moment:

Cheers!

{
    "name": "Plex Webhooks",
    "sensors": [
        {
            "name": "Kitchen Playing Media",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "YYYYYYYYYYYYY"
                    }
                ]
            ]
        },
        {
            "name": "Plex Player Running",
            "filters": [
                [
                    {
                        "path": "event",
                        "value": "device.new"
                    },
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    }
                ]
            ]
        },
        {
            "name": "Trailers Start",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.play"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "clip"
                    }
                ]
            ]
        },
        {
            "name": "Trailers Pause",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.pause"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "clip"
                    }
                ]
            ]
        },
        {
            "name": "Trailers Stop",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.stop"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "clip"
                    }
                ]
            ]
        },
        {
            "name": "Trailers Scrobble",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.scrobble"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "clip"
                    }
                ]
            ]
        },
        {
            "name": "Trailers Resume",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.resume"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "clip"
                    }
                ]
            ]
        },
        {
            "name": "TV Start",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.play"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "episode"
                    }
                ]
            ]
        },
        {
            "name": "TV Pause",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.pause"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "episode"
                    }
                ]
            ]
        },
        {
            "name": "TV Stop",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.stop"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "episode"
                    }
                ]
            ]
        },
        {
            "name": "TV Resume",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.resume"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "episode"
                    }
                ]
            ]
        },
        {
            "name": "Movie Start",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.play"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "movie"
                    }
                ]
            ]
        },
        {
            "name": "Movie Pause",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.pause"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "movie"
                    }
                ]
            ]
        },
        {
            "name": "Movie Stop",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.stop"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "movie"
                    }
                ]
            ]
        },
        {
            "name": "Movie Resume",
            "filters": [
                [
                    {
                        "path": "Player.uuid",
                        "value": "XXXXXXXXXXX"
                    },
                    {
                        "path": "event",
                        "value": "media.resume"
                    },
                    {
                        "path": "Metadata.type",
                        "value": "movie"
                    }
                ]
            ]
        }
    ],
    "server": {
        "port": ####,
        "address": "Z.Z.Z.Z"
    },
    "verbose": true,
    "_bridge": {
        "username": "ABCabcABC",
        "port": #####
    },
    "platform": "PlexWebhooks"
}
[1/16/2022, 7:20:25 PM] [Plex Webhooks] {"event":"media.pause","user":true,"owner":true,"Account":{"id":1,"thumb":"**REDACTED**","title":"**REDACTED**"},"Server":{"title":"**REDACTED**","uuid":"**REDACTED**"},"Player":{"local":true,"publicAddress":"","title":"**REDACTED**","uuid":"**REDACTED**"},"Metadata":{"librarySectionType":"show","ratingKey":"6198","key":"/library/metadata/6198","parentRatingKey":"6196","grandparentRatingKey":"6195","guid":"plex://episode/5d9c14407d06d9001fffeded","parentGuid":"plex://season/602e6a4f9b7e9c002d71e190","grandparentGuid":"plex://show/5d9c0876e264b7001fc4520b","type":"episode","title":"E2 Missing teddy","grandparentKey":"/library/metadata/6195","parentKey":"/library/metadata/6196","librarySectionTitle":"TV Shows","librarySectionID":2,"librarySectionKey":"/library/sections/2","grandparentTitle":"Mr. Bean: The Animated Series","parentTitle":"Season 1","contentRating":"TV-G","summary":"Teddy gets kidnapped by a duo of burglars who stole every teddy bear across London. To save him, Mr. Bean tracks down and thwarts the burglars, retrieves Teddy and returns the rest of the teddy bears to their owners.","index":2,"parentIndex":1,"audienceRating":8.5,"skipCount":2,"thumb":"/library/metadata/6198/thumb/1641592095","art":"/library/metadata/6195/art/1641592084","parentThumb":"/library/metadata/6196/thumb/1641592095","grandparentThumb":"/library/metadata/6195/thumb/1641592084","grandparentArt":"/library/metadata/6195/art/1641592084","grandparentTheme":"/library/metadata/6195/theme/1641592084","duration":660000,"originallyAvailableAt":"2002-01-05","addedAt":1641592071,"updatedAt":1641592095,"audienceRatingImage":"thetvdb://image.rating","Guid":[{"id":"imdb://tt6067062"},{"id":"tmdb://195961"},{"id":"tvdb://273586"}]}}
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Kitchen Playing Media] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "YYYYYYYYYYYYY" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Plex Player Running] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "device.new" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Trailers Start] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.play" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "clip" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Trailers Pause] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "media.pause" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "clip" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Trailers Stop] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.stop" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "clip" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Trailers Scrobble] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.scrobble" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "clip" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Trailers Resume] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.resume" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "clip" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [TV Start] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.play" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "episode" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [TV Pause] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "media.pause" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "episode" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [TV Stop] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.stop" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "episode" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [TV Resume] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.resume" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "episode" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Movie Start] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.play" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "movie" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Movie Pause] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "media.pause" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "movie" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Movie Stop] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.stop" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "movie" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] Checking filter rulesets of [Movie Resume] sensor:
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  > filter group #1
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  + looking for "XXXXXXXXXXX" at "Player.uuid", found "XXXXXXXXXXX"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "media.resume" at "event", found "media.pause"
[1/16/2022, 7:20:25 PM] [Plex Webhooks]  - looking for "movie" at "Metadata.type", found "episode"
[1/16/2022, 7:20:25 PM] [Plex Webhooks] [TV Pause] is inactive
JoelGit commented 2 years ago

To echo much of what has been posted here already, I appreciate the simplicity of the existing implementation, but would love an 'advanced' mode that exposed 4 sensors: play, pause, stop, and resume. This would allow for much richer customization.

JoelGit commented 2 years ago

After realizing that all I really wanted was to identify play/pause/resume versus stop events, I simply modified the constants file to include pause with the play events, leaving the PAUSE constant just using the stop event. This is all I really need. I hope the dev will consider enhancing their amazing plug in.

zackotronic commented 2 years ago

Is there any update to this or work around?

zackotronic commented 2 years ago

After realizing that all I really wanted was to identify play/pause/resume versus stop events, I simply modified the constants file to include pause with the play events, leaving the PAUSE constant just using the stop event. This is all I really need. I hope the dev will consider enhancing their amazing plug in.

I ended up doing this as well, but I also moved the resume to the pause events. When I moved just the media.pause event. My pause sensor was not de-triggering.

iharosi commented 2 years ago

Guys! Unfortunately I don't have too much time to improve this plugin, but please feel free to contribute!

zackotronic commented 1 year ago

The Plugin was working fine until the recent update.

I had 2 triggers in Home, Play/Stop and Pause/Resume.

I had to so when played a movie it triggered the Play/Stop sensor and my lights would turn off. If I paused the movie, the Pause/Resume trigger with activate (and play/stop trigger would stay activated), and certain lights would turn on to like 20%. If I resumed my movie, the Pause/Resume trigger would deactivate (while the play/stop trigger would stay active) and the lights that were triggered would turn off. Then if stopped the movie, both trigger's would be unactive and the lights would return to 100%.

This all stopped working with the movie recent update.

Does anyone have a good figuration in homebridge to accomplish this with the new update (even if means I have to edit the constants.js file)??

I installed the previous version and it works again.

{
    "name": "Plex Webhooks Platform",
    "sensors": [
        {
            "name": "Play/Stop",
            "filters": [
                [
                    {
                        "path": "event",
                        "value": "media.play"
                    },
                    {
                        "path": "Metadata.librarySectionTitle",
                        "value": "Movies"
                    }
                ],
                [
                    {
                        "path": "event",
                        "value": "media.stop"
                    },
                    {
                        "path": "Metadata.librarySectionTitle",
                        "value": "Movies"
                    }
                ]
            ]
        },
        {
            "name": "Pause",
            "filters": [
                [
                    {
                        "path": "event",
                        "value": "media.pause"
                    },
                    {
                        "path": "Metadata.librarySectionTitle",
                        "value": "Movies"
                    }
                ],
                [
                    {
                        "path": "event",
                        "value": "media.resume"
                    },
                    {
                        "path": "Metadata.librarySectionTitle",
                        "value": "Movies"
                    }
                ],
                [
                    {
                        "path": "event",
                        "value": "media.stop"
                    },
                    {
                        "path": "Metadata.librarySectionTitle",
                        "value": "Movies"
                    }
                ]
            ]
        }
    ],

I edited my constants.js file to read this

const PLAY_EVENTS = [
  'media.play',
  'media.pause'
];
const PAUSE_EVENTS = [
  'media.resume',
  'media.stop'
];
zackotronic commented 1 year ago

the only work around i found is using 2 different plugins.

I updated back to the new update. I got my pause settings work with the new update.

but i am using https://github.com/alexjsp/homebridge-plex-sensors for play function. that plugin has an option to ignore pause resume functions for certain sensors.

I wonder if that would be possible.

@iharosi

iharosi commented 1 year ago

Guys feel free to create a PR with the changes if you managed to create some working solution. Every contribution is very welcomed!