Jump to content

Emby with Amazon Alexa


chef

Recommended Posts

@@chef, to lock doors, do you have a server setup that mimics a wemo device?

It is a server which mimics Phillip hue bridge, and it is connected to Veralite

Link to comment
Share on other sites

Also I found some useful code that might help us compare device types easier.

 

http://stackoverflow.com/questions/2344320/comparing-strings-with-tolerance

 

it's called the Levenshtein Distance algorithm.

 

It might be better then trying to just use 

String.Compare

I think it would help fill request like what Doofus had: "Play on Theater" == "Emby Theater"

 

 

 

There is one other thing I have run into.

 

Xbox One has DLNA and Emby Theater.

 

If I say "Play (Movie} on Xbox One" it chooses DLNA, but there also has to be room for Clients application added as well. So we can actually say "Play on Theater" and it will understand.

Edited by chef
Link to comment
Share on other sites

Overseer

...I also use it to turn on my fireplace by using the same style of command.

 

Ok, that's just showing off.  Does Alexa also roast chestnuts for you on that fire?  :lol:

  • Like 1
Link to comment
Share on other sites

Guest asrequested

Also I found some useful code that might help us compare device types easier.

 

http://stackoverflow.com/questions/2344320/comparing-strings-with-tolerance

 

it's called the Levenshtein Distance algorithm.

 

It might be better then trying to just use 

String.Compare

I think it would help fill request like what Doofus had: "Play on Theater" == "Emby Theater"

 

 

 

There is one other thing I have run into.

 

Xbox One has DLNA and Emby Theater.

 

If I say "Play (Movie} on Xbox One" it chooses DLNA, but there also has to be room for Clients application added as well. So we can actually say "Play on Theater" and it will understand.

 

It did occur to me that there are multiple Theater apps. I guess there would need to be a differentiator.

Link to comment
Share on other sites

I have been having a heck of a time getting the "cast" function to work with theater.

 

On Xbox one the theater app doesn't show up under the cast devices, only the Xbox DLNA option.

Link to comment
Share on other sites

nxenos83

I have been having a heck of a time getting the "cast" function to work with theater.

 

 

On Xbox one the theater app doesn't show up under the cast devices, only the Xbox DLNA option.

It shows up for me in the Web app, but only when the theatre app is open on xbox. I'll check today if I see it in the session manager.

  • Like 1
Link to comment
Share on other sites

Update,

 

when utilizing the theater through a web browser, I can get Alexa to command it.

But, the xbox one will not work with Emby Theater. Weird thing is that it is the exact same app....

Edited by chef
Link to comment
Share on other sites

would you say post 106 is the first steps that need to happen, just so we are ready to test?   :)

Yes. Follow that "How To", and get your https domain working. 

Link to comment
Share on other sites

nxenos83

@@chef

 

So, the biggest draw for me for echo/google integration is to be able to be able to say "Alexa, ask emby to play Big Bang Theory on Living Room TV" and have TV turn on fire up the device that runs emby client and start the episode.  We are going to be able to send some commands to a emby client that is already running (and in case of DLNA devices, the device only needs to powered on).  But if I have to use my phone to begin casting to a chromecast, or need to turn on xbox and then open the Emby Theater app prior to issuing the command - I already have the remote in hand and the voice command isn't as valuable.

 

