News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

Alexa and amazon echo skill

Started by garagevibes, October 14, 2016, 05:37:36 PM

Previous topic - Next topic

garagevibes

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

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

My setup: [url="http://wiki.linuxmce.org/index.php/User:Phenigma"]http://wiki.linuxmce.org/index.php/User:Phenigma[/url]

phenigma

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.
My setup: [url="http://wiki.linuxmce.org/index.php/User:Phenigma"]http://wiki.linuxmce.org/index.php/User:Phenigma[/url]

golgoj4

Linuxmce - Where everyone is never wrong, but we are always behind xbmc in the media / ui department.

garagevibes

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

:D

Sent from my Nexus 5 using Tapatalk

My setup: [url="http://wiki.linuxmce.org/index.php/User:Phenigma"]http://wiki.linuxmce.org/index.php/User:Phenigma[/url]

garagevibes

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.


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

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.
My setup: [url="http://wiki.linuxmce.org/index.php/User:Phenigma"]http://wiki.linuxmce.org/index.php/User:Phenigma[/url]

garagevibes

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

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

My setup: [url="http://wiki.linuxmce.org/index.php/User:Phenigma"]http://wiki.linuxmce.org/index.php/User:Phenigma[/url]

golgoj4

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

Quote from: golgoj4 on January 16, 2018, 12:21:52 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

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

Ain't it nice, when things fall in place, and stuff starts to work :-)
If I helped you, feel free to buy me a coffee: [url="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES"]https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES[/url]

golgoj4

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.