Jump to content

Emby with Amazon Alexa


chef

Recommended Posts

nxenos83

I can't seem to see how to slot in titles for movies without creating a rather large intent though.

 

Try to avoid using custom slots and use Amazon's built in types https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#list-types

 

For movie names, use type "AMAZON.Movie". 

 

You only need one intent "playMovie" with a slot for title (type = AMAZON.Movie) There is even a slot type for tv episode titles!! AMAZON.TVEpisode

 

Over on the google side, they don't have nearly as many built-in slots :(

  • Like 1
Link to comment
Share on other sites

nxenos83

So if you slot in for each of your emby ready devices it seems possible to send commands to any of them (playback anyway... As mentioned above)

 

I'm about to try playto commands and see how the code looks for that.

 

I can't seem to see how to slot in titles for movies without creating a rather large intent though.

Oh I see what you are thinking, you would create a separate intent for each device name. I don't think that is needed, this worked for me after I renamed my emby devices to friendly names:

{"intent": "PlayMovie",
      "slots": [
        {
      	  "name": "Movie",
          "type": "AMAZON.Movie"
      	},
        {
          "name": "PlayToDevice",
          "type": "AMAZON.DeviceType"
        }
      ]}
}

With sample utterances

PlayMovie play {Movie}
PlayMovie play {Movie} on {PlayToDevice}
PlayMovie watch {Movie}
PlayMovie watch {Movie} on {PlayToDevice}
PlayMovie play movie {Movie}
PlayMovie play movie {Movie} on {PlayToDevice}
PlayMovie watch movie {Movie}
PlayMovie watch movie {Movie} on {PlayToDevice}

:

Edited by nxenos83
Link to comment
Share on other sites

Got it, so far it looks like this:

{
  "intents": [
    {
      "intent": "NewMovies",
      "slots": [
        {
          "name": "Sign",
          "type": "LIST_OF_NAMES"
        }
      ]
    },
    {
      "intent": "NewTV",
      "slots": [
        {
          "name": "Sign",
          "type": "LIST_OF_NAMES"
        }
      ]
      
    },
    {
      "intent": "playto",
      "slots": [
        {
          "name": "deviceNames",
          "type": "AMAZON.DeviceType"
        }
      ],"slots": [
        {
          "name": "embySpecificClient",
          "type": "LIST_OF_EMBY_CLIENT"
        }
      ],
      "slots": [
        {
          "name": "mediaMovie",
          "type": "AMAZON.Movie"
        }
      ],"slots": [
        {
          "name": "mediaMovieSeries",
          "type": "AMAZON.MovieSeries"
        }
      ],"slots": [
        {
          "name": "mediaMusic",
          "type": "AMAZON.MusicAlbum"
        }
      ],"slots": [
        {
          "name": "mediaMusicTiers",
          "type": "AMAZON.MusicCreativeWorkType"
        }
      ],"slots": [
        {
          "name": "mediaMusicGroup",
          "type": "AMAZON.MusicGroup"
        }
      ],"slots": [
        {
          "name": "mediaMusicArtist",
          "type": "AMAZON.Artist"
        }
      ],"slots": [ 
        {
          "name": "mediaMusicRecording", 
          "type": "AMAZON.MusicRecording"
        }
      ],"slots": [
        {
          "name": "mediaTVSeries",
          "type": "AMAZON.TVSeries"
        }
      ],"slots": [
        {
          "name": "mediaTVSeason",
          "type": "AMAZON.TVSeason"
        }
      ]
    }
  ]
}

But, in the Emby config for the plugin, there will have to be some sort of device comparer.

 

my xbox one is called "XboxOne" on the network and in emby not "Xbox One".

 

I can see that the current verison of the plugin has a "Playto" Device, where you can choose one.

 

in order to control all emby ready devices, there may have to be some sort of correcting list.

 

Perhaps the idea of using rooms might help. 

 

XboxOne = Family Room

 

The command would be "Ask Emby to play Aliens in the Family Room"

 

this would also alleviate any Alexa confusion when you have two of the same device in your home. Example two chromcasts  and Alexa would have to ask which one to play the movie on.

 

What do you think?

Edited by chef
Link to comment
Share on other sites

legallink

Random question, are you looking at this as requiring Emby to be installed on the local lan?  Or is it simply devices/end points on the local lan of Alexa/Google Home/etc.

Link to comment
Share on other sites

nxenos83

in order to control all emby ready devices, there may have to be some sort of correcting list.

 