My thought is that we should provide a way to define an optional pre-play http command to be issued for each device in the plugin configuration. For example, i can fire up by receiver with a simple http command. So when I say Play Music on Receiver, if there wasn't an active session for my receiver, the custom http request would be sent to turn it on.  I'm looking at Home Assistant running on a rasberry pi to handle my play request (primarily because it plays friendly with chromecast -- as a side note it plays nice with Emby too!!).  There is a bit of a learning curve to get Home Assistant setup, but if we provide the option for an entry point, it would be easier for users to setup complex HA scenarios. (https://home-assistant.io/)

 

I'll work on prof of concept for this in the next few days.  

 

FYI (got this idea from creating a webhooks plugin based upon a request  https://emby.media/community/index.php?/topic/44472-include-webhooks/)

Edited by nxenos83
  • Like 2
Link to comment
Share on other sites

That sounds really good. I was thinking the same thing.

 

Turning on devices would be fantastic.

 

I looked everywhere for http requests to turn on Xbox one. It was hard to find, and was slightly complicated due to having so many Headers involved in the process. I sort of gave up on it :)

 

To turn on an Xbox your LiveID is somehow involved in the command and then you have ping the IP again to make sure it started properly .

 

 

----

I was able to have playback start on any emby ready device which was already running.

 

I was able to send play commands to all of them.

Except theater on Xbox.

 

As long as Alexa hears the device name properly.

 

I also almost have simple browse commands working for clients. I got hung up on some problems but Luke mentioned he was going to rework some server code to allow for this to happen, which is quite supportive to our cause.

 

Very exciting!

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

nxenos83

Turning on devices would be fantastic.

 

I looked everywhere for http requests to turn on Xbox one. It was hard to find, and was slightly complicated due to having so many Headers involved in the process. I sort of gave up on it :)

 

To turn on an Xbox your LiveID is somehow involved in the command and then you have long the IP again to make sure it started properly .

 

Turning on XboxOne sounds like a job for an IR blaster.  Getting it to fire up emby client... that's another thing.

Link to comment
Share on other sites

@@chef

 

So, the biggest draw for me for echo/google integration is to be able to be able to say "Alexa, ask emby to play Big Bang Theory on Living Room TV" and have TV turn on fire up the device that runs emby client and start the episode.  We are going to be able to send some commands to a emby client that is already running (and in case of DLNA devices, the device only needs to powered on).  But if I have to use my phone to begin casting to a chromecast, or need to turn on xbox and then open the Emby Theater app prior to issuing the command - I already have the remote in hand and the voice command isn't as valuable.

 

