in Development, Home Automation

Plex Client Notifications via Powershell

When your goal is to #AutomateAllTheThings the integration between systems becomes important. For me, this includes the systems being able to send notifications to me via multiple methods, including for some items, when I’m watching TV.

Most of our media is available to us via a Plex Server and watched on the Plex Home Theater application running on HTPCs. I wanted to allow other systems to send messages to it so they’d pop up as notifications.

The Plex client exposes an API:

http://client:3005/jsonrpc

I knocked up a quick PowerShell script to allow a custom Title and Message to be sent to any given Plex PHT client:

Call it from anything that can run PowerShell:

.\notify.ps1 -client tranquil -title "Test Title" -message "Test Message"

When called, a notification will pop up over whatever is being watched on Plex:

Of course, all of this PowerShell is doable in one line on any Unix-like system:

curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST 
     -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification",
          "params":{"title":"Test Title","message":"Test Message"}}'
     http://client:3005/jsonrpc

But where’s the fun in that?