Perhaps the idea of using rooms might help. 

 

XboxOne = Family Room

 

The command would be "Ask Emby to play Aliens in the Family Room"

 

this would also alleviate any Alexa confusion when you have two of the same device in your home. Example two chromcasts  and Alexa would have to ask which one to play the movie on.

 

What do you think?

 

In the Devices Dashboard, we have the ability to give emby devices that has persistent IDs friendly names. (Unfortunately, ET UWP does not do this).  For example, my receiver's original name was the simply the model number, I changed it to "Receiver" and after that the" "play ... on Receiver" command worked

Link to comment
Share on other sites

Random question, are you looking at this as requiring Emby to be installed on the local lan?  Or is it simply devices/end points on the local lan of Alexa/Google Home/etc.

 

Well, in order to have Echo or Home connect with Emby you'll have to open ports to the internet.

 

there has to be a secure SLL/HTTPS connection between the two.

 

The WAN port is how Echo and Home will connect.

 

There is a great "How-To" written by @@Swynol found here on how to do it:

https://emby.media/community/index.php?/topic/44757-setting-up-ssl-for-emby-wip/?hl=%2Bemby+%2Bdomain+%2Bssl

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

In the Devices Dashboard, we have the ability to give emby devices that has persistent IDs friendly names. (Unfortunately, ET UWP does not do this).  For example, my receiver's original name was the simply the model number, I changed it to "Receiver" and after that the" "play ... on Receiver" command worked

This probably why my Xbox One rotates its GUID all the time.

 

For my Vera plugin, I have to get devices by name, whereas I use to get them by name and check that their IDs were right as a secondary check.

 

Can't check IDs now because they're always changing.

 

 

------

I also added some Emby Specific client Names like  "Theater".

 

I suppose the utterance could be: "Play Aliens in Emby Theater on Xbox One"

 

If you have two Xbox Ones... then... the conversation with the bot has to go further.

 

I'm thinking Rooms might be the answer.

Edited by chef
Link to comment
Share on other sites

nxenos83

I'm thinking it might be better to split out different play intents based upon media type. That way, when processing the request we can use the intent name to help dictate how to query for the items.  If we used one intent for them all, we would need to cycle through all of the slots to check for non-null values, then use the slot type to help define the library query. 

 

Having distinct intents (playArtist, playAlbum, playMovie, etc) as opposed to using the slot types will also help keep similar code for both amazon and google, since the two have different built-in slot types

  • Like 1
Link to comment
Share on other sites

nxenos83

This probably why my Xbox One rotates its GUID all the time.

 

For my Vera plugin, I have to get devices by name, whereas I use to get them by name and check that their IDs were right as a secondary check.

 

Can't check IDs now because they're always changing.

 

I have request for the UWP to have persistent id -- DLNA devices are another issue. Perhaps we should raise a change request to add MAC addresses in the device saved profile?

Edited by nxenos83
Link to comment
Share on other sites

I have request for the UWP to have persistent id -- DLNA devices are another issue. Perhaps we should raise a change request to add MAC addresses in the device saved profile?

Let's ask right now. lol!

 

@@Luke could you add that information to the emby api?

 

 

 

I'm thinking it might be better to split out different play intents based upon media type. That way, when processing the request we can use the intent name to help dictate how to query for the items.  If we used one intent for them all, we would need to cycle through all of the slots to check for non-null values, then use the slot type to help define the library query. 

 

Having distinct intents (playArtist, playAlbum, playMovie, etc) as opposed to using the slot types will also help keep similar code for both amazon and google, since the two have different built-in slot types

 

So using utterances like: "Play the movie Dr. Strange..." or "Play the latest episode/next up episode from..." <-- putting a series name as commands here.

 

I like that a lot! nice!

Link to comment
Share on other sites


