Simple node.js Lambda function for Phillips Hue smart light home kit motion sensor.
TL;DR- Allows you to ask Alexa for the current room temperature.
This works by exposing the Phillips Hue Bridge 2nd Generation api to AWS Lamda, where we make a request for the motion sensor data. The Phillips hue motion sensor tracks motion as well as light, but interestingly enough it also has an onboard temperature sensor, which is what this function takes advantage of.
The middle tier REST API will need to be running locally to expose the Hue Bridge to AWS. I had mine running on a Raspberry Pi Model 3 and managed the deployment using PM2 (http://pm2.keymetrics.io/)
See https://github.com/kalvinlim/phillips-hue-motion-sensor-rest-api
And companion AWS Lex Chatbot (to connect with Slack, Facebook chat, Alexa, etc): https://github.com/kalvinlim/Charlotte
config.url = 'http://<ip address>/sensor';
where, ip address is the ip of the motion sensor back end (see prerequisites)
Part 1 - Set up the lamda function. The Alexa skill will be querying the lambda function for the room temperature.
-
You will need to log into your Amazon Console and create a new Lambda Function (https://console.aws.amazon.com)
-
Name your function and set the role to the existing lambda_basic_execution
-
Pull this repository
git clone https://github.com/kalvinlim/phillips-hue-motion-sensor-lambda.git
- Inside the repo, pull its node dependencies:
npm install
-
You will need to log into your Amazon Developer Console and into the Alexa tab (https://developer.amazon.com/edw/home.html)
-
Click the get started button under Alexa Skills Kit and then Add a New Skill:
-
Save the skill
-
In the Skill Builder screen (Beta at the time of writing this readme), add a new intent:
For the sample utterance, use the phrase "ask invocation name for room temperature", where invocation name is the value you had chosen in the step 3.
-
Save the model.
-
In the configuration screen, paste the lambda ARN from part 1:
-
Save and move on to the test screen. Make sure the skill testing switch is enabled:
-
Type your utterance in the test simulator (ask invocation name for room temperature). You should get a response like so:
If this is the case, everything should be set up correctly and the skill will be physically available on your Alexa enabled device for testing.