iharosi / homebridge-plex-webhooks

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

The plugin is setting an inactive state when a fully matching rules is met for paused movies in plex #35

Open Gtjack9 opened 7 months ago

Gtjack9 commented 7 months ago

Before you raise an issue ticket, please turn on verbose logging in the plugin's config or run homebridge with -D (or --debug) option.

Node.js version Can be found on the Status page of Homebridge UI.

Homebridge version Can be found on the Status page of Homebridge UI.

Plex Webhooks Server plugin version Can be found on the Plugin page of Homebridge UI.

Configuration

{ "bridge": { "name": "redacted", "username": "redacted", "port": 51118, "pin": "redacted", "advertiser": "avahi", "bind": [ "eth0" ] }, "accessories": [], "platforms": [ { "name": "Config", "port": 8581, "platform": "config" }, { "name": "Plex Webhooks Platform", "sensors": [ { "name": "Play - Movie", "filters": [ [ { "path": "Metadata.type", "operator": "===", "value": "movie" }, { "path": "Player.title", "operator": "===", "value": "SHIELD Android TV" } ], [ { "path": "Metadata.type", "operator": "===", "value": "movie" }, { "path": "Player.title", "operator": "===", "value": "SHIELD Android TV" }, { "path": "event", "operator": "===", "value": "media.resume" } ] ] }, { "name": "Play - PreRoll", "filters": [ [ { "path": "Metadata.type", "operator": "===", "value": "clip" }, { "path": "Player.title", "operator": "===", "value": "SHIELD Android TV" } ] ] }, { "name": "Pause - Movie", "filters": [ [ { "path": "Metadata.type", "operator": "===", "value": "movie" }, { "path": "Player.title", "operator": "===", "value": "SHIELD Android TV" }, { "path": "event", "operator": "===", "value": "media.pause" } ] ] }, { "name": "Stop - Movie", "filters": [ [ { "path": "Metadata.type", "operator": "===", "value": "movie" }, { "path": "Player.title", "operator": "===", "value": "SHIELD Android TV" }, { "path": "event", "operator": "===", "value": "media.stop" } ] ] } ],

Error message The state of “pause - movie” is being set to inactive even though all of the rules are met

Payload the following is a pause log including the webhook from plex and the response from the plugin

[04/02/2024, 03:16:50] [Plex Webhooks Platform] {"event":"media.pause","user":true,"owner":true,"Account":{"id":4003177,"thumb":"https://plex.tv/users/b7a045bf03f5a4cf/avatar?c=1707011966","title":"gtjack9"},"Server":{"title":"SHIELD Android TV","uuid":"bc081a5f2d2e66231d68971f25efa25e0b6526a7"},"Player":{"local":true,"publicAddress",”redacted","title":"SHIELD Android TV","uuid":"12ba4fef3469e0bf-com-plexapp-android"},"Metadata":{"librarySectionType":"movie","ratingKey":"124675","key":"/library/metadata/124675","guid":"plex://movie/5f887c5b20bfce004175ce4a","studio":"Scott Free Productions","type":"movie","title":"Napoleon","librarySectionTitle":"Films","librarySectionID":1,"librarySectionKey":"/library/sections/1","contentRating":"gb/15","summary":"An epic that details the checkered rise and fall of French Emperor Napoleon Bonaparte and his relentless journey to power through the prism of his addictive, volatile relationship with his wife, Josephine.","audienceRating":6.5,"skipCount":4,"year":2023,"tagline":"He came from nothing. He conquered everything.","thumb":"/library/metadata/124675/thumb/1707012603","art":"/library/metadata/124675/art/1707012603","duration":9480000,"originallyAvailableAt":"2023-11-22","addedAt":1706981303,"updatedAt":1707012603,"audienceRatingImage":"imdb://image.rating","primaryExtraKey":"/library/metadata/124708","Genre":[{"id":120,"filter":"genre=120","tag":"Action","count":157},{"id":547,"filter":"genre=547","tag":"Adventure","count":121},{"id":30,"filter":"genre=30","tag":"Biography","count":19},{"id":29,"filter":"genre=29","tag":"Drama","count":108},{"id":2392,"filter":"genre=2392","tag":"History","count":17},{"id":1770,"filter":"genre=1770","tag":"War","count":26}],"Country":[{"id":85,"filter":"country=85","tag":"United Kingdom","count":76},{"id":170,"filter":"country=170","tag":"United States of America","count":261}],"Guid":[{"id":"imdb://tt13287846"},{"id":"tmdb://753342"},{"id":"tvdb://332434"}],"Rating":[{"image":"imdb://image.rating","value":6.5,"type":"audience","count":287},{"image":"rottentomatoes://image.rating.rotten","value":5.8,"type":"critic","count":65},{"image":"rottentomatoes://image.rating.spilled","value":5.9,"type":"audience","count":53},{"image":"themoviedb://image.rating","value":6.5,"type":"audience","count":288}],"Director":[{"id":8514,"filter":"director=8514","tag":"Ridley Scott","tagKey":"5d7768245af944001f1f6352","count":3,"thumb":"https://metadata-static.plex.tv/people/5d7768245af944001f1f6352.jpg"}],"Writer":[{"id":21544,"filter":"writer=21544","tag":"David Scarpa","tagKey":"5d77682bf54112001f5bc4ed","thumb":"https://metadata-static.plex.tv/2/people/26bda9d2c4a960bb11d481a354a292b9.jpg"}],"Role":[{"id":20428,"filter":"actor=20428","tag":"Joaquin Phoenix","tagKey":"5d77682585719b001f3a0517","count":2,"role":"Napoleon Bonaparte","thumb":"https://metadata-static.plex.tv/9/people/96225c889001b8617202e5effea090ac.jpg"},{"id":10256,"filter":"actor=10256","tag":"Vanessa Kirby","tagKey":"5d776876eb5d26001f1ec6a3","count":2,"role":"Josephine Bonaparte","thumb":"https://metadata-static.plex.tv/3/people/3d44382b60be76642d0db8c97af77313.jpg"},{"id":6086,"filter":"actor=6086","tag":"Rupert Everett","tagKey":"5d7768253c3c2a001fbcac18","count":2,"role":"Duke of Wellington","thumb":"https://metadata-static.plex.tv/1/people/195490910f46a2daa2a54a78f5554daa.jpg"},{"id":21545,"filter":"actor=21545","tag":"Mark Bonnar","tagKey":"5d7768a19ab54400214e8fd9","role":"Junot","thumb":"https://metadata-static.plex.tv/c/people/c2da102b0b0699485a095e8854e30eca.jpg"},{"id":21546,"filter":"actor=21546","tag":"Paul Rhys","tagKey":"5d7768283c3c2a001fbcb6ac","role":"Talleyrand","thumb":"https://metadata-static.plex.tv/people/5d7768283c3c2a001fbcb6ac.jpg"},{"id":21547,"filter":"actor=21547","tag":"Ben Miles","tagKey":"5d776828151a60001f24ae6d","role":"Caulaincourt","thumb":"https://metadata-static.plex.tv/1/people/1f3274842266e930c2c775340f9db706.jpg"},{"id":21548,"filter":"actor=21548","tag":"Tahar Rahim","tagKey":"5d77683b880197001ec94c8d","role":"Paul Barras","thumb":"https://metadata-static.plex.tv/6/people/65e588979d9cc7c9ed53ff895f340fc9.jpg"},{"id":21549,"filter":"actor=21549","tag":"Riana Duce","tagKey":"5f4021fa427eeb0041e9308b","role":"Lucille","thumb":"https://metadata-static.plex.tv/3/people/3e32a23fdac79e33e05d82213c61228c.jpg"},{"id":21550,"filter":"actor=21550","tag":"Ludivine Sagnier","tagKey":"5d7768258718ba001e3118c4","role":"Theresa Cabarrus","thumb":"https://metadata-static.plex.tv/a/people/a4ac17deb5d989a07f4c419096d0e283.jpg"},{"id":21551,"filter":"actor=21551","tag":"Miles Jupp","tagKey":"5d77682854c0f0001f301f29","role":"Emperor Francis I","thumb":"https://metadata-static.plex.tv/7/people/76bb9d40a53065bdbdeb6ba870548f84.jpg"},{"id":21552,"filter":"actor=21552","tag":"Edouard Philipponnat","tagKey":"5e2e28c570d8ce003c54a0bb","role":"Tsar Alexander","thumb":"https://metadata-static.plex.tv/c/people/c1a60563cc95d29e4fd2bb516c43b0ae.jpg"},{"id":17283,"filter":"actor=17283","tag":"John Hollingworth","tagKey":"5d77684c85719b001f3a7c45","count":2,"role":"Marshal Ney","thumb":"https://metadata-static.plex.tv/f/people/f99610846aa3543bbccb7b23d71e00f6.jpg"},{"id":21553,"filter":"actor=21553","tag":"Youssef Kerkour","tagKey":"5d77683e5af944001f1fbe4a","role":"General Davout","thumb":"https://metadata-static.plex.tv/f/people/f24bdfb7af2a594d82f9c073e2f77be5.jpg"},{"id":21554,"filter":"actor=21554","tag":"Davide Tucci","tagKey":"5d776b3afb0d55001f560c49","role":"Lazar Hoche","thumb":"https://metadata-static.plex.tv/9/people/90599d60d3ce1e169dcb127e24b3785c.jpg"},{"id":21555,"filter":"actor=21555","tag":"Matthew Needham","tagKey":"5d776bf77a53e9001e73549a","role":"Lucien Bonaparte","thumb":"https://metadata-static.plex.tv/4/people/4be6057ee89dfdded55b33185701e36b.jpg"},{"id":21556,"filter":"actor=21556","tag":"Jannis Niewöhner","tagKey":"5d776831880197001ec92a02","role":"Hippolyte Charles","thumb":"https://metadata-static.plex.tv/b/people/b6ecad00ba5d030c1f24693788f74f60.jpg"},{"id":21557,"filter":"actor=21557","tag":"Erin Ainsworth","tagKey":"61975c31a90af03a606f2452","role":"Hortense de Beauharnais","thumb":"https://metadata-static.plex.tv/b/people/bcca27a21cdd2a6b6aeac39d8edddf9f.jpg"},{"id":21558,"filter":"actor=21558","tag":"Thom Ashley","tagKey":"5fb3f40172fbaa002e9ac8cf","role":"Charles de la Bédoyère","thumb":"https://metadata-static.plex.tv/3/people/3d2f6cfef4646994da1d06ee8c71c5f0.jpg"},{"id":21559,"filter":"actor=21559","tag":"Anna Mawn","tagKey":"5f4021775a76a80042d548f7","role":"The Duchess Marie-Louise","thumb":"https://metadata-static.plex.tv/c/people/c083c0c26c6c6c13ff2cb92db6670cac.jpg"},{"id":21560,"filter":"actor=21560","tag":"Gavin Spokes","tagKey":"5d777069cfbb56001fb88900","role":"Moulins","thumb":"https://metadata-static.plex.tv/e/people/e535c5d9afc7dbcdfb2a282c8dbc7485.jpg"},{"id":21561,"filter":"actor=21561","tag":"Jonathan Barnwell","tagKey":"5d776c8c594b2b001e6f68ae","role":"Bourrienne","thumb":"https://metadata-static.plex.tv/people/5d776c8c594b2b001e6f68ae.jpg"},{"id":7842,"filter":"actor=7842","tag":"Hannah Flynn","tagKey":"5d776a35fb0d55001f53defe","count":2,"role":"Dancer","thumb":"https://metadata-static.plex.tv/people/5d776a35fb0d55001f53defe.jpg"},{"id":21562,"filter":"actor=21562","tag":"Phil Cornwell","tagKey":"5d776826151a60001f24aa64","role":"Sanson 'The Borreau'","thumb":"https://metadata-static.plex.tv/e/people/e8527bfe3236d1e40fe988bcda8baffe.jpg"},{"id":21563,"filter":"actor=21563","tag":"Cormac Hyde-Corrin","tagKey":"6089181938f7d4002c31043f","role":"Mid Shipman","thumb":"https://metadata-static.plex.tv/b/people/b7039a5ae32c2f1ce7f29393f4309865.jpg"},{"id":8597,"filter":"actor=8597","tag":"Cesare Taurasi","tagKey":"5d7769a0fb0d55001f52b52f","count":2,"role":"Citizen Lacombe","thumb":"https://metadata-static.plex.tv/people/5d7769a0fb0d55001f52b52f.jpg"},{"id":21564,"filter":"actor=21564","tag":"Arthur McBain","tagKey":"5d776f1b594b2b001e737309","role":"General Marchand","thumb":"https://metadata-static.plex.tv/8/people/82470df0065b66fa614b5ec476952130.jpg"},{"id":21565,"filter":"actor=21565","tag":"David Verrey","tagKey":"5d77682c8718ba001e312a2a","role":"Louis-Jérôme Gohier","thumb":"https://metadata-static.plex.tv/people/5d77682c8718ba001e312a2a.jpg"},{"id":21566,"filter":"actor=21566","tag":"Ed Hughes","tagKey":"63382c344255486457f2a2d5","role":"Lucien's Associate","thumb":"https://metadata-static.plex.tv/f/people/fad26d289ce7232565096b9054a29197.jpg"},{"id":21567,"filter":"actor=21567","tag":"Paul Riddell","tagKey":"5ddba93b572c3a001d514d94","role":"Jacobite","thumb":"https://metadata-static.plex.tv/6/people/68ee8460f908e6bdf5a22a57f924225d.jpg"},{"id":21568,"filter":"actor=21568","tag":"Thea Achillea","tagKey":"5e166be9df4678003f53a0a0","role":"Napoleon's Daughter","thumb":"https://metadata-static.plex.tv/5/people/5086b89fa127de719a8721654f3fb7ca.jpg"},{"id":21569,"filter":"actor=21569","tag":"Tim Faulkner","tagKey":"5d9c08134eefaa001f5d5041","role":"Gebhard Leberecht von Blücher"},{"id":21570,"filter":"actor=21570","tag":"Robert William Carlisle","tagKey":"61e6d16f7d938f5d8f5d1138","role":"Imperial Guard Soldier","thumb":"https://image.tmdb.org/t/p/original/txULywKMDDIRT8AuvfoHwt37el5.jpg"},{"id":21571,"filter":"actor=21571","tag":"Ed Eales White","tagKey":"6323b9d0ab5cfaed4d86e211","role":"Duke D'Enghein"},{"id":21572,"filter":"actor=21572","tag":"Jacob Marshfield","tagKey":"6141ffcc8a15e55622a91193","role":"Cannon Commander"},{"id":21573,"filter":"actor=21573","tag":"Julian Rhind-Tutt","tagKey":"5d7768263c3c2a001fbcaffd","role":"Sieyes","thumb":"https://metadata-static.plex.tv/people/5d7768263c3c2a001fbcaffd.jpg"},{"id":21574,"filter":"actor=21574","tag":"Sinéad Cusack","tagKey":"5d776828151a60001f24ae6e","role":"Letizia Bonaparte","thumb":"https://metadata-static.plex.tv/5/people/514c6689e951ba822c3b69257ba8dbc1.jpg"},{"id":21575,"filter":"actor=21575","tag":"Sam Troughton","tagKey":"5d776826880197001ec906c7","role":"Robespierre","thumb":"https://metadata-static.plex.tv/9/people/9b6de395f8a2e7b3553133642d6aadb5.jpg"},{"id":21576,"filter":"actor=21576","tag":"Julian Wadham","tagKey":"5d7768266f4521001ea98d60","role":"Jean de Cambaceres","thumb":"https://metadata-static.plex.tv/f/people/fc26827719d4b5fc954559717addfa1d.jpg"},{"id":21577,"filter":"actor=21577","tag":"Catherine Walker","tagKey":"5d776842961905001eb9681f","role":"Marie Antoinette","thumb":"https://metadata-static.plex.tv/people/5d776842961905001eb9681f.jpg"},{"id":9698,"filter":"actor=9698","tag":"Ian McNeice","tagKey":"5d7768253c3c2a001fbca9d3","count":2,"role":"Louis XVIII","thumb":"https://metadata-static.plex.tv/0/people/030e7776c46a88d8b076e74648a44eb1.jpg"},{"id":21578,"filter":"actor=21578","tag":"Richard McCabe","tagKey":"5d7768263c3c2a001fbcaff8","role":"Lord Whitworth","thumb":"https://metadata-static.plex.tv/b/people/b88ccec3d460e5b8011f8d2c3ff45576.jpg"},{"id":21579,"filter":"actor=21579","tag":"Edward Hogg","tagKey":"5d776833e6d55c002040c970","role":"Citizen Gilbert","thumb":"https://metadata-static.plex.tv/people/5d776833e6d55c002040c970.jpg"},{"id":4541,"filter":"actor=4541","tag":"Kevin Eldon","tagKey":"5d7768243c3c2a001fbca938","count":2,"role":"Dr Corvisart","thumb":"https://metadata-static.plex.tv/7/people/735693528a48bdb63cd07d2977b58fd6.jpg"},{"id":21580,"filter":"actor=21580","tag":"Abubakar Salim","tagKey":"5d777043f617c9002019cc02","role":"General Dumas","thumb":"https://metadata-static.plex.tv/e/people/e5171c3da219fabe167a4a3c452f2996.jpg"},{"id":21581,"filter":"actor=21581","tag":"Sophie Lund","tagKey":"61f54bb95f391451d756ab93","role":"Nanny","thumb":"https://metadata-static.plex.tv/2/people/2157ba640148378df3d1999f24e40e24.jpg"},{"id":21582,"filter":"actor=21582","tag":"Peter Sandys-Clarke","tagKey":"5d776e1623d5a3001f52957e","role":"British Lieutenant / Waterloo","thumb":"https://metadata-static.plex.tv/0/people/00a5cde498cdb2a1ad6d26978a7a6562.jpg"}],"Producer":[{"id":21583,"filter":"producer=21583","tag":"Joaquin Phoenix","tagKey":"5d77682585719b001f3a0517","thumb":"https://metadata-static.plex.tv/9/people/96225c889001b8617202e5effea090ac.jpg"},{"id":8565,"filter":"producer=8565","tag":"Ridley Scott","tagKey":"5d7768245af944001f1f6352","count":4,"thumb":"https://metadata-static.plex.tv/people/5d7768245af944001f1f6352.jpg"},{"id":8566,"filter":"producer=8566","tag":"Mark Huffam","tagKey":"5d776828a091de001f2e63c1","count":2},{"id":21584,"filter":"producer=21584","tag":"Kevin J. Walsh","tagKey":"5d7768ad431c830024c12cc6"}]}} [04/02/2024, 03:16:50] [Plex Webhooks Platform] Checking filter rulesets of [Play - Movie] sensor: [04/02/2024, 03:16:50] [Plex Webhooks Platform] > filter group #1 [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "movie" at "Metadata.type", found "movie" [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "SHIELD Android TV" at "Player.title", found "SHIELD Android TV" [04/02/2024, 03:16:50] [Plex Webhooks Platform] > filter group #2 [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "movie" at "Metadata.type", found "movie" [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "SHIELD Android TV" at "Player.title", found "SHIELD Android TV" [04/02/2024, 03:16:50] [Plex Webhooks Platform] - looking for "media.resume" at "event", found "media.pause" [04/02/2024, 03:16:50] [Plex Webhooks Platform] Checking filter rulesets of [Play - PreRoll] sensor: [04/02/2024, 03:16:50] [Plex Webhooks Platform] > filter group #1 [04/02/2024, 03:16:50] [Plex Webhooks Platform] - looking for "clip" at "Metadata.type", found "movie" [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "SHIELD Android TV" at "Player.title", found "SHIELD Android TV" [04/02/2024, 03:16:50] [Plex Webhooks Platform] Checking filter rulesets of [Pause - Movie] sensor: [04/02/2024, 03:16:50] [Plex Webhooks Platform] > filter group #1 [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "movie" at "Metadata.type", found "movie" [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "SHIELD Android TV" at "Player.title", found "SHIELD Android TV" [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "media.pause" at "event", found "media.pause" [04/02/2024, 03:16:50] [Plex Webhooks Platform] Checking filter rulesets of [Stop - Movie] sensor: [04/02/2024, 03:16:50] [Plex Webhooks Platform] > filter group #1 [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "movie" at "Metadata.type", found "movie" [04/02/2024, 03:16:50] [Plex Webhooks Platform] + looking for "SHIELD Android TV" at "Player.title", found "SHIELD Android TV" [04/02/2024, 03:16:50] [Plex Webhooks Platform] - looking for "media.stop" at "event", found "media.pause" [04/02/2024, 03:16:50] [Plex Webhooks Platform] [Play - Movie] is inactive [04/02/2024, 03:16:50] [Plex Webhooks Platform] [Pause - Movie] is inactive

Additional info My aim with the plugin is to create a trigger when the pre roll is played, which will set my light to dim. Then when the movie start the trigger will turn off the lights. Then if the movie is paused the trigger sets the lights to dim again. Then if the movie is stopped the trigger will turn on the lights fully.

unless I’m missing something crucial here I do believe the plugin is behaving incorrectly. Maybe there is an easier or better way to accomplish this? As an additional note I’ve seen a YouTube video, link below where a guy edits a “constants” file to fix a similar issue but I can’t find this anywhere, is this related? https://youtu.be/KEe1plcJsek?si=mKO8Qo0zrV-HzcKp

Appreciate all assistance and support, even if it’s to say it can’t be done. Thanks