This has been discussed in multiple thread but I thought I'd start one where all of the ideas on how to do multiple Alexa devices and tell them apart.
Many have said there is no way to tell because Alexa devices don't supply that information. Well, that is totally false. Alexa does supply a unique identifier for every Alexa device. I've spend the last few days checking this out and running tests with other Alexa developers. In fact, I've even taken my copy of the HomeSeer Skill and pointed it to a site so I could see exactly what Alexa was sending to the HomeSeer endpoint.
What follows is the JSON data that's sent to HomeSeer when any command for HomeSeer is issued to Alexa.
If you check the "context" section you'll find the following:
In that piece of JSON text is the deviceId. The deviceId you see "amzn1.ask.device.AFUW...TZOA" has been edited as the real deviceId is much longer. This deviceId will remain the same until the echo is disabled on your account. If it is reenabled a new deviceId will be assigned.
So HomeSeer does have access to the deviceId and thus can identify which Echo sent the command. The next issue is how to use this information.
We can't use it as is since it's just way too long and not human friendly. What we need is to convert the deviceId into an echo name. One of the developers gave me an idea on that and I modified it a bit.
Basically you need to issue a command on every echo so that HS will name that echo with something more useable. The simple way is to issue a voice command like "Alexa, ask HomeSeer to name me "Echo One". When HS received this command it would map the Alexa sending the request deviceId to "Echo One". You just need to use this command on every Alexa device you are using.
Now we have something we can live with.
So this is some food to work with. Now we can think about how this would be used. I have some ideas but I'll let others post ideas first.
OMT, I don't know if deviceId is sent from the smart home api but I'm trying to find out. What I do suspect however is that it will have a different deviceId than the HomeSeer Skill so both would have to be mapped.
Many have said there is no way to tell because Alexa devices don't supply that information. Well, that is totally false. Alexa does supply a unique identifier for every Alexa device. I've spend the last few days checking this out and running tests with other Alexa developers. In fact, I've even taken my copy of the HomeSeer Skill and pointed it to a site so I could see exactly what Alexa was sending to the HomeSeer endpoint.
What follows is the JSON data that's sent to HomeSeer when any command for HomeSeer is issued to Alexa.
Code:
{ "version":"1.0", "session":{ "new":true, "sessionId":"amzn1.echo-api.session.087ce255-8deb-4501-9049-7cc0d64b2167", "application":{"applicationId":"amzn1.ask.skill.52286855-6161-4a62-85f0-96d3336131bf"}, "user":{ "userId":"amzn1.ask.account.AENF...EX7A", "accessToken":"2713...0448" } }, "context":{ "AudioPlayer":{"playerActivity":"FINISHED"}, "System":{ "application":{ "applicationId":"amzn1.ask.skill.52286855-6161-4a62-85f0-96d3336131bf" }, "user":{ "userId":"amzn1.ask.account.AENF...EX7A", "accessToken":"2713...0448" }, "device":{ "deviceId":"amzn1.ask.device.AFUW...TZOA", "supportedInterfaces":{ "AudioPlayer":{} } }, "apiEndpoint":"https://api.amazonalexa.com" } }, "request":{ "type":"IntentRequest", "requestId":"amzn1.echo-api.request.b3155f56-cb1e-47b3-adc2-0f79b2906dc5", "timestamp":"2017-07-13T19:24:46Z", "locale":"en-US", "intent":{ "name":"ParseText", "confirmationStatus":"NONE", "slots":{ "TextToParse":{ "name":"TextToParse", "value":"turn on the dining room light", "resolutions":{ "resolutionsPerAuthority":[{ "authority":"amzn1.er-authority.echo-sdk.amzn1.ask.skill.52286855-6161-4a62-85f0-96d3336131bf.HOMESEER_PHRASE", "status":{ "code":"ER_SUCCESS_NO_MATCH" } }] }, "confirmationStatus":"NONE" } } } } }
Code:
"device":{ "deviceId":"amzn1.ask.device.AFUW...TZOA", "supportedInterfaces":{ "AudioPlayer":{} } },
So HomeSeer does have access to the deviceId and thus can identify which Echo sent the command. The next issue is how to use this information.
We can't use it as is since it's just way too long and not human friendly. What we need is to convert the deviceId into an echo name. One of the developers gave me an idea on that and I modified it a bit.
Basically you need to issue a command on every echo so that HS will name that echo with something more useable. The simple way is to issue a voice command like "Alexa, ask HomeSeer to name me "Echo One". When HS received this command it would map the Alexa sending the request deviceId to "Echo One". You just need to use this command on every Alexa device you are using.
Now we have something we can live with.
So this is some food to work with. Now we can think about how this would be used. I have some ideas but I'll let others post ideas first.
OMT, I don't know if deviceId is sent from the smart home api but I'm trying to find out. What I do suspect however is that it will have a different deviceId than the HomeSeer Skill so both would have to be mapped.
Comment