_Component to integrate with Plex Webhooks._
This is a custom component that will take in webhooks from Plex and turn them into events that you can write automations around. One usecase is when plex starts playing on living room TV dim the kitchen lights and turn out all the living room lights.
configuration.yaml
).custom_components
directory (folder) there, you need to create it.custom_components
directory (folder) create a new folder called plex_webhooks
.custom_components/plex_webhooks/
directory (folder) in this repository.{{HAS_URL}}/api/webhooks/{{webhook_id}}
where HAS_URL is the url that you can reach Home Assistant and webhook_id is the id you setup in the configuration.yamlplex_webhooks:
webhook_id: plex_webhook
Key | Type | Required | Description |
---|---|---|---|
webhook_id |
string |
True |
The webhook id used when configuring plex. |
In addition to the whole plex webhook json being passed (https://support.plex.tv/articles/115002267687-webhooks/) we add 2 additional fields.
Example Music Data:
{
"event_type": "PLEX_EVENT",
"data": {
"event": "media.stop",
"user": false,
"owner": true,
"Account": {
"id": 123456789,
"thumb": "https://plex.tv/users/XXXXXXXX/avatar?c=XXXXXXX",
"title": "john.doe@example.com"
},
"Server": {
"title": "ssv Normandy",
"uuid": "123456789abcd"
},
"Player": {
"local": false,
"publicAddress": "192.168.x.x",
"title": "Living Room TV",
"uuid": "123456789abcd"
},
"Metadata": {
"librarySectionType": "artist",
"ratingKey": "14454",
"key": "/library/metadata/14454",
"parentRatingKey": "14453",
"grandparentRatingKey": "14452",
"guid": "com.plexapp.agents.plexmusic://gracenote/track/170163331-DF725E4DA03E6040915B2564D5A06E70/170163337-1EB863722EF8D07A087D4258B2FFA2D6?lang=en",
"parentGuid": "com.plexapp.agents.plexmusic://gracenote/album/05DF725E0A247C83/170163331-DF725E4DA03E6040915B2564D5A06E70?lang=en",
"grandparentGuid": "com.plexapp.agents.plexmusic://gracenote/artist/05DF725E0A247C83?lang=en",
"librarySectionTitle": "Music",
"librarySectionID": 4,
"librarySectionKey": "/library/sections/4",
"type": "track",
"title": "You Belong With Me",
"grandparentKey": "/library/metadata/14452",
"parentKey": "/library/metadata/14453",
"grandparentTitle": "Taylor Swift",
"parentTitle": "Fearless",
"originalTitle": "Taylor Swift",
"summary": "",
"index": 6,
"parentIndex": 1,
"ratingCount": 4219823,
"thumb": "/library/metadata/14453/thumb/1491873574",
"art": "/library/metadata/14452/art/1569915711",
"parentThumb": "/library/metadata/14453/thumb/1491873574",
"grandparentThumb": "/library/metadata/14452/thumb/1569915711",
"grandparentArt": "/library/metadata/14452/art/1569915711",
"addedAt": 1491873349,
"updatedAt": 1567174880
},
"playerUuid": "123456789abcd",
"status": "STOPPED"
}
}