Jump to content

Send On-Screen popup message to Emby?


ltek
Go to solution Solved by ltek,

Recommended Posts

For years I used Kodi and when motion was detected at the door, Homeseer could send a message that Kodi put onscreen for 5 seconds.  Is there a way to send a popup message to Emby?

thx

Link to comment
Share on other sites

Gilgamesh_48

I do not know for sure but, maybe, the WebHooks plugin could give you something like that functionality.

Link to comment
Share on other sites

20 minutes ago, Luke said:

Yes using the Emby API with the display message command:

https://github.com/MediaBrowser/Emby/wiki/Remote-control

Any easy way using a one-line HTTP POST or VB.net or VBscript example?  Otherwise, I have no idea how to get that done since there is not a plugin (script or EXE) for Homeseer.

thx

Edited by ltek
Link to comment
Share on other sites

chef

@ltek

 

Create an API key in Emby under "Api Keys"

Send a POST request with  URL:

/Sessions/{Id}/Message

Example:

 POST "http://localhost:8096/emby/Sessions/{SESSION_ID_TO_RECIEVE_YOUR_MESSAGE}/Message?Text=Hello&Header=World&TimeoutMs=5000&api_key={YOUR_API_KEY}" 

 

If you leave out the TimeoutMs parameter, then the user will get a popup on the screen which must be cleared with a "Got it" button, otherwise, the popup happens in the corner of the screen.

 

Edited by chef
Link to comment
Share on other sites

@chef thank you .  How do you see "Session IDs"?  Please tell me they are static/reused for common devices and/or there is a built-in "ALL ACTIVE" Session ID?

 

thx!

Link to comment
Share on other sites

chef
9 hours ago, ltek said:

@chef thank you .  How do you see "Session IDs"?  Please tell me they are static/reused for common devices and/or there is a built-in "ALL ACTIVE" Session ID?

 

thx!

Make a GET request to:

GET http://localhost:8096/emby/Sessions?api_key={YOUR_API_KEY}

You'll get back all active session data.

Look for the "Id" param.

Here is a hint:

Open the swagger with the Api link at the bottom of the dashboard. There you can test everything out.

For messages look at "SessionService" :)

 

EmbyApiSwaggerLink.png

 

No, Session GUID will not be static, they will be created when the device logs on. Infact you can't always depend on Device.Ids being static either.

(*Example: browser Ids will change frequently, whereas Xbox, FireTV devices will remain the same)

Sounds like  you want to integrate the message system with Home automation, right?

What is your end goal here, and maybe I can help

Edited by chef
Link to comment
Share on other sites

2 hours ago, chef said:

Session GUID will not be static, they will be created when the device logs on. Infact you can't always depend on Device.Ids being static either.

(*Example: browser Ids will change frequently, whereas Xbox, FireTV devices will remain the same)

Sounds like  you want to integrate the message system with Home automation, right?

What is your end goal here, and maybe I can help

Yes, Home Automation. I dont need much but even the basics I had in Kodi, I cant do in Emby (automate a few lights based on content & onscreen notifications).

I was integrating Kodi (when XBMC) 14 years ago because it was that simply back then (even tho not as robust). Here's a script I wrote/posted .

