I wanted to share my solution, inspired by this old thread: Approaches to room aware voice commands for Alexa with Node-Red
Since I cannot have more that one image per post, I will put them all together
Every device has a unique name (1), which includes the room name: ie Bedroom Left Night Lamp. This is mainly for the GUIs.
Every device connects with the Echo Hub node at the beginning (2) at at the end (3) of the flow
So far, all this is standard. Now for the shared device names
Shared names by rooms (4), I call them Aliases: ie: Left Lamp. And are also defined as devices, one per each shared name. In the Alexa App, I have one room called Aliases, to hide them all. By the fact of being devices themselves, Alexa give no errors when they are called. They also connect to the Echo hub as standard devices.
This is pretty straight forward. By knowing (saved in global, 5, 6, 7) in which room the (last) call was made (1 or more echo devices per room), I can route (8, 9, 10) the Alias (ie: Left Lamp) to the right room.
If I would have hundreds of devices, I would create probably some function to avoid repetitions, but with a handful of aliases, I avoided the complexity by copy and pasting. Feel free to improve it. I use the device name (11) for the Alexa app (though you can rename it there too) and the topic name for filtering once within the room (12, 13, 14)
If a new (or old) device needs an alias (15, first pic). I simply add it in parallel to the main name, withing the same flow, with the right filter (every time an alias is called from within a room, all node devices in that room get the msg, and needs to be filtered)
Example:
Copy (16, 17) and paste (18) the Alias connector
and adjust the filter (19)
Do you need a new Alias (fan, thermostat)? Just add it to the common flow (20, look up), and discovery it with the Alexa app or with “Alexa, discover devices”, and hide it into the Aliases room. Nothing else is needed.
Pretty happy with the result
Ref Nodes:
node-red-contrib-amazon-echo (Local Alexa, aka Hue Router Emulator)
node-red-contrib-alexa-remote2-applestrudel (For the Alexa activity)
node-red-contrib-home-assistant-websocket (Home Assistant Nodes: State, Call Service)
P.S. This should be standard Alexa functionality, but it is not. Maybe one day, they will implement it. The closest Alexa has to this is the single Alias “Lights”, which will turn on/off ALL lights (and just the lights) in a specific room. Pretty limited.