Hi everyone, I relatively new to Node Red as I was looking for an alternative to emulated_hue that stopped working for me and the cost of the newly announced Cloud service being unrealistic. With that said, I found the documentation was a little sparse with Node-Red. So this thread is for any cool tricks and best practices for Node Red specifically when using for Alexa. There is some assumptions though, you should already know the basics how Node-Red works.
The first I found, was the debug is YOUR FRIEND! First, you’ll need to add an Alexa node, and then scan in the Alexa app to add to your devices. Assuming you have that already done.
1. Add a Debug node and change the properties to this:
2. Next, open the debug tab on the right side and ask Alexa something like “Turn on the Fan”. You will notice Alexa sees it’s a Power On command since there’s a property on_off_command: true
3. Now Try saying something like “Alexa, increase the fan”. Notice it’s not an on_off_command but yet the change_direction is now a 1. If you say "Alexa, decrease the fan, it will be a -1.
4. So now we can actually do something with this! For a fan as an example, you can create a switch that determines if it’s a Power command or a Change Direction command and separate the two possibilities. Then From there, you can further break them into Power On/Power Off and a Fan Speed Up/Fan Speed Down command. I have a separate script in HA for each possibility.
5. Now configure the switch which determines whether Alexa thinks it’s a power command like this:
6. Next, configure the other switch which determines whether Alexa sends to a increase or decrease command like this:
7. Finally, connect the nodes up together and you should have something like this!
That’s it really! Pretty simple. Looking forward to any other tricks people have!!