This is an example with lights. This way you will just have to say ‘Turn the light on’ (or whichever sentence Alexa understands to turn a light on) and the appropriate light will turn on depending on the area you are in. That applies to any device: fans, tvs, curtains, ‘the mirror’ and so on… just one word for them all and no need to create a dozen routines to cover all kinds of requests.
you will need: node-red-contrib-alexa-remote2
First section, ‘Setting currently listening device’:
https://paste.ubuntu.com/p/CJKb6pNWpX/
You need to create an input_boolean
First node listens to Alexa’s events, acknowledges which device you’re talking to and sets a flow.echodevice containing the name of the listening device (the name of your device is stored as it shows up in your Alexa up, case sensitive). You needn’t change anything in the nodes without a label, leave them as they are. In fact you only need to add your account details in the first node and set an input boolean of your choice in the two blue “Input X” nodes. Don’t worry about having several devices listening nearby, the flow picks up the right device.
Alexa Event node config:
In fact, if you already have some way of creating devices in Alexa, this is all you need, you can skip the section below. Use ‘flow.echodevice’ as a condition to group your devices and actions by rooms. If you go this route, don’t forget to add the two input nodes (a ‘wait until input is on’ with timeout, and an ‘input turn off’) from the second section right after every device node, it acts as a switch to ensure the flow is picking up the right room and triggering when it should.
However the Alexa Home node recommended here is really flexible and, even though it relies on the cloud, it’s powerfull enough to emulate the majority of devices and their use cases.
Second section, ‘Turn light on according to which device listened’:
https://paste.ubuntu.com/p/QmwJhYDFD8/
You will need: node-red-contrib-alexa-home-skill
Again, fill the two blue “Input X” nodes with your input_boolean.
You have to create an account and an alexa device called ‘Light’ or ‘The light’ or both (it’s alwats better to create both to increase compatibility) in: https://alexa-node-red.bm.hardill.me.uk/docs
after creating the device ‘Light’, go to your Alexa app and install the Node Red Skill, which will allow Alexa to discover the device ‘Light’
Once discovered, you must read the documentation to understand how to make requests. It allows turning on/off, changing color and white temperature, increasing and setting brightness percentages.
Alexa home node config:
In the node ‘Echo Device’, you must set the name of your devices as they show in your Alexa app, case sensitive.
for the Action Node, read the documentation
---------------------------------------------------------- UPDATE ------------------------------------------------------------------
EXAMPLE WITH FANS.
---------------------------------------------------------- UPDATE ------------------------------------------------------------------
EXAMPLE WITH THERMOSTAT.