Jump to content

Notifications on client devices


adam1010

Recommended Posts

adam1010

I still use Kodi (with the Emby add-on) on a few TVs because it supports displaying notifications that are sent to its API.

 

So for instance, I can call the Kodi JSON API endpoint with a message like:

"Motion detected at the front door"

"Spa temperature is 103 degrees"

"New text message from John Smith"

 

Then the message is displayed as an overlay on whatever content I'm watching (or just at the top of the screen if no media is playing). I'm able to specify a title and duration for the notification as well.

 

In the case of Emby, I would also want to specify if the alert should be broadcast to (a) all connected devices, or (B) to all devices logged in with certain USERS

 

I'm happy to provide screenshots for how the alerts display in Kodi if that would be helpful.

 

Any idea if something like this has been considered before or is on the roadmap?  It really is the only feature that keeps me using Kodi (with Emby plugin) on my TVs instead of just using Emby directly.

 

 

Link to comment
Share on other sites

The API for this actually already exists in Emby Server and most (I believe) apps can display them.  The part that is missing right now is the interface in the web/mobile apps to send them.

Link to comment
Share on other sites

adam1010

@@ebr That's awesome! I don't plan on using the web/mobile apps to send the notifications (I'll use scripts to post directly to the server API).

 

Where can I find the API documentation for sending notifications?

Link to comment
Share on other sites

Due to the lack of place to send them, it doesnt get enough testing but we are happy to resolve issues that you run into. Thanks.

Link to comment
Share on other sites

adam1010

@@Luke Thanks for the support, I'd be happy to test it and provide any relevant feedback. Can you point me to the API endpoint I should be using?

Link to comment
Share on other sites

adam1010

Thanks @@Luke

 

I opened this in my browser:

http://192.168.1.xxx:yyyy/Sessions?api_key=xyz 

 

to get the list of sessions, and then took the "Id" field from my main TV and used:

 

http://192.168.1.xxx:yyyy/Sessions/{the_ID}/Playing/Stop?api_key=xyz

 

However, it then displayed an error message:  Unable to find the specified file.

 

Does it require a "POST" request or something other than just accessing from a GET URL request?

Link to comment
Share on other sites

adam1010

Thanks @@Luke

 

I was able to get an authorization token and was able to Pause/Stop content. However, "DisplayMessage" doesn't appear to do anything on my Android TV (it returns a 204/No Content). Is that the correct method?

 

curl 'http://192.168.1.x:xyz/emby/Sessions/xxx/Command/DisplayMessage'-H 'x-mediabrowser-token: xxx' -H 'x-emby-authorization: MediaBrowser Client="Emby Mobile", Device="Chrome", DeviceId="xxx", Version="3.2.13.0", UserId="xxx"' -H 'content-type: application/json' --data-binary '{"Header":"Hello","Text":"World","TimeoutMs":10000}'

Link to comment
Share on other sites

Did you first get the session info and check that it is listed in it's SupportedCommands?

Link to comment
Share on other sites

adam1010

It's NOT listed as a supported command.  The list includes: DisplayContent, Mute, Unmute, ToggleMute

 

Do I have to enable it or was this functionality never added to the Android TV app?

Link to comment
Share on other sites

It was probably never added. You should probably start with basic testing sending these to the web app and emby theater, then @@ebr can add it to android tv when possible. thanks.

Link to comment
Share on other sites

adam1010

Sounds good. I just tried the command in the web app and it did pop up a modal box. The modal box is blank and has a green "Got It" button to dismiss the modal.

 

Do my command arguments look wrong or do you think it's a bug?

 

My TVs are either Linux or Android so I won't be able to test Emby theater.

Link to comment
Share on other sites

chef

Sounds good. I just tried the command in the web app and it did pop up a modal box. The modal box is blank and has a green "Got It" button to dismiss the modal.

 

Do my command arguments look wrong or do you think it's a bug?

 

My TVs are either Linux or Android so I won't be able to test Emby theater.

I believe you can browse to tv.emby.media to test the theater, in any web browser :) Edited by chef
Link to comment
Share on other sites

  • 5 months later...
adam1010

Hey @@Luke -- Thanks for implementing this universally, I can send notifications to all my devices now, even my Android TV! I've wired it up to my SmartThings hub -- It's fantastic :-)

 

Am I supposed to be able to set a Title/Header for the message?  I've tried specifying one but it doesn't come through on the clients. Emby Web client just shows the message body (no title), while the Android TV shows a hard-coded title of "Remote Message" for everything.

Link to comment
Share on other sites

It's up to each app to manage the display and some might be ignoring the title. But it sounds like you are doing the right thing.

Link to comment
Share on other sites

There is no way to set a title using our send dialog from the dashboard, right?

 

In any case, the Android TV and Fire TV apps will use it if specified with the next release.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...