I’m guessing the only other way around this would be to create multiple skills or multiple amazon accounts on each device?
what would be the use?
if i give the command:
“alexa, turn something on”
to any of my alexa’s she always turns on that particular device.
you cant connect devices or skills to 1 alexa deviice (yet)
the device from alexa is untill yet only used to play music on several devices together, or to start music from 1 device on the other. but you cant do that from out of HA,
The use would be the ability to overload individual device names depending on location. So if I say “turn on the lights” and I’m in the kitchen, I could catch the deviceID that says the command was picked up by the kitchen echo and then turn on the kitchen lights. If I’m in the bedroom and say “turn on the lights”, I could catch the deviceID telling Hass that the command was picked up by the bedroom echo and then turn on the bedroom lights.
Correct, this is what I’m trying to do. Looks like it’s not possible to specify the DeviceID in the intent script though. Was hoping there would be a work around.
I have an Echo in 3 rooms, each with a TV and Lights and would like to be able to give a single “turn on tv” command instead of “turn on bedroom tv”.
I understand that can’t be done for emulated hue but it could with a custom skill or a Haaska skill.
it cant be done with hue and with a skill you would get:
alexa, ask homeassistant to turn on the tv
instead of
alexa, turn on the bedroom tv.
amazon hast made it possible yet to send commands other then music commands to a specifik device.
@luma, i understand the use you like, but that use isnt there in alexa.(yet)
you cant use “turn on …” to control intents in HA directly.
Hi,
I got this working! You will need to do a little mod in alexa component. Locate alexa/intent.py and add the following lines to the async_handle_intent function right after the line “alexa_response = AlexaResponse(hass, alexa_intent_info)”:
deviceid = message.get('context', {}) \
.get('System', {}) \
.get('device', {}) \
.get('deviceId')
alexa_response.variables['deviceid'] = deviceid
This will add the deviceid as a “slot” so you can use it on templates. To test i did a “launch request” skill (see alexa component docs) and added this to my intents:
amzn1.ask.skill.xxxxxxxxxxx:
action:
- service: notify.someone
data_template:
message: "I was called by {{ deviceid }}"
- service: homeassistant.toggle
data_template:
entity_id: >
{% if deviceid == "amzn1.ask.device.<longstring-device1>" %}
light.w1
{% elif deviceid == "amzn1.ask.device.<longstring-device2>" %}
group.luzes_sala
{% elif deviceid == "amzn1.ask.device.<longstring-device3>" %}
group.luzes_escritorio
{% endif %}
speech:
text: OK
I used the notification part as way to test/retrieve the deviceid.
One problem with the launch request skills is that amazon don’t let you use any word as some of them are used by other skills/purposes, so you cannot just say “alexa, lights”. Just for the fun, and lack of imagination of a better word/phrase, I’m using “alexa, banana” and them HA toggle the lights of the room where my dots/echos is located.
Nice.
i got it working for my Alexa Appdaemon App also.
but thats a custom skill so i need: alexa, ask appdaemon to turn on the lights.
its probably possible to add it to emulated hue as well.
Hi,
emulated hue would be nice but I guess it would require a lot of other changes to the component/protocol. Maybe not :-).
i think it must be possible to let emulated hue update a sensor that has the speaking device as state.
i might look into that at some point.
Hi,
I’m not sure. There seens to exist a strange behaviour when you have multiple echos in which one of them seems to be the “master”, so even if you ask to another echo, the master is the one who talks to the hue bridge.
cant be. (or at least i dont see how)
i have 6 echo’s who all can use hue commands.
which would be the master?
and when i shut that one down, will all others not respond anymore?
no it doesnt matter which one i shut down, there is always response.
i also never connected devices to a single echo, so how is then decides which is the master?
and how does 1 echo send commands to another echo? untill now it is impossible to send a command from 1 device to another, if i am correct.
Well, the first time I notice this behaviour was when I was configuring a echo + HA at my work. This echo was connected to same account as my home echos and I was configuring emulated_hue at my work’s HA so we could control the coffe machine. No matter how many times I asked this echo to “find my devices” it didnt find my emulated_hue. Digging a little further and doing some tcpdumps, I found that my other echo at home was sending packets to broadcast address port 1900 and to my home HA at port 8300.
Btw, while re-testing this now I just saw my echo home trying to send a packet to my work’s echo. Go figure…
running multiple echos in multiple networks.
yeah i can see where that goes wrong.
i just took a look at the emulated hue, and its hard to pinpoint the incoming data from alexa there.
i can try some stuff, but with HA that means restarting HA every time and i dont want to do that now.
but when i look at the Alexa documentation, the device id that is getting the command is always send in the response nowadays.
ill take a look at it when i have created a testing environment.
Awesome work, been waiting so long to get this working. Will really help with my TV automations!
Since that one was kind easy, I’m also thinking about userid! I dont know if I got it right, but alexa send a userid on the json and it seems that this is based on the voice signature of the user? I thought that the userid is linked to the user account on amazon, but this link sugest that it’s not:
https://hackernoon.com/identifying-users-in-alexa-skills-ff189d03ed1d
Or I got it wrong?
no its not based on the voice. (that would be very nice)
you can read about that here in the docs:
https://developer.amazon.com/docs/custom-skills/link-an-alexa-user-with-a-user-in-your-system.html
i just did a better search and it seems they have implemented voice recognition at the end of last year.
that makes me very happy so ill dive into that.!!
and i did, and its still not alive in germany
yes, I was eager to get home and try that. You have to create the so called voice profiles.
yeah i found that they announced it was coming in the end of last year, but its still not in the app here.
and i cant find any news thats its actually released in germany, so i think ill have to wait.
Hi,
did you tried “alexa, learn my voice”? (or the equivalent in german?)