spaxx24 0 Posted September 29, 2022 Posted September 29, 2022 I recently found out about the webhook plugin, and that with IFTTT i should be able to turn my dlink plugs on/off when i start/pause/stop a movie. Im not very good at this kind of stuff, but I dont understand how I should do this properly. I created the Webhook URL like this; https://maker.ifttt.com/trigger/playback.start/json/with/key/XXX and added trigger event "playback.start" to turn lights off, so far so good, it works. The problem is when I try to add pause etc. https://maker.ifttt.com/trigger/playback.pause/json/with/key/XXX and a trigger to turn lights on. Even tho i specify "playback.pause" as trigger both of these events triger. So my lights turn on, off, on agan etc. I tried creating a https://maker.ifttt.com/trigger/PLAYBACK/json/with/key/XXX url and then using this url for both events, with different event triggers, but then nothing happens.
Luke 42079 Posted September 30, 2022 Posted September 30, 2022 Quote The problem is when I try to add pause etc. https://maker.ifttt.com/trigger/playback.pause/json/with/key/XXX and a trigger to turn lights on. Even tho i specify "playback.pause" as trigger both of these events triger. So my lights turn on, off, on agan etc. Hi, what do you mean by "both"? What is the other event that triggers at the same time as pause?
spaxx24 0 Posted September 30, 2022 Author Posted September 30, 2022 1 hour ago, Luke said: Hi, what do you mean by "both"? What is the other event that triggers at the same time as pause? I only have these two, so I would guess it is the first one "playback.start". When I start the movie the lights go out, when i pause it they go back on, then back off again right away, without me doing anything
GrimReaper 4740 Posted October 1, 2022 Posted October 1, 2022 Don't have dlink lights, but tested on my Hue setup. And I can see where's the issue. I can reproduce BUT it is not on Emby's side but IFTTT's webhooks service. As far as Emby goes, all triggers are sent as single events (Play/Pause/Unpause/Stop). However, IFTTT does NOT parse JSON payload unless one has IFTTT Pro+ and can add a filter in the applet in which they would parse JSON : Parsing JSON body with filter code – IFTTT Help Center Instead, any playback event triggers all webhooks, regardless whether it is playback.start, playback.pause, playback.unpause or playback.stop. In OP's case, as long as there's only playback.start trigger, it works as it is single webhook. Once playback.pause webhook is added, any playback event (Play/Pause/Resume/Stop) triggers both of them, and depending whether applet is set to Turn On, Turn Off or Toggle On/Off the lights, they are all executed in sequence (and not always in the same order): Hence lights going Off/On or vice versa. The only partial workaround I've found with Hue is to create an applet with Toggle lights On/Off event and single webhook but that is highly depending on initial state of the lights (they should be On), so Play turns them Off and Pause turns them back On and Resume turns them back Off etc.
Luke 42079 Posted October 1, 2022 Posted October 1, 2022 42 minutes ago, GrimReaper said: Don't have dlink lights, but tested on my Hue setup. And I can see where's the issue. I can reproduce BUT it is not on Emby's side but IFTTT's webhooks service. As far as Emby goes, all triggers are sent as single events (Play/Pause/Unpause/Stop). However, IFTTT does NOT parse JSON payload unless one has IFTTT Pro+ and can add a filter in the applet in which they would parse JSON : Parsing JSON body with filter code – IFTTT Help Center Instead, any playback event triggers all webhooks, regardless whether it is playback.start, playback.pause, playback.unpause or playback.stop. In OP's case, as long as there's only playback.start trigger, it works as it is single webhook. Once playback.pause webhook is added, any playback event (Play/Pause/Resume/Stop) triggers both of them, and depending whether applet is set to Turn On, Turn Off or Toggle On/Off the lights, they are all executed in sequence (and not always in the same order): Hence lights going Off/On or vice versa. The only partial workaround I've found with Hue is to create an applet with Toggle lights On/Off event and single webhook but that is highly depending on initial state of the lights (they should be On), so Play turns them Off and Pause turns them back On and Resume turns them back Off etc. It looks like he gave start and pause two different urls in IFTTT. Are you saying that having unique urls for different events does not help?
GrimReaper 4740 Posted October 1, 2022 Posted October 1, 2022 (edited) 21 minutes ago, Luke said: It looks like he gave start and pause two different urls in IFTTT Exactly, as did I: 21 minutes ago, Luke said: Are you saying that having unique urls for different events does not help? Yep, it makes no difference as IFTTT listens only to webhook received, doesn't discern type nor does parse JSON. Since ALL playback events are sent to BOTH webhooks, IFTTT triggers ALL (both, in this case) applets. The only thing that could be done from Emby's side is to have separated playback events (checkbox next to each event under general Playback events in webhook setup), so separate triggers could be sent to separate webhooks: Edited October 1, 2022 by GrimReaper
Luke 42079 Posted October 16, 2022 Posted October 16, 2022 On 10/1/2022 at 3:51 PM, GrimReaper said: Exactly, as did I: Yep, it makes no difference as IFTTT listens only to webhook received, doesn't discern type nor does parse JSON. Since ALL playback events are sent to BOTH webhooks, IFTTT triggers ALL (both, in this case) applets. The only thing that could be done from Emby's side is to have separated playback events (checkbox next to each event under general Playback events in webhook setup), so separate triggers could be sent to separate webhooks: In the next update to the webhooks plugin you'll be able to do exactly this, and pick specific sub-events so that you can setup one at a time if needed. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now