The information from this post has become outdated. For a newer operative version go to:
A far simpler way is to use the Alexa app to tell your echo devices which devices are in the same room as them.
For sure, in fact I have it that way and Iâm gonna leave it that way⌠But for some people that need more complex actions when they say âTurn onâ or whatever, this is a great solution
for example, when I say turn on the light, if itâs dark, turn it on white and at 100%, however, if Iâm watching a movie, turn it on blue and at 20%⌠you just canât do that with the Alexa app, unless you donât mind recalling various different sentences, one for each state
But thatâs not relevant to the room.
âAlexa, turn on the lightâ > Alexa knows which light to turn on because itâs grouped in the Alexa app > Homeassistant/node red receives the command to turn on the light > applies the correct parameters based on whether or not youâre watching a movie.
At no point in that flow did homeassistant need to know which Alexa device was used, and in fact it would be counterintuitive as I could just as easily used a different echo device in the house to turn on the same light - âAlexa, turn on the living room lightâ to the bedroom echo device.
you might be right
There was a mistake in the previous flow, everything has been updated in the first post
Do alexa groups work the same way when you say, for example, âAlexa, turn off the fanâ? or âTurn off the TVâ⌠Cause I donât think soâŚ
Of course. You tell Alexa whatâs in the same room as the device, and then when you say turn on X it turns on that roomâs X. Or you can say turn on bedroom X and it will turn that one on instead.
you canât have two smart switches with the same name âFanâ, can you? It would work for that.
Another advantage is that when you turn off a light, lifx for example, home assistant can take up to 15 seconds to realize itâs been turned off. If you have any automation that triggers when that light changes its state, this is a great thing to have.
Or for example letâs say you have 3 mirror spread over your house in 3 different locations, and you want to be able to say âturn on the mirrorâ⌠it would be useful in that scenario too.
another advantage is probably with DIY projects?
but hey, no problem my man, if you donât find it useful, just ignore it. I might just be a silly guy who likes to overwork
I would appreciate if you could send me a flow or some code to completely understand what you mean when you say you can do the exact same thing using only the Alexa app, cause I donât see that
Iâm using node-red-contrib-amazon-echo (node) - Node-RED, controlling all devices I need and everything local.
Alexa controlled Node-Red nodes supporting latest Amazon Echo devices
NO Alexa Skills required.
NO cloud dependencies.
What I donât like about that one is that when you say âTurn on X light at Y%â, if the light was turned off previously, or something of the like, itâll send two consecutive messages, one with the previous brightness % and another with the new brightness%. I have 95% of my devices using node-red-contrib-amazon-echo (node) - Node-RED for plain on/off commands
if you work with light transitions, they get crippled⌠flows are triggered twice and I ended up using a throttle to avoid that
but yeah, itâs great for on/off commands, one less dependency
No need to get defensive about it.
I canât send you the internal workings of the Alexa app, because itâs proprietary, but I can assure you that you can add devices to groups in the app to group them with a particular echo device. Itâs not that complicated a concept and it works really well.
The mirror example you gave:
Put the bedroom mirror in a group with the bedroom echo, kitchen mirror with kitchen echo, living room mirror with living room echo.
âAlexa, turn on the mirrorâ will turn on the mirror in the room that the echo device is in.
I didnât know that could be done. I believe you canât put several devices with the exact same name, you canât put 3 devices with the name âmirrorâ. What you are saying is that if you set 3 different devices to âmirror Aâ, âmirror Bâ and âmirror Câ in different groups,by saying âturn on the mirrorâ, Alexa will turn the mirror of the group containing both the echo device and the mirror X. I didnât know that. Are you 100% positive about it? I believed that if you put Mirror A, B and C and said âturn on the mirrorâ, Alexa would complain: âYou have several devices called mirror, which one do you want to turn on?â. At least thatâs my experience.
By code I meant, how do you get your device to turn on according to some HA conditions?
It works fine. I use it for multiple lights in rooms, heaters, all sorts.
It seems to work on a sort of hierarchy, so if you have a mirror in the room and you say âturn on mirrorâ it will turn that one on. If you donât, but have 3 in other rooms of the house it will ask you which one.
As for the homeassistant conditions, you just trigger on the device changing state and then perform the action, same as any other automation.
how do you get your device to turn on according to some HA conditions?
Lights to come on white, unless watching movie (at which point make them blue)
âAlexa, turn the light onâ
trigger:
platform: state
entity_id: light.led
to: 'on'
action:
service: light.turn_on
data:
entity_id: light.led
color_name: "{{ 'blue' if is_state('binary_sensor.movie', 'on') else 'white' }}"
Yep, I have a few automations like that one⌠thatâs probably one of the few things where this flow is an advantage over using the Alexa app⌠At least with lifx, there can be a great delay. It can take up to 15 seconds before HA notices the light has changed its state so⌠it gets ugly you know
anyways with update_entity polling every second I managed to solve thatâŚ
Iâll leave the flow here just in case somebody finds it useful. I actually made it at request of a friend who needed it, but yeah, the Alexa app is powerful enough to avoid the hassle
Did you send the flow, I like what you are saying.
all you need to know is in the first post
Even with that automation, the flow can do things alexa canât⌠if you want your light to turn on with a fade, for example, you canât rely on that kind of automation to achieve thatâŚ
I would use that just if there was no other way or if I were ok with how Alexa performed the action