I haven't done a direct AWS integration yet (for example, have Alexa read the temperature of the my house back to me). I do have my oaks
indirectly responding to simple verbal commands from Alexa. Perhaps this might be useful to someone.
The first takes advantage of Alexa, IFTTT and Particle integration, and is by far the easiest. By this I mean, if you've already created a particle function, then you are a wizard away from sending a trigger using Alexa. Connect Particle to your IFTTT account (and Amazon to IFTTT if you haven't already) and you can create IFTTT rules using the oaks as the source event or a target. The available Amazon Echo event triggers are limited in my opinion, but the two I find useful are "Your Alarm goes off" and "Your Timer goes off". Also, you don't have to depend on a separate event. You can create a trigger phrase for Alexa that calls a function or sets an event to Particle and envoke by saying "Alexa, trigger
phrase you create".
The issue I was trying to address was with multiple Amazon Echos, timers and alarms. If I set a timer, "Alexa, set a timer for 20 minutes", in 20 minutes the timer goes off
on the echo that set the timer. Even if I'm upstairs next to a
different echo than the one I set the timer with the only audible response will be from the original Echo device that set the timer. IFTTT can trigger an event when the Echo's timer goes off, like blink a light, but it will only do it for one device, not a group, so I can't blink the house lights out of the box. The same is true for alarms.
But... If I created an IFTTT integration to Particle, Amazon also sends that event to IFTTT, IFTTT triggers a function on Particle, Particle sends that to the oak. Now I have an event on a device on my network in my house (my Oak) and I can control whatever I want. In practice, I've only turned on an LED.
My intention was to light LEDs or buzzers around the house when a timer goes off but I'm in another room. Specifically if the timer is supposed to remind me I've got soda in the freezer or a soldering iron is on.
The idea was to scatter the Oaks around the house to play with SUBSCRIBE/PUBLISH functionality but I haven't gotten to it yet.
The second way takes advantage of Alexa working Phillips Hue bridges without going to the internet. I'm using Alexa to control the heater on my Radio Thermostat. Amazon doesn't support it directly but it's REST API is well documented. Since I can turn a light bulb "on", "Off", and DIM it in values that are ranges I'd use for my heater or air conditioning, I have a way to set the temperature. BONUS: Alexa doesn't seem to care if you say "Degrees" instead of "Percent".
To do this, I'm using:
- A Phillips Hue Emulator, specifically HA-bridge (https://github.com/bwssytems/ha-bridge)
- A Raspberry Pi to run HA-Bridge on my local network. Nice way to leave this stuff running 24/7 without a full PC on
- An Oak with a red light plugged into it (I know, I'm lighting an LED again, but hang with me)
- I install Ha-Bridge somewhere
- Browse to HA-Bridge and configure a fake bulb called "heater"
- Edit the bulb and create HTTP/HTTPS requests (or run a script) for On, Off and DIM commands including distinct form data for each action including DIM data
"Alexa, Turn heater on"
https request to particle api, turns a red light on letting me know I'm in heater mode. I used to also send a command to place my heater in heat mode but I've found it pointless.
URL: https://api.particle.io/v1/devices/PutYourOaksDeviceIDHere/led?access_token=PutYourAccessTokenHere
Form Data:{"params":"on"}
"Alexa, Turn heater off"
(https request to particle api, turns a red light off)
URL: https://api.particle.io/v1/devices/PutYourOaksDeviceIDHere/led?access_token=PutYourAccessTokenHere
Form Data:{"params":"off"}
"Alexa, set heater to 76 degrees"
Sends an http request directly to my heater, enabling heat mode and setting the temperature to the DIM value of the bulb ${intensity.percent}
Note that this doesn't actually turn the light on. It is possible to send two separate commands for the same action and turn the LED on at the same time but I'm still brainstorming ideas of monitoring the thermostat's state, especially since there are other ways the settings change (i.e. automatic schedules, iphone app).
URL: http://thermostat-on-my-network/tstat
Form Data:{\"tmode\":1,\"t_heat\":${intensity.percent}}
I haven't gotten to "Alexa, ask Particle what the temperature inside my house is" yet but its on the list. This one looks very straightforward using DHT22.
https://github.com/krvarma/Particle_AlexaI'm getting a lot of mileage out of playing with Particle functionality. I've had weird some issues using "native" ESP8266 network libraries to use the Oak as a network client (odd temporary dropouts using UDP NTP libraries that work fine on my NodeMCU's, haven't noticed the same using them as web servers) but re-thinking how to trigger tasks using a cloud platform that conveniently integrates with several other cloud services has been pretty convenient. Yes everything stops working when the internet goes down but... I've already embraced Alexa so its kind of moot, and turning my heater on with Alexa was a happy accomplishment, even if the only "Oak" portion was turning a light on.