Emby integration is difficult and not non-programmer friendly. Currently, Web Hooks do not satisfy the basics of home automation for someone that actually has real HA. (this has been discussed in 2 threads). If it was expanded to simply add some more detail to allow for event triggering on specific items and to send messages, it could. 
... For instance no one uses session IDs (not Kodi or any other system I've used for other home theater and home automation). Every system I've ever uses in HA/HT use IP addresses to connect to the target client - or simply use a 'name' in the controlling server (like Emby should - since it can translate that into an IP easily)

Then simply use POST command to the Name / IP Address of the target client. Since static in Automation Events, code/logic is the same and very easy. 

If you make this happen, a lot of people would be happy.  If this is not going to happen in Emby, I've gotta look to see if Jellyfin has it or just go back to Kodi.

thx for the help

Link to comment
Share on other sites

chef

Sounds interesting.

I can probably say with a good certainty, that Jellyfish does not have an easier way to send messages because their platform was taken from emby when it was open source.

🙄😳🙄😉💩

But, how about this? I can create an endpoint in the server  which can handle the message based on the device name in the url instead of the session.Id.

Would that be helpful?

 

Edited by chef
  • Like 1
Link to comment
Share on other sites

chef
20 minutes ago, cayars said:

Is it going to work only in the player or anywhere in the app?

Anywhere in the app. 😉 On any client.

Link to comment
Share on other sites

chef

Okay @ltek here you go.

 

Place this plugin DLL in the "Emby-Server/programdata/plugin" folder and restart Emby.

 

Once it has loaded, please try this url:

POST http://localhost/emby/SendMessage?DeviceName={YOUR_DEVICE_NAME}&Header=Hello&Text=World&TimeoutMs=5000

 

Again you may leave out the 'TimeoutMs' param and have a full screen modal popup with a "Got it" button.

 

Be aware that this will find the first open session in Emby with a particular device name.

Web Browsers, for example, could have multiple sessions with the same device name (Chrome, Firefox, etc.). This will choose the first open session it finds with the device Name.

 

Most likely you are using Roku,  Fire TV, or an Android device of some kind... Please be sure that these devices have unique names.

Example: "Family Room Fire TV" or "Bedroom Roku". 

That way you can target the device you want to send the message to :)

 

 

If this is working for you,  then I will create a version with Authentication on the endpoint, so you will have to use an API-Key like before. Right now you don't need an API-Key to send messages. 

 

 

 

 

DeviceMessenger.zip

Edited by chef
Link to comment
Share on other sites

image.png

image.png

 

Some clients support this natively from the server admin dashboard within the active devices section. But you can only send one message at a time to a device. It must be recreated every time. But it is possible to do this already without a plugin in a very limited way.

Say to tell the kids on their Roku "BED in 15 minutes or ELSE!" you can do this already. Most clients support the message through active devices.

image.png

On the Roku this then appears. You cannot copy the active video layer into a screen shot. That is why the rest is black. I am watching Breaking Bad re-run. ;)

Edited by speechles
Link to comment
Share on other sites

chef

I think his main issue was that, with Home automation, there is no way to send messages with a static url,  because the endpoint uses session.Id which are generated randomly when a device connects.

The HA can't sort though the JSON to find the session.Id and make the message request.

 

This way he can send the message to the device using the device's name and the plugin will sort out the sessions and find the id to send the message.

Edited by chef
Link to comment
Share on other sites

Home automation is entirely different. The dashboard was mainly to tell young ones you notice they are still watching. They might not remember you have the dashboard. Then you can use that to remind them "GO TO BED" that was the real reason why the dashboard does this. It wasn't meant to automate through the dashboard. It was meant to have a way for a parent to send messages to their children without having to actually go yell at them. Home automation needs something entirely different.

Edited by speechles
Link to comment
Share on other sites

chef
3 minutes ago, speechles said:

Home automation is entirely different. The dashboard was mainly to tell young ones you notice they are still watching. They might not remember you have the dashboard. Then you can use that to remind them "GO TO BED" that was the real reason the dashboard does it. It wasn't meant to automate it was meant to have a parent send these to children. Home automation needs something entirely different.

I dunno about that. I've used the message system for a bunch of different thing. I've attached it to my doorbell and had it trigger a message to my bedroom fireTV to message me if someone is at the door. 

I even had an old phone line modem installed on the server which used AT commands to give me caller display through the Emby message system. But I don't have a landline anymore. 😂

But, yeah, I mostly use it to tell the kids to shut it down and get ready for bed.

 

Link to comment
Share on other sites

I mean using it from the dashboard. If someone were to "hijack" that entire process into a script for automating it would surely be messy. 

Using the message API itself yeah. That was meant to automate.

But the button on the dashboard uses it in just the "parent nag child with message" method. It isn't meant to do more from the dashboard. You aren't meant to purposely annoy your users with messages by default. Unless a person wants that and that is where the plugin comes in. ^_~

Edited by speechles
  • Like 1
Link to comment
Share on other sites

chef
3 minutes ago, speechles said:

I mean using it from the dashboard. If someone were to "hijack" that entire process into a script for automating it would surely be messy. 

Using the message API itself yeah. That was meant to automate.

