At first, I wanted to bash on node-red-contrib-alexa-remote2. A promising set of nodes opening Amazon Alexa system didn’t work as expected at all. It even managed to wipe my groups as well… so the anger and disappointment took over and I left the project alone. A couple of weeks later, I noticed the pending updates, and decided to give it another go again! Guess what? This time around Alexa-remote2 sounds promising.
It looks like node-red-contrib-alexa-remote2 has been abandoned, but forked over to node-red-contrib-alexa-cakebaked – the core functionality is the same so please use this one moving forward. All instructions and node names are still relevant.
Alexa-remote2 (and -cakebaked)
It’s not the first time I’m trying things with Alexa. My washing machine uses NotifyMe to let me know when the washing is done and my Raspberry Pi drops me a message when the internet is below advertised speeds (pretty much all the time). But apart from the excellent Alexa integration for smart devices, there was nothing else I could do with it. Alexa-remote2 changes that. And it does it on another level!
This short showcase was done in about 20 minutes. Yes, you are watching an IKEA Symfonisk remote (Zigbee) controlling 2 Amazon Echo gen3 devices. It’s only a fraction of things you can achieve with Alexa-remote2. I will definitely write more about this setup soon, so it’s a great idea to follow my social pages if you are interested.
Impressive skillset without the “skill” part
Most of us are tired of adding new skills to Alexa each time we want to get something done. Alexa-remote2 works over your local network (after authentication) to
I would strongly recommend playing with the individual nodes as each one comes with a set of actions that you can perform and I’m only going over them in a brief.
Getting Started with Alexa-remote2
To start, download node-red-contrib-alexa-remote2
and use the configuration node to set it up on your NodeRED server. Choose a Service Host and Page and Language depending on your location. For example:
Service | Host | Page | Language |
USA | pitangui.amazon.com | amazon.com | en-US |
UK | alexa.amazon.co.uk | amazon.co.uk | en-UK |
GER | layla.amazon.de | amazon.de | en-UK |
Set This IP to the IP of your Node-RED server. You will have to visit this IP followed by the port number specified in the configuration ie: for IP http://192.168.1.10:1880
go to:
http://192.168.1.10:3456
And log in to your Amazon account.
Initialise Node
Before you can play with anything, you have to initialise the Alexa-remote2. To do so, deploy an Initialisation Node – Initialisation, then open the browser at the IP specified in the error message. You will be asked to sign in to your Amazon account to authorise the Alexa-remote2.
If you enabled preserving variables in NodeRED, you can use this flow to save the authenticated payload, load it up on reboot, and refresh the authentication every 2 days.
The Initialisation Node also comes with separate options to control cookies, cashed state, interval and resetting the authentication. If you use the above flow, you shouldn’t really care much for other values unless you know what you are doing.
Device Activity Node
This is an input node that is able to report changes in your Amazon Alexa services. Each category will send a JSON formatted, detailed messages about what just happened on your Amazon Echo. These values can be used to control other flows on your device. Among the activities you will find:
- Error
- Unknown command
- Connect/Disconnect
- Bluetooth State
- Audio & Media changes
- Volume changes
- Notification changes
- Device Activity
- EQ changes
There is no universal channel for all messages, so you have to be very specific what notification group subscribe to. It’s proven useful to update the music track changes, confirming actions set by other nodes as well like Bluetooth operations and notification updates.
SmartHome Node
This node can send commands and query your Alexa enabled devices. While it’s much easier to use the configuration, you can submit the data in msg.payload.
- Get
- Query
- Action
- Discover
- Forget
Get
You can query Alexa services to obtain information about devices and groups registered on your account. The level of information available will depend on the list that you want to receive: devices, groups, entities, & definitions.
Apart from the device information, you will see all actions that are available in your ecosystem. These are populated based on device types registered. Please note, that you will access active and past devices.
Query
Select a device of your choice to receive updates about its state. You can receive a specific state or ask for all properties for each device. Obviously the information will be specific to the device type. You can query more than one device with a single call.
Action
Select a connected device and trigger property change. The available options will depend on what traits the device supports. You can send actions to more than one device at the same time.
Discover
Run Alexa discovery service. Alexa will try to find new devices available on the network.
Forget
If a device is no longer connected, you can remove it from the list of your devices. You could create a self clean-up task where devices that were not seen online for days are removed from Alexa.
Routine Node
Control prompts and notifications, set the volume and launch actions and routines on any Alexa devices or groups in your home.
- Speak/at Volume
- Wait
- Stop
- Prompt/Phrase
- Volume
- Music
- Smarthome
- Launch Skill
- Execute Routine
- Push Notification
- Node
- Custom
Speak/Speak at Volume
The speech comes in 3 flavours: regular, SSML and Announcement. The regular option causes Alexa to speak without any prompt. The announcement plays the chime first, and SSML enables you to use a speech synthesis mark up language. It gives you more control over how things are being pronounced:
<speak>
Here is a number <w role="amazon:VBD">read</w>
as a cardinal number:
<say-as interpret-as="cardinal">12345</say-as>.
Here is a word spelled out:
<say-as interpret-as="spell-out">hello</say-as>.
</speak>
If you use the Speak at Volume, you will be able to set the speech volume just for that phrase, the volume will return to the previous value once Alexa is done speaking.
Wait/Stop
With wait action, you can cause Alexa to suspend whatever she is currently doing for X seconds. Alexa will return to the previous task once the wait time is over. If you want to stop her from completing the task, use stop action instead.
Prompt/Phrases
A list of predefined queries that can provide you with morning news briefs, traffic updates or unique answers from Alexa like jokes and stories. In a similar manner, phrases are predefined but randomised things that Alexa can say in the morning or as a greeting.
Volume
Changing volume can be done in 2 ways. You can set a new value, or you can add/subtract a number from the current value. If you want to lower the volume of Alexa simply type in a negative number (-10) in msg.payload
.
Music
You can start music playback from the list of your music providers. You can pick between your library, iTunes, Spotify and Amazon Music. If you have any 3rd party music services, these can be listed there too.
Provide a song name, artist or name of the playlist to start the playback. Optionally, you can pass the duration in seconds if you want to terminate the playback after some time.
Smarthome
With this action, you can control your smart devices like with SmartHome Node, with one exception: one device at the time.
Launch Skill
You can also launch your favourite skill directly from NodeRED! Select the device, and the skill you want to launch to make things happen.
Execute Routine
Start one of your saved routines. Unfortunately, some of the routines are hard to identify (time-based) due to lack of clear information. This may take some experimenting before you are able to pick the one you need.
Push Notification
Send a phone notification to the device with Alexa installed. You can specify the title and the text of the notification. Sadly, there are no other options available. Wish there was a direct way of sending a notification to specified Echo devices. I guess for that, I will use NotifyMe instead.
Node
You can mix and match the above actions to create a unique string of events. Let’s say you want to start a routine, play some music and control a smart device at once – Node option lets you chain these together.
Custom
With the Custom option, you can feed in a routine node as JS object for completely dynamic routines.
Echo Node
An array of mostly audio related controls including music playback, Bluetooth and Alexa devices.
- Get
- Music command
- Bluetooth
- Rename/Delete
- TuneIn
- Do not disturb/Alarm
Get
You can query media information, playback or volume preferences including DND and alarm. There is an option to check pending notifications too. If you are looking for a status update, chances are this is the action you want to use.
Music commands
These options can get really messy, especially if you run multiple Alexa devices in a group or a single room. Alexa likes to default the playback to a group or a specific device. If you attempt the control (play/pause, skip/back) without correct device specified, your action will fail.
In my experience, the actions are most reliable with groups.
Bluetooth
It’s possible to pair/connect and disconnect from paired speakers. With some clever planning, you could stream Alexa on your favourite Bluetooth speaker.
Rename/Delete
From time to time, there might be a need to re-assign a name or delete the Amazon Echo device altogether. These options do just that.
TuneIn
Use TuneIn service and query the stations to start the playback
DND and Alarm Volume
Additional controls for Do NotDisturb and Alarm Volumes so you get the sound settings just right.
Get Other Node
Yet another set of actions to get additional information about accounts, contacts, notifications, skills and more. If you want to create a notification or a timer, you will find the actions to configure it.
List Node
With Alexa-remote2 you can create, edit and delete lists. You can do this to default lists like: “to-do” and “shopping” and you can create your own lists. These will be available across all Alexa devices.
The node provides you with a complete toolset to get the lists, elements and options to add, edit and remove items from the list.
Conclusion
Alexa-remote2 us updated on a regular basis. So if you find something that isn’t working just yet, chances are that it will be fixed soon. I’m glad I can make Alexa speak at will. Thanks to this node I can get Alexa to speak at will and trigger exciting automation without relying on 3rd party servers. What would you like to do with Alexa-remote2? Let me know in this Reddit thread.