Plex Webhook Handler

Hi Everyone.

This is my first time converting an automation I use to a blueprint, feedback welcomed on this.

This blueprint simplifies integrating Plex playback events with Home Assistant automations using webhooks, inspired by this forum thread.

Prerequisites:

Setup:

Generate a Unique Webhook ID:

Configure Plex Webhook:

  • In Plex, create a webhook pointing to your Home Assistant server:
    • Example URL: http://<home_assistant_ip>:<port>/api/webhook/{webhook_id}
    • Example: http://10.0.1.2:8123/api/webhook/e9ee051d-31cd-464a-b3c4-034992a96be0

Import the Blueprint:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Create Automation:

  • Create a new automation using the imported blueprint.
  • Enter your generated webhook ID and the Plex client name.

Determine Plex Client Name:

  • If unsure of the client name:
    • Save the automation.
    • Play media on Plex.
    • In Home Assistant, view the automation’s trace.
    • Inspect the second node (changed variable - webhook payload).
    • Find the “Player: title:” value.
    • Enter this value into the blueprint’s Plex client field (case-insensitive).

Configure Automation Actions:

  • Define actions to trigger based on Plex playback events.

Resume Handling (Optional):

  • The webhook reports a resume event when pausing then playing again.
  • The blueprint allows you to treat “resume” as “play” if desired.

Access Webhook Data:

  • Use payload.Metadata in templates to access data like cover art:
    • Example: payload.Metadata.thumb

I hope this helps someone.

1 Like