LIFX control with Amazon Echo?

I found the following video: https://youtu.be/DxYehvo6yW4

Amazon released an Alexa Skills Kit to leverage the voice control of the Amazon Echo.

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit

Does any of you can help and tell me step by step how to control the LIFX with Amazon Echo as demonstrated in the video?

I appreciate any help.

Since you can access your LIFX light via the restful HTTP API, the light becomes just another internet-connected thing. As such, you can access & control it from your own Alexa skill.

To setup your own Alexa skill you can either use Amazon’s Lambda service (Java or Node.js), or, if you have access to a secure webserver yourself, you can set it up on your server, in your preferred programming environment.

I have configured an Alexa skill with an intent that then connects to my LIFX lights, interrogates/manipulates them, and then talks back to me via Alexa.

My alexa skill uses the following intent:

  { "intent": "FiatLux",
      "slots": [
         {
          "name": "lightStatus",
          "type": "LITERAL"
        },
       {
          "name": "lightColor",
          "type": "LITERAL"
        },
        {
          "name": "lightIntensity",
          "type": "NUMBER"
        }
      ]
    }

and the sample utterances are

FiatLux about the light
FiatLux to turn {on|lightStatus} the light
FiatLux to change the light color to {blue|lightColor}
FiatLux to change the light intensity to {ten|lightIntensity}

My skill is written in Ruby on Rails, and runs on my secure server. When Alex detects the invocation name, it forwards the request to my server, where the FiatLux intent is then detected, the lights is hit via the LIFX HTTP API, and the response is sent back to Alexa so she can tell me what she just did.

Hope this makes sense :smile:
Patrick

1 Like

See http://j.mp/alexalifx for a demo.

Wow! that looks awesome Patrick! Thanks for sharing.

Thank you Patrick! Impressive work.

As I have no server I would love to use the Lambda service where I registered.
I do have the LIFX URL that I need to call.

But where I need help is what script to program for the Lambda service.
I will try to see if there is a good book to learn about Node.js.
If somebody has a .js script ready to initiate the URL please let me know :smile:

Thank you,
Alex

I too would like the script to call the APIs. I’m all set up with the intent and utterance schemas. I’ve even been able to start the session. I’ve done it all by trying to hack the sample “favorite color” example. This is difficult to code for us script kiddies, any help on getting the scripts would be awesome.

Give me a few days to clean up my code, and I’ll upload it to my github and post back here when it’s finished. I can dim/brighten the lights, turn them on/off, change the colors. I’ve yet to implement scene change functionality, but it all works pretty well as of now.

You can find my Alexa Skill here. If you have any questions just ask and I’ll do my best to explain it.

2 Likes

Thank you! Thank you! Thank you! I have tried to copy so many different skills and this was the first one I’ve gotten to work! Have you done any other projects with Alex? Roku or anything along those lines?

I seriously cannot thank you enough.

You’re welcome :slight_smile: I’m glad I was able to help! I sadly don’t own a Roku so I’ve never got to play with it. The only other project I’ve done with Alexa is using her to issue WOL packets to my computer or have her issue a shutdown command using SleepOnLan. I haven’t had any ideas as of yet for IoT projects with her.

well i have a million IOT ideas, but lack the skill to execute them. Happy to give you some should you decide your ready to take Alexa to the connected home

Name some and I’ll see what I can do :smiley:

The most obvious is Nest. I believe they have an API that doesn’t require you to do the work on an LAN. Echo doesn’t work well with LANs, so if you work with a device that doesn’t have a public API (like a Roku, for example) you need to either port-forward or set up an internal nodejs server. Dont want to hijack this Lifx Thread anymore, but wonder if there’s a way to continue this convo offline

I’m currently building a way to control LIFX lights via Jasper, a Raspberry Pi voice control platform written in platform. https://github.com/kz/lifx-jasper

Thanks, I was going to look at Jasper but it seemed to have a lack of support for Pi 2 but that was at first glance.

I have 7 bulbs with 3 groups so if I get around to giving it a try I will look at adding support for the extra bulbs.

Much appreciated oh Purple one.

Do you think the LIFX UDP SDK is better for development of multi light control or the HTTP API? There would be a delay with HTTP API of about one second.

Hi Seechay,
This is my first attempt at lifx and alexa. I just can’t seem to get it working. I know it’s me and not your program.

What is the syntax to get alexa to turn on the lights? I set the invocation phrase to “Life Ex” as you did.

I followed your instructions and added in my amazon App ID and my token from Lifx.
Copied the intent schema (used text edit to copy the text) and sample utterances.
I zipped the src folder with the json and index and uploaded to lambda.

can’t get it to seem to work.

Whatever system you use to control the lights be it Jasper or Echo I would say use both.
If you want to control the lights quickly use the LAN protocol, this would be for on, off, colours etc via voice control
If you want to apply scenes or groups easily then you are not worried about a 1 second HTTP delay so use that to enable “Jasper, set group Loungeroom to scene movie”. This way you control your scenes and groups on the app and not have to code them into your system to be supported.
That’s what I am thinking anyway

nevermind, i figured out that it was user error. i wasn’t “asking” alexa to use lifx.

for others who are new, to get alexa to use the skill you need to say:

“alexa, ask life ex lights on” etc

I noticed in the updated v1 HTTP API they have changed the path to change color, it needs to be changed to /state from /color.