{
"intents": [
{
"intent": "NewMovies",
"slots": [
{
"name": "MovieAlternatives",
"type": "LIST_OF_MOVIE_ALTS"
}
]
},
{
"intent": "NewTV",
"slots": [
{
"name": "TVAlternatives",
"type": "LIST_OF_TV_ALTS"
}
]

},
{
"intent": "playMovie",
"slots": [
{
"name": "deviceNames",
"type": "AMAZON.DeviceType"
},
{
"name": "embySpecificDevice",
"type": "LIST_OF_EMBY_CLIENT"
},
{
"name": "mediaMovie",
"type": "AMAZON.Movie"
},
{
"name": "mediaMovieSeries",
"type": "AMAZON.MovieSeries"
}
]
},
{
"intent": "playMusicAlbum",
"slots": [
{
"name": "deviceNames",
"type": "AMAZON.DeviceType"
},
{
"name": "embySpecificDevice",
"type": "LIST_OF_EMBY_CLIENT"
},
{
"name": "mediaMusicAlbum",
"type": "AMAZON.MusicAlbum"
}
]
},
{
"intent": "playMusicArtist",
"slots": [
{
"name": "deviceNames",
"type": "AMAZON.DeviceType"
},
{
"name": "embySpecificDevice",
"type": "LIST_OF_EMBY_CLIENT"
},
{
"name": "mediaMusicGroup",
"type": "AMAZON.MusicGroup"
},
{
"name": "mediaMusicArtist",
"type": "AMAZON.Artist"
}
]
},
{
"intent": "playMusicSong",
"slots": [
{
"name": "deviceNames",
"type": "AMAZON.DeviceType"
},
{
"name": "embySpecificDevice",
"type": "LIST_OF_EMBY_CLIENT"
},
{
"name": "mediaMusicRecording",
"type": "AMAZON.MusicRecording"
}
]
},
{
"intent": "playTV",
"slots": [
{
"name": "deviceNames",
"type": "AMAZON.DeviceType"
},
{
"name": "embySpecificDevice",
"type": "LIST_OF_EMBY_CLIENT"
},
{
"name": "mediaTVSeries",
"type": "AMAZON.TVSeries"
},
{
"name": "mediaTVSeason",
"type": "AMAZON.TVSeason"
},
{
"name": "mediaSeasonAlts",
"type": "LIST_TV_SEASON_ALTS"
},
{
"name": "mediaNumbers",
"type": "AMAZON.Number"
},
{
"name": "mediaEpisodeAlts",
"type": "LIST_OF_EPISODE_ALTS"
}
]
}
]
}
Edited by chef
Link to comment
Share on other sites

nxenos83

Is that model working for you? I think the model is only expecting one "slots" object per intent

 

like this:

{"intent": "intentName",
      "slots": [
        {
      	  "name": "slot1.Name",
          "type": "slotType"
      	},
        {
          "name": "slot2.Name",
          "type": "slotType"
        }
      ]}
}
Link to comment
Share on other sites

 

Is that model working for you? I think the model is only expecting one "slots" object per intent

 

like this:

{"intent": "intentName",
      "slots": [
        {
      	  "name": "slot1.Name",
          "type": "slotType"
      	},
        {
          "name": "slot2.Name",
          "type": "slotType"
        }
      ]}
}

 

Fixing it now.  Thank you for that. It's working now.

Edited by chef
Link to comment
Share on other sites

From what I can gather inside the Plugin there has to be a Class which has properties named after each slot name, to hold the data coming in from the Skill.

 

In the case of the premade device lists from Amazon (ie. "AMAZON.Devicetype" ), the list  will be missing certain client names that emby has, like:

 

"Emby Theater" or "Emby for Media Center" (These are Client names, and "Windows" is the device name"... I think.)

 

 

Currently, the user must choose a Device from a configuration dropdown list to utilize the "play to"  function.

 

 

If there were custom slots for each emby client/device name, then we could use all the clients/devices on the network, instead of one.

 

But,  there is a problem when adding two different SlotTypes to a phrase:


"intent": "playTV",
      "slots": [
        {
          "name": "deviceNames",
          "type": "AMAZON.DeviceType"
        },
        {
          "name": "embySpecificDevice",
          "type": "LIST_OF_EMBY_CLIENT"
        },
        {
          "name": "mediaTVSeries",
          "type": "AMAZON.TVSeries"
        }
      ]
    }
Ask Emby to play {mediaTVSeries} on {embySpecificDevice}
Ask Emby to play {mediaTVSeries} on {deviceNames}

In this case the user should be able to request any Device that Amazon has in their   premade list, but also in a custom list of "embySpecificDevice".

 

In the plugin part of the code after the information has been sent from the Skill Service to the Emby Server:

 

I believe it can be sorted like this:

 public void PlayTV(string deviceNames = "default", string embySpecificDevice = "default", string mediaTVSeries)
        {
          //Sorted Code Here
        }

But, then those optional parameters have to be checked against "default" to see which one the user requested.

 

Is there a better way of checking optional parameters, when one is always going to be "default", and the other is going to be the string you want to use?

 

 

