Different scene behavior depending on room / location


I want to run the same scene from multiple Alexa devices. However the scene should have different actions, depending on the device I talk to.

E.g. in living room I have Alexa on my sonos speaker and if I say “good night” I want that TV and light in living room is turned off, but light in bedroom turned on.
But if I say “good night” within the bedroom, I want that the light in bedroom is turned off.

Are there any best practices or tips, how to best implement this?

With regular Alex routines I cannot differentiate by the device I talked to.
As I also have not only echo devices, but also Sonos, therefore I cannot relay on echocontrol binding and the lastvoicecommand channel, as this is not available in the Sonos binding as per my understanding.

Thanks in advance for any ideas :wink:

As you noticed, it will unfortunately be hard to implement Alexa voice command room awareness going forward unless the lastVoiceCommand channel gets fixed. This is the only way to my knowledge to determine the Echo device you are interacting with allowing different actions to run depending on the location.

Below is an example that I would have recommended using that channel.

You should monitor the thread below as there may be some good news on reinstating the lastVoiceCommand channel.

Thanks for your feedback.

I see my issue more related to the fact, that I not only have echo devices, but also sonos devices with Alexa and therefore it’s getting even more complex, as I want to differentiate between echo and sonos devices and the sonos binding sites not provide this kind of information at all

I’d also be interested in a solution here.

My use case is that I’d like to use the same device name in multiple rooms (“Ceiling” for the main light for example, or “Shelf” for a light placed in a shelf). When setting up those devices I have to use distinct names (“Ceiling Bedroom”), which is surprising to me, I’d have thought that Alexa itself would be able to handle the same name in different groups.

So now I thought I might do some openHAB magic, where there is one Scene called “Ceiling” and it takes different action depending on the room.

Also in our case we have a mix of Sonos and Echos.

The example I posted above would have done what you are looking to do with the lastVoiceCommand channel. The below workaround using a packet sniffer might be a way to circumvent the need for that channel to determine which last Echo device received a command.

Even if lastVoiceCommand would work, most of my Alexa devices are Sonos, and as far as I understood lastVoiceCommand is not available for the Sonos devices?

I never tested with such devices but searching the forum, it seems that it worked in the past.

Yes, I forgot that the Sonos devices can be integrated as Echo devices as well.