My thought is that we should provide a way to define an optional pre-play http command to be issued for each device in the plugin configuration. For example, i can fire up by receiver with a simple http command. So when I say Play Music on Receiver, if there wasn't an active session for my receiver, the custom http request would be sent to turn it on.  I'm looking at Home Assistant running on a rasberry pi to handle my play request (primarily because it plays friendly with chromecast -- as a side note it plays nice with Emby too!!).  There is a bit of a learning curve to get Home Assistant setup, but if we provide the option for an entry point, it would be easier for users to setup complex HA scenarios. (https://home-assistant.io/)

 

I'll work on prof of concept for this in the next few days.  

 

FYI (got this idea from creating a webhooks plugin based upon a request  https://emby.media/community/index.php?/topic/44472-include-webhooks/)

 

That is the biggest roadblock in the usability of this entire system and, frankly, our remote control system as well.

 

The problem is that most of the target devices have no way (that I'm aware of) to start a program that isn't running.

 

So, if we could clear that hurdle somehow it would make all of this a much more valuable feature.

Link to comment
Share on other sites

nxenos83

That is the biggest roadblock in the usability of this entire system and, frankly, our remote control system as well.

 

The problem is that most of the target devices have no way (that I'm aware of) to start a program that isn't running.

 

So, if we could clear that hurdle somehow it would make all of this a much more valuable feature.

 

I don't think there is a one size fits all solutions here. It will most likely require a unique solution for each device that is running the emby client -- on some devices it might simply be impossible. Some device will require additional software/configuration or hardware (think a hub like vera + an IR blaster, or Logitech remote)  

 

I think the idea above can be extended system wide to make a better remote control experience. Add additional configuration on devices to send a wake command (for many DLNA devices, building in wake on lan config might do the trick). We can build out profiles for known devices, but also allow for users to define their own endpoints.

 

In clients, devices with profiles setup could appear in the cast drop down with an indication that it is offline. Selecting it would then send the wake command. Wait for the emby session to appear (or a configured timeout), and then attempt to attach to the session to control. 

 

This approach seems feasible in the abstract.  I'll see what I can do as a plugin as a poc. If I can get something working with my feeble programming skills, then the professionals could look into adding to server core and make adjustments to clients.

Link to comment
Share on other sites

Chromecast has the ability to turn devices on through hdmi. But the device has to have the ability to turn on through hdmi. Most new tvs have this ability.

Link to comment
Share on other sites

I've moved to testing on the actual Echo Device extensively . I've kept my phrases short and to the point, but Alexa still has a hard time collecting the information I speak to it.

 

What happens when you set "shouldEndSession" to false.

 

I think It might have to happen, where you tell Alexa that you want to watch a MediaType and Where.

 

Then separately tell it what the item is.

 

Or tell it you want to watch a media type and what item, then tell it after where to play it.

 

Like:

 

User: "Ask emby to watch the movie Back to the future"

Alexa:"Where to play it"

User: "Front Room TV"

Edited by chef
Link to comment
Share on other sites

Yep having that bit of back and forth with the echo definitely makes a difference.

 

I just hold the mediaItem name in a static  property, and then feed it back into the play function.

 

There is no misses that way. It only has to deal with one slot type at a  time.

Link to comment
Share on other sites

PrincessClevage

That sounds really good. I was thinking the same thing.

 

Turning on devices would be fantastic.

 

I looked everywhere for http requests to turn on Xbox one. It was hard to find, and was slightly complicated due to having so many Headers involved in the process. I sort of gave up on it :)

 

To turn on an Xbox your LiveID is somehow involved in the command and then you have ping the IP again to make sure it started properly .

 

 

----

I was able to have playback start on any emby ready device which was already running.

 

I was able to send play commands to all of them.

Except theater on Xbox.

 

As long as Alexa hears the device name properly.

 

I also almost have simple browse commands working for clients. I got hung up on some problems but Luke mentioned he was going to rework some server code to allow for this to happen, which is quite supportive to our cause.

 

Very exciting!

Don't know if these are of any help Chef:

https://community.smartthings.com/t/xbox-one-wake-on-lan/35041/3

 

https://github.com/arcreative/xbox-on

  • Like 1
Link to comment
Share on other sites

nxenos83

This gets us half way there. Xbox will be powered on, but we need a way to launch emby theater. I'm trying to reverse engineer the Xbox android app to see what command is being sent for the "Play On Xbox".

Link to comment
Share on other sites

This is the bridge I use to command home automation (Veralite) with echo.

 

http://www.myzwave.net/index.php/adding-voice-control-to-vera-z-wave-systems-using-amazon-echo/2/

 

It uses a Java based sever to redirect on/off commands to veralite.

 

It seems possible to send http commands to more then just Vera though.

 

Infact, I bet we could piggy back on this program to turn anything on that can accept http commands ;)

Link to comment
Share on other sites

PenkethBoy

This is getting very interesting :)

 

Keep going guys it sounds like you have made good progress

 

I should have bought an echo at xmas when they were on offer....

Link to comment
Share on other sites

nxenos83

So I was sniffing all of the network traffic sent to the xbox from smartglass apps (both Andorid and win10 UWP) to try to figure out what packet needs to be sent to launch Emby.  Best thing I was able to do was ping the xbox and get guid and device id.

 

I'm in way over my head on this....

Link to comment
Share on other sites

nxenos83

Yep having that bit of back and forth with the echo definitely makes a difference.

 

I just hold the mediaItem name in a static  property, and then feed it back into the play function.

 

There is no misses that way. It only has to deal with one slot type at a  time.

 

What do you think about switching the flow just a bit. 

 

Save the device as part of the config.  When user asks to play something, if the device is not set then prompt for the device. The next time the user asks to play something, don't ask for the device.

 

Setup a separate intent that allows the user to change device: something like "Ask emby to change device to Front Room TV"

 

Downside would be homes with multiple Alexa devices. Have you seen anything in the response that could be used to identify which device was making the request? Prompting for the device each time resolves this (as long as you are tracking the media intent data by session), but could be a bit tedious.

  • 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...