Author Topic: Alexa and amazon echo skill  (Read 40496 times)

garagevibes

  • Regular Poster
  • **
  • Posts: 42
    • View Profile
Re: Alexa and amazon echo skill
« Reply #15 on: December 06, 2016, 05:32:36 pm »
Thanks guys for getting back to me, Yes phenigma if you could send over the details of the LMCE oauth2 server details ill get it integrated into that and ill ask polly for some git login details so I can store the code there.

I've created an interface for a central web api portal which is used an intermediate for web services to connect to so for the moment the system works a bit like the quick diagram I've attached.

So there are basically 2 Oauth2 servers in use 1 on the core and 1 one this new web portal the idea being that a number of different web services can connect through the same web portal and it will route the messages to the correct users core and a user can break the chain at either end at any point if they ever need to, this means also that any app we produce can hopefully be released in to the public store's.

Looking on the amazon developer console I believe i can add people as developers to my account if I have there email address so they can add the skill for testing and view the code behind it, the web portal site is simply a router I wanted to keep all the api itself on each users core so that updates and things will stay as they are and hopefully the site will never have to change.

Ive had the idea of including alexa as a voice service as well but thats another task once I have this one solved :)
                                 

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Alexa and amazon echo skill
« Reply #16 on: December 06, 2016, 05:42:44 pm »
Awesome stuff!  I think you're right in line with conversations in the irc dev channel!  I'll get you some more info and a git account if polly/ochorocho hasn't been able to yet.  Send me a PM with your name/username/email and I'll get an account up.

Thanks!

J.

Sent from my Nexus 5 using Tapatalk


phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Alexa and amazon echo skill
« Reply #17 on: December 06, 2016, 06:12:52 pm »
Okay the OAuth2 implementation that was chosen some time ago is described here: https://bshaffer.github.io/oauth2-server-php-docs/cookbook/

I believe the appropriate files are all packaged into the lmce package 'lmce-oauth2-server'.  "apt-get install lmce-oauth2-server" on a core.

This will install the OAuth2 files in /var/www/lmce-admin/include/OAuth2/ and two files "oauth2-server.php" and "oauth2-token.php" in /var/www/lmce-admin/.  When the package installs it creates the database and the appropriate tables.

That's as far as that has made it.  Anything can change as far as configs, etc.

J.

golgoj4

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1193
  • hrumpf!
    • View Profile
    • Mah Website
Re: Alexa and amazon echo skill
« Reply #18 on: December 06, 2016, 06:34:57 pm »
link to code?
Linuxmce - Where everyone is never wrong, but we are always behind xbmc in the media / ui department.

garagevibes

  • Regular Poster
  • **
  • Posts: 42
    • View Profile
Re: Alexa and amazon echo skill
« Reply #19 on: December 06, 2016, 08:48:19 pm »
Haha hilarious it just so happens thats the exact oauth2 server scripts I've been using anyway so should be quite simple to change over to this and my steps to add in the database tables wont be needed either.

I'll just have to change some of the required paths, Ill give this a go and see how i get on once thats done ill upload all the code. I haven't contacted polly yet for a git account ill do that in a min.

cheers all.

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Alexa and amazon echo skill
« Reply #20 on: December 06, 2016, 08:49:07 pm »
:D

Sent from my Nexus 5 using Tapatalk


garagevibes

  • Regular Poster
  • **
  • Posts: 42
    • View Profile
Re: Alexa and amazon echo skill
« Reply #21 on: December 07, 2016, 11:00:52 am »
Hi phenigma,

Ive removed the parts I've added and now installed the new built in OAuth2 server, it all went through fine but it doesn't look to have created the database? hunting through the code I can see there should now be a database called lmce_oauth2_db but I don't seem too be able to find it in my system? I can manually create it for the time being but just to give you a heads up.

Also in the 'oauth2-server.php' file there needs to be the following line added to the bottom otherwise you wont get refresh tokens given and that will be really rubbish if we have to relink our systems every hour when the token expires :) I set the refresh expiration to 14 days here this means that you will have to relink if no commands are sent for more that 14 days? This may want to be extended or made indefinitely.