But the button on the dashboard uses it in just the "parent nag child with message" method. It isn't meant to do more from the dashboard. You aren't meant to purposely annoy your users with messages by default. Unless a person wants that and that is where the plugin comes in. ^_~

Yes the authorization headers need to be on that endpoint for certain. If that version works for @ltek

I will give him a copy with the headers.

Definitely don't want that endpoint hijacked in any way.

  • Like 1
Link to comment
Share on other sites

Not that hijacking that endpoint earns you any data. And to get that far they have better targets on the machine than Emby. I doubt there is much a hacker would gain just to annoy you with "Gain 3 inches with a pill" messages. Want to gain 3 inches with just 10 pills in 10 days? Of course right? What male wouldn't want 3 more inches? A few. Maybe? Probably. A few lucky guys won't need the 3 inches. Most of us aren't that lucky. But being annoyed by a hacker popping up annoying messages you could never click on would not have much value. In the hacker circles its called negative "hack value". You get no real return income wise and costs more time to annoy than it does to steal bitcoins. :)

Edited by speechles
Link to comment
Share on other sites

  • Solution
5 hours ago, chef said:

Sounds interesting.

I can probably say with a good certainty, that Jellyfish does not have an easier way to send messages because their platform was taken from emby when it was open source.

🙄😳🙄😉💩

But, how about this? I can create an endpoint in the server  which can handle the message based on the device name in the url instead of the session.Id.

Would that be helpful?

 

YES! :)

If you can also do an "All Active" that would be perfect... I'd usually be sending messages to All like... "Dinner is Ready", "Bed Time", "Someone is at the Door",  "Backdoor is open for 3 minutes" etc

Link to comment
Share on other sites

chef
27 minutes ago, ltek said:

YES! :)

If you can also do an "All Active" that would be perfect... I'd usually be sending messages to All like... "Dinner is Ready", "Bed Time", "Someone is at the Door",  "Backdoor is open for 3 minutes" etc

Cool  Check a couple post back and see if you can use the plugin I posted.

Link to comment
Share on other sites

chef

..and yes it could be written to blast messages to all clients... If that is what you want it to do.

Link to comment
Share on other sites

On 8/23/2020 at 2:24 PM, chef said:

Okay @ltek here you go.

 

Place this plugin DLL in the "Emby-Server/programdata/plugin" folder and restart Emby.

 

Once it has loaded, please try this url:


POST http://localhost/emby/SendMessage?DeviceName={YOUR_DEVICE_NAME}&Header=Hello&Text=World&TimeoutMs=5000

 

Again you may leave out the 'TimeoutMs' param and have a full screen modal popup with a "Got it" button.

 

Be aware that this will find the first open session in Emby with a particular device name.

Web Browsers, for example, could have multiple sessions with the same device name (Chrome, Firefox, etc.). This will choose the first open session it finds with the device Name.

 

Most likely you are using Roku,  Fire TV, or an Android device of some kind... Please be sure that these devices have unique names.

Example: "Family Room Fire TV" or "Bedroom Roku". 

That way you can target the device you want to send the message to :)

 

 

If this is working for you,  then I will create a version with Authentication on the endpoint, so you will have to use an API-Key like before. Right now you don't need an API-Key to send messages. 

 

 

 

 

DeviceMessenger.zip 4.24 kB · 2 downloads

All tests failed..

204 No Content
http://localhost:8096/emby/SendMessage?DeviceName=Office PC&Header=Hello&Text=World&TimeoutMs=5000
http://192.168.2.60:8096/emby/SendMessage?DeviceName=Office%20PC&Header=Hello&Text=World&TimeoutMs=5000


404 Not Found
http://localhost:8096/web/SendMessage?DeviceName=Office PC&Header=Hello&Text=World&TimeoutMs=5000

Connection Error
http://localhost/emby/SendMessage?DeviceName=Office PC&Header=Hello&Text=World&TimeoutMs=5000
http://localhost/web/SendMessage?DeviceName=Office PC&Header=Hello&Text=World&TimeoutMs=5000

Edited by ltek
Link to comment
Share on other sites

chef

Try using the actual up address of your emby server instead of local host.

Also, are you using POST?

 

Also, please try with an API key at the end of the url 😃

Edited by chef
  • Like 1
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...