My goodness, did I ask this question properly?

Edited by chef
Link to comment
Share on other sites

nxenos83

Slot types (both custom and built-in) don't work like a list of values selection.  The available entries just act as sample of the types of word or phrases that can be expected. There is no guarantee that the returned value will be equal to one of the defied entries. I tested this with a built-in slot type "Play Pink Floyd on Emby Theater" returned "Emby Theatre" in the slot I defined as AMAZON.DeviceType.

 

If you want to add in some additional expected values to help, you can extend the built-in slot types with those additional values:

 

"These slot types each represent a list of items. You can extend some of these slot types with additional utterances by defining a custom slot type with the same name and adding the additional items as custom slot type values. For more examples of utterances and slot values, see the sections below."

 

So create a custom slot type with the name "AMAZON.DeviceType" and add the values that you think will help

Link to comment
Share on other sites

Slot types (both custom and built-in) don't work like a list of values selection.  The available entries just act as sample of the types of word or phrases that can be expected. There is no guarantee that the returned value will be equal to one of the defied entries. I tested this with a built-in slot type "Play Pink Floyd on Emby Theater" returned "Emby Theatre" in the slot I defined as AMAZON.DeviceType.

 

If you want to add in some additional expected values to help, you can extend the built-in slot types with those additional values:

 

"These slot types each represent a list of items. You can extend some of these slot types with additional utterances by defining a custom slot type with the same name and adding the additional items as custom slot type values. For more examples of utterances and slot values, see the sections below."

 

So create a custom slot type with the name "AMAZON.DeviceType" and add the values that you think will help

 

I'll be... 

 

So Slot types are sometimes place-holders for an expected part of the phrase.

 

Alexa is waiting for a part of the command that is considered a "Device" when you create a phrase and tell it where the slot value is.

 

that's pretty cool.

Edited by chef
Link to comment
Share on other sites

Guest asrequested

I don't know if this is any help, but I'd like to be able say something like "Alexa, play trouble with tribbles with theater" and when playing, if I want to pause, say "Alexa, pause theater"

Link to comment
Share on other sites

I don't know if this is any help, but I'd like to be able say something like "Alexa, play trouble with tribbles with theater" and when playing, if I want to pause, say "Alexa, pause theater"

That part is working :)

 

But you have to say:

 

"Alexa ask emby to pause Emby theater"

 

There maybe a way to shorten the phrase by creating a dictionary of devices.

Maybe in the configuration page?

Link to comment
Share on other sites

Guest asrequested

I have the Logitech skill in use, and I never say 'ask' or 'logitech'. When I turn my system on, all I say is "Alexa, TV on". Echo recognizes all the components as a group, that I have named 'TV'. Maybe something like this is possible for Emby?

Link to comment
Share on other sites

Volfan6415

So i have read through this thread and I am super excited about where this is headed.  Hoping you will get this to a stage where anyone can test and use soon.

  • Like 1
Link to comment
Share on other sites

I have the Logitech skill in use, and I never say 'ask' or 'logitech'. When I turn my system on, all I say is "Alexa, TV on". Echo recognizes all the components as a group, that I have named 'TV'. Maybe something like this is possible for Emby?

This is true. But the key word that you use is "On".

 

Alexa will turn things in and off without the needs for the "Ask" prefix.

 

I use echo to lock the doors in my house by saying "Turn front door locks on/off" I also use it to turn on my fireplace by using the same style of command.

 

For emby you can say: "Alexa start Emby" and from there the app will be in emby mode, which will alleviate any need to "ask" for things.

 

But, one off commands will have (at the moment) be "ask" commands.

  • Like 1
Link to comment
Share on other sites

nxenos83

I have the Logitech skill in use, and I never say 'ask' or 'logitech'. When I turn my system on, all I say is "Alexa, TV on". Echo recognizes all the components as a group, that I have named 'TV'. Maybe something like this is possible for Emby?

There only 2 types of skills that can be invoked without starting with the the skill name (smart home and music providers)

 

Smart skills are limited to commands like turn on, turn off, dim, change temperatures. This sounds like what the Logitech skill is using.

Edited by nxenos83
Link to comment
Share on other sites

Guest asrequested

Gotcha! That makes sense. I'm sure you guys will work your magic. One command that just occurred to me was, full-screen and window. It may only be applicable to a few people or just me. But I toggle between full-screen and window, a lot. Not a big deal, just throwing it out there.

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