Code: [Select]
// Add the "Refresh Token" grant type
$server->addGrantType(new OAuth2\GrantType\RefreshToken($storage, array(
    'always_issue_new_refresh_token' => true,
'refresh_token_lifetime'         => 2419200
)));

Whats the best way of going about this just make all the changes need to make this work on these scripts and then upload then to git or zip them and post them? Or am I better just sending you each amendment, I don't think there are that many?

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Alexa and amazon echo skill
« Reply #22 on: December 07, 2016, 02:16:34 pm »
Neato.  Definitely create an Issue in gitlab to track this stuff.  For minor changes you can simply pass the info or files to me.  I'll try to have a look at these initial issues when I get home from work later today.  Thanks!

J.

garagevibes

  • Regular Poster
  • **
  • Posts: 42
    • View Profile
Re: Alexa and amazon echo skill
« Reply #23 on: January 11, 2017, 03:52:48 pm »
Hi phenigma,

Hope you had a merry xmas and a good new year, sorry I've left this for a few weeks over christmas and things.

Im now all up on git and ready to post some initial code but if I'm honest I've never used it before and i have no clue what I'm doing.

I'm assuming I have to clone the current code, add my amendments and adjustments and add in any new files then submit to have it added in to the live repository but I really cant figure it out. I'm probably just being stupid but I seem to be able to create my own projects and add issues into Linuxmce's repo but I don't know if I'm missing something.

Do we have a guide anywhere?

Cheers
 

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Alexa and amazon echo skill
« Reply #24 on: January 11, 2017, 05:16:18 pm »
Hmm.  We haven't made a how-to since moving to git.  Essentially you'll clone the repo, create a new branch, add/change code in that branch, push that updates to the new branch.  Someone can have a look to ensure things look good and in proper locations.  Then it can be merged into the master branch so it is built.  There are lots of how-to for using git from the command line, if you need specific assistance then feel free to ask in -devel. 

Sent from my Nexus 5 using Tapatalk


golgoj4

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1193
  • hrumpf!
    • View Profile
    • Mah Website
Re: Alexa and amazon echo skill
« Reply #25 on: January 16, 2018, 12:21:52 am »
has there been any progress on this?
Linuxmce - Where everyone is never wrong, but we are always behind xbmc in the media / ui department.

golgoj4

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1193
  • hrumpf!
    • View Profile
    • Mah Website
Re: Alexa and amazon echo skill
« Reply #26 on: January 24, 2018, 08:55:06 am »
has there been any progress on this?

Yes there has. Alexa now can control my lights (basic on/off)
some kinks to work out connecting securely back to the core. still working but its far past prototype with endpoints that can support google home too.

now i just have to convince phenigma to upgrade us to php7 . . .
Linuxmce - Where everyone is never wrong, but we are always behind xbmc in the media / ui department.

golgoj4

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1193
  • hrumpf!
    • View Profile
    • Mah Website
Re: Alexa and amazon echo skill
« Reply #27 on: January 26, 2018, 05:54:47 am »
and now dimming and media scenarios  ;D
Linuxmce - Where everyone is never wrong, but we are always behind xbmc in the media / ui department.

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Alexa and amazon echo skill
« Reply #28 on: January 26, 2018, 06:23:35 am »
Ain't it nice, when things fall in place, and stuff starts to work :-)

golgoj4

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1193
  • hrumpf!
    • View Profile
    • Mah Website
Re: Alexa and amazon echo skill
« Reply #29 on: January 26, 2018, 04:54:28 pm »
does anyone know if the other code ever got checked in?

mine is here https://git.linuxmce.org/linuxmce/linuxmce/tree/master/web/lmce-api

i went with cakephp because i can easily provide amazon, google home integration from the same framework. Really anything else that comes along requiring an oauth endpoint.
Linuxmce - Where everyone is never wrong, but we are always behind xbmc in the media / ui department.