Closed gvdhoven closed 5 years ago
I spent 5 hours debugging the tutorial (that was supposed to take 15 mins :| ) to figure why the devices weren't being discovered.
This was my problem and I changed the settings to match as per the table and it worked. Thank you!!! I agree this needs to be documented explicitly.
I had to create a new lambda instance to make it work with the US (English) skills. The one I created for US West didn't work. Why is there interdependency between skill language and Lambda Function region? Also, it seems a little strange that for US west we need to select Australia English as the skill language.
The AWS Lambda configuration for Alexa Skills is setup to optimize for network latency similar to AWS expansions into new regions. For example, English (UK) skills map to an ARN for Ireland as opposed to US East (N. Virginia).
But shouldn't I be able to just change the configuration to map to a new region? I had to create a new lambda instance and repeat the configuration steps to make it work.
Also Optimizing for network latency sure makes sense. But the naming conventions are misleading. :)
I also had the issue that the devices are not being discovered in my alexa app.
The missing bits from the guide is the following as I guess Amazon changed the website:
This must be populated even though it is stated as Optional. For Europe, copy the arn both in the default field as well as the one labeled Europe.
Second issue I had was that when copying the json file, it converts it into an HTML file which does not work, so I copied the content straight in the lambda file itself which made sure that the error handling worked.
Still not discovering devices, even after adding the endpoint. https://forums.developer.amazon.com/questions/103567/alexa-smart-home-skill-problem-with-discovering-de.html
I'm having some troubles discovering devices, too.
Ideas?
+1. I have the same issue as @Sandmania. My skill is in devIN and lambda function in Ireland. Below is the discovery output when I trigger lambda function through AWS console.
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"payloadVersion": "3",
"messageId": "232e94f1-682e-47df-a799-35fca8473f7c"
},
"payload": {
"endpoints": [
{
"endpointId": "endpoint-001",
"manufacturerName": "Sample Manufacturer",
"friendlyName": "Switch",
"description": "001 Switch that can only be turned on/off",
"displayCategories": [
"SWITCH"
],
"cookie": {
"detail1": "For simplicity, this is the only appliance",
"detail2": "that has some values in the additionalApplianceDetails"
},
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.PowerController",
"version": "3",
"properties": {
"supported": [
{
"name": "powerState"
}
],
"proactivelyReported": true,
"retrievable": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.EndpointHealth",
"version": "3",
"properties": {
"supported": [
{
"name": "connectivity"
}
],
"proactivelyReported": true,
"retrievable": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
}
]
}
]
}
}
}
I don't see any logs for Lambda in cloud watch when I try to discover devices through Alexa. I do see logs for authorization during account linking.
My skill won't discover devices anymore. I have a published skill that got removed from my account now not listed in available skills. I suspect it's since the new 'support' for Australia and New Zealand, as my location is New Zealand. So I figured I'd try and add new languages and region specific stuff to the skill in hopes of getting it to work again, but no good. My development skill won't discover anything and there are no cloudwatch logs in any of the regions hosting the lambda function.
I found that when I didn't have any devices registered to my account physically turned on and connected that Alexa wouldn't even bother with discovery. Opening the debug tools in Chrome showed that the request was getting a 400 with something like "Amazon bridge is not connected".
In my case the discover fails because of some change they have recently made. I was previously able to use the token given in the request and pass it AWS Cognito which returned a consistent id matched with the linked account identity. Now however every token the skill receives returns a new cognito identity so it's totally broken. I opened an issue for this here #50
Backing up the suspicions of my previous comment, if I use Alexa Skills Kit Simulator, my originally linked skill is able to work, but since it disappeared presumably because of a region restriction, the same skill readded and linked in this region fails. Maybe the hidden skill is causing my problems. I can't access it to unlink or forget devices.
In my case I see below error in Firefox console and message on screen is "There was an error discovering your devices".
TypeError: this.pages[a] is undefined [Learn More] 2d54f-deps.min.js:375:458
goToPage https://alexa.amazon.in/lib/2d54f-deps.min.js:375:458
_moveToPage https://alexa.amazon.in/js/a6ca9-app.min.js:2750:302
_changePage https://alexa.amazon.in/js/a6ca9-app.min.js:2750:7
_setAutoScroll/this.autoScrollingInterval<h ttps://alexa.amazon.in/js/a6ca9-app.min.js:2748:88
+1 This should be explicit in the readme
I too have the same issue as @Sandmania. My skill is in devUS and lambda function in US. Below is the discovery output when I trigger lambda function through AWS console though alexa discovers no new devices.
Response: { "header": { "namespace": "Alexa.ConnectedHome.Discovery", "name": "DiscoverAppliancesResponse", "payloadVersion": "2", "messageId": "c7f6986e-99d6-4b38-80ac-bdf93146cf18" }, "payload": { "discoveredAppliances": [ { "applianceId": "endpoint-001", "manufacturerName": "Sample Manufacturer", "modelName": "Smart Switch", "version": "1", "friendlyName": "Switch", "friendlyDescription": "001 Switch that can only be turned on/off", "isReachable": true, "actions": [ "turnOn", "turnOff" ], "additionalApplianceDetails": { "detail1": "For simplicity, this is the only appliance", "detail2": "that has some values in the additionalApplianceDetails" } }, { "applianceId": "endpoint-002", "manufacturerName": "Sample Manufacturer", "modelName": "Smart Light", "version": "1", "friendlyName": "Light", "friendlyDescription": "002 Light that is dimmable and can change color and color temperature", "isReachable": true, "actions": [ "turnOn", "turnOff", "setPercentage", "incrementPercentage", "decrementPercentage", "setColor", "setColorTemperature", "incrementColorTemperature", "decrementColorTemperature" ], "additionalApplianceDetails": {} }, { "applianceId": "endpoint-003", "manufacturerName": "Sample Manufacturer", "modelName": "Smart White Light", "version": "1", "friendlyName": "White Light", "friendlyDescription": "003 Light that is dimmable and can change color temperature only", "isReachable": true, "actions": [ "turnOn", "turnOff", "setPercentage", "incrementPercentage", "decrementPercentage", "setColorTemperature", "incrementColorTemperature", "decrementColorTemperature" ], "additionalApplianceDetails": {} }, { "applianceId": "endpoint-004", "manufacturerName": "Sample Manufacturer", "modelName": "Smart Thermostat", "version": "1", "friendlyName": "Thermostat", "friendlyDescription": "004 Thermostat that can change and query temperatures", "isReachable": true, "actions": [ "setTargetTemperature", "incrementTargetTemperature", "decrementTargetTemperature", "getTargetTemperature", "getTemperatureReading" ], "additionalApplianceDetails": {} }, { "applianceId": "endpoint-004-1", "manufacturerName": "Sample Manufacturer", "modelName": "Smart Thermostat Dual", "version": "1", "friendlyName": "Living Room Thermostat", "friendlyDescription": "004-1 Thermostat that can change and query temperatures, supports dual setpoints", "isReachable": true, "actions": [ "setTargetTemperature", "incrementTargetTemperature", "decrementTargetTemperature", "getTargetTemperature", "getTemperatureReading" ], "additionalApplianceDetails": {} }, { "applianceId": "endpoint-005", "manufacturerName": "Sample Manufacturer", "modelName": "Smart Lock", "version": "1", "friendlyName": "Lock", "friendlyDescription": "005 Lock that can be locked and can query lock state", "isReachable": true, "actions": [ "setLockState", "getLockState" ], "additionalApplianceDetails": {} }, { "applianceId": "endpoint-006", "manufacturerName": "Sample Manufacturer", "modelName": "Smart Scene", "version": "1", "friendlyName": "Good Night Scene", "friendlyDescription": "006 Scene that can only be turned on", "isReachable": true, "actions": [ "turnOn" ], "additionalApplianceDetails": {} }, { "applianceId": "endpoint-007", "manufacturerName": "Sample Manufacturer", "modelName": "Smart Activity", "version": "1", "friendlyName": "Watch TV", "friendlyDescription": "007 Activity that runs sequentially that can be turned on and off", "isReachable": true, "actions": [ "turnOn", "turnOff" ], "additionalApplianceDetails": {} }, { "applianceId": "endpoint-008", "manufacturerName": "Sample Manufacturer", "modelName": "Smart Camera", "version": "1", "friendlyName": "Baby Camera", "friendlyDescription": "008 Camera that streams from an RSTP source", "isReachable": true, "actions": [ "retrieveCameraStreamUri" ], "additionalApplianceDetails": {} } ] } }
Request ID: "c5ed63d2-1ca9-11e8-b39a-e7dacaebda0f"
Function Logs: ture only", "friendlyName": "White Light", "isReachable": true, "manufacturerName": "Sample Manufacturer", "modelName": "Smart White Light", "version": "1" }, { "actions": [ "setTargetTemperature", "incrementTargetTemperature", "decrementTargetTemperature", "getTargetTemperature", "getTemperatureReading" ], "additionalApplianceDetails": {}, "applianceId": "endpoint-004", "friendlyDescription": "004 Thermostat that can change and query temperatures", "friendlyName": "Thermostat", "isReachable": true, "manufacturerName": "Sample Manufacturer", "modelName": "Smart Thermostat", "version": "1" }, { "actions": [ "setTargetTemperature", "incrementTargetTemperature", "decrementTargetTemperature", "getTargetTemperature", "getTemperatureReading" ], "additionalApplianceDetails": {}, "applianceId": "endpoint-004-1", "friendlyDescription": "004-1 Thermostat that can change and query temperatures, supports dual setpoints", "friendlyName": "Living Room Thermostat", "isReachable": true, "manufacturerName": "Sample Manufacturer", "modelName": "Smart Thermostat Dual", "version": "1" }, { "actions": [ "setLockState", "getLockState" ], "additionalApplianceDetails": {}, "applianceId": "endpoint-005", "friendlyDescription": "005 Lock that can be locked and can query lock state", "friendlyName": "Lock", "isReachable": true, "manufacturerName": "Sample Manufacturer", "modelName": "Smart Lock", "version": "1" }, { "actions": [ "turnOn" ], "additionalApplianceDetails": {}, "applianceId": "endpoint-006", "friendlyDescription": "006 Scene that can only be turned on", "friendlyName": "Good Night Scene", "isReachable": true, "manufacturerName": "Sample Manufacturer", "modelName": "Smart Scene", "version": "1" }, { "actions": [ "turnOn", "turnOff" ], "additionalApplianceDetails": {}, "applianceId": "endpoint-007", "friendlyDescription": "007 Activity that runs sequentially that can be turned on and off", "friendlyName": "Watch TV", "isReachable": true, "manufacturerName": "Sample Manufacturer", "modelName": "Smart Activity", "version": "1" }, { "actions": [ "retrieveCameraStreamUri" ], "additionalApplianceDetails": {}, "applianceId": "endpoint-008", "friendlyDescription": "008 Camera that streams from an RSTP source", "friendlyName": "Baby Camera", "isReachable": true, "manufacturerName": "Sample Manufacturer", "modelName": "Smart Camera", "version": "1" } ] } } END RequestId: c5ed63d2-1ca9-11e8-b39a-e7dacaebda0f REPORT RequestId: c5ed63d2-1ca9-11e8-b39a-e7dacaebda0f Duration: 2.40 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 26 MB
Same Issue went over everything 20 times and cant find any issue with following the instruction. when discovering device it only finds the Sonos One i have connected. But there is no log appearing in cloud watch.
I have devUk as i am located in Europe. All the endpoint and language settings/ Ireland are correct.
Anybody found a solution for this?
I ended up creating lambda endpoints to every region and checked from the logs which one alexa calls. For reasons unknown to me, it calls the US endpoint so now I'm just using that...
Hi sandmania,
Which US point ? i created one with US east North Virgina and still no luck. I cant see anything happening in the Lambda Cloud watch logs
Hi all,
ok i figured it out in instructions it says
What confused me it says "files" so i took it too far as i moved all the files into one root folder and then zipped it with no subfolders. But basically you have to leave /sample_lambda/python folder as is and just add the file "alexa_smart_home_message_schema.json" to it. then zip the whole /python folder.
Also the location in the end "US east North Virgina" worked for me. Europe Irleand did not.
@PauloA78 Yeah, North Virginia (us-east-1), as you just discovered.
@PauloA78 @Sandmania Great that you got it working. I tried your solution. I still get the error as "There was an error discovering your devices" when I click discover devices. I created the Lambda function in US-East (N. Virginia) and EU (Ireland). I dont see any update in Cloudwatch logs for US-East or EU Ireland.
My Alexa skill points to US-East endpoint as default. (I have also tried setting EU Ireland as default). But no luck. My python zip file is how @PauloA78 describes it.
Any pointers will be great help.
@vishalkothari I am trying to attach a screenshot
Thats practically how it looks with North Virginia (us-east-1)... the blackout fields will show your project name and ID of course
Also it is important that all the accounts you did with AWS etc. have the same email address like you use for your standard Amazon account.
I had a different email in the beginning and it screwed things up... So all account emails for the development should match with your Amazon shopping account.
Thank you so much for your reply @PauloA78. I see the logs on the lambda function when I perform account linking. But I dont see any logs when I try discovery.
Below is my alexa skill screenshot and lambda function code.
Screenshot:
Lambda function: lambda.py.txt
Do you see any mistakes in this? I tried with lambda function in US-East (N. Virginia) too. But the account linking step fails so I cant even reach discovery stage.
I am having the same problem but my issue seems to be related to the lambda code. here is the log:
@PauloA78 if you have a javascript based lambda, do you still need that json file?
So apparently, there was nothing wrong with my lambda (or probably anyone else's lambdas here), it's just that the endpoint that the Discover button calls on this page is broken at the time of this writing.
POST https://alexa.amazon.com/api/phoenix/discovery
400 Bad Request
{"message":"No Amazon bridge online for customerId=<REDACTED>"}
I only found this out when I started to test it using the new Alexa Test page at https://developer.amazon.com/alexa/console/ask/test/<SKILL_ID>/development/en_US/
where you can actually do voice (or text) commands.
I queried Alexa saying "what devices do i have"
, and my lambda was called! And once I went back to the https://alexa.amazon.com/spa/index.html#appliances
page, the device was indeed there.
So that json
file is not needed at all.
@rclai You are absolutely right. I tried with Alexa test page and discovery works fine. Thanks for posting.
That wasn't amusing 8 h or so trying to figure out why the heck lambda is not getting called - despite documentation and despite what you write into the default endpoint box (My skill is in English(UK)) and initially lambda was in Ireland as per doc, ONLY the N. Virginia is used. EVER. Smells like a bug that once fixed will start breaking things... So, how do I configure it so its somewhat future proof at least? set only N Virigina endpoint and that's it?
Interestingly the device discovery endpoint that the Discover button calls on this page is no longer broken now.
Well, it's not invoking US any more anyway...
I had this issue with an US English Smart Home Skill with a Lambda endpoint in Ireland. It worked fine, then suddenly stopped calling the Lambda function.
After changing the default endpoint to a US East endpoint, then changing it back to Ireland, it started working again. Not a satisfying result at all...
My Lambda endpoint only seems to work on US-East-1. I burnt several hours working through this trying to understand why my endpoint on the recommended US-West-2 (for AU skills) wasn't triggered. This doesn't make sense to me.
I've too had issues in AU today, I setup a new endpoint on US West (Oregon) and then used this in the Far East endpoint setting for my skill (as from some research AU is under the Far East region) and then alexa found my devices.
I'm having same issue with my node.js lambda. Test in lambda working fine and returning proper discovery json. But discovery from alexa does not work. It even does not show anything in cloudLog.
is there any updated documentation about json schema and regions endpoint settings.?
I found that by using the region specified on the 'Build' page of your skill, and setting an endpoint for not just the default region, but all others as well.
Yes i also followed same and mine also start working. currently i'm just testing with EU-India. eu-west-1 that is EU-Ireland region is working fine for IN I'll test North America and Far east latter. Still figuring out how to test other region from my IN activated Alexa.
Also there is lot issues with github code and latest documentation. I followed github doc code for json request and response formats which was also problem with discovery and TurnOn and TurnOff related problem.
But then Ive changed my nodejs code accordingly as per the latest docs and everything worked properly. Only key is reading entire docs thoroughly without missing single bit of information.
I was working on this form last 4 months and finally got success in all aspects. 🥇
Sigh. I have english(UK) skill. For the past 6 months I ran it from N. Virginia. It worked, with an annoying bug, that the first invocation to lambda after a long idle ALWAYS timed out on alexa side, but eventually got invoked anyway. Today I desided to move my stuff over to Ireland to reduce latency. My lambda is simple, but it needs a vps linked EC2 instance so the move involved also moving the EC2... I moved all of it... And then found out that the ARN change form works only in chrome, and once changed, the Ireland lambdas are STILL just not getting invoked... No reason, no error, just nothing happens... It's frustrating beyond belief...
Was struggling all day with this. Found out that after "enabling skill" with a device or through the web you should use "alexa developer console > test" and say alexa to look for it. So far that's the only way I get discover events.
Note, me lambda doesnt return any valid smart home devices, but it's calling it
Still having the problem of skill not calling lambda. My skill is English(US) and Lambda is (N. Virginia). After account linking the discovery is not happening. -Lambda Trigger is enabled -Gerographical Location is English(US) and N.virginia -While testing lambda device discovery is working -In app and test console it does not call the lambda there is no cloud watch logs. Can anyone suggest what is the problem?
If someone still having problems with the "discover divices" and the tutorial "Build a Working Smart Home Skill in 15 Minutes'" this sample only works with the "Skill Playload version 2"
For discovery of smart home devices to succeed, you must choose the region where the (echo) devices are located. It's not just the region associated with your language-choice. This is yet another variable in the equation that is not immediately intuitive. So, if your discovery is failing, ask yourself where your Amazon shopping account resides? Is it .com, .co.uk, .de, etc ?
The docs were recently updated (March 18, 2019) to reflect this:
The original documentation is also updated, so i think we can close this issue now.
I'm based in India and configured Alexa Smart Home Skills in English (IN). I have an IoT smart home setup at home with a public server that exposes endpoints which can execute power control and discovery requests coming from the Lambda function over HTTP GET requests. Basis the first post of this thread, I configured this Alexa skill with us-east-1 Lambda function instance which in my case showed bizarre behavior as seen below for an example of 2 devices - fan, and tubelight.
I ask Alexa to initiate a discovery request. My home server logs correctly show that the discover-devices endpoint was fired by the Lambda function linked with this skill.
I ask Alexa to turn on the fan. There is no new log record on my home server stating that a request was made to turn the fan on. Hence the command seems to have done nothing.
I ask Alexa to turn off the tubelight. My server logs show that the power-state-toggle endpoint was fired by the Lambda function, but to "turn on the fan" (evidently, this is the "previous" request in point-2).
I ask Alexa to turn off the fan. This time, just as in the point-3 case, the logs show that the tubelight has been turned off (note: "turn off fan" request seems to be queued).
Interestingly, if I now initiate another discovery request, my server logs show that it has received 2 requests one after the other:
Any subsequent non-discovery request follows the same cycle as above.
If you notice the sequence of events, it's clear that post the first discovery request, every other power control request is cached and the "previous" power control request, if exists, is executed and finally the last discovery request executes the last "queued" power control request followed by the discovery request itself.
CloudWatch clearly indicated that the Lambda function wasn't triggered whenever my server logs didn't show up a record hence testifying that my server logs were correct. Whenever the Alexa skill "queued" the request to the Lambda function, there clearly was no log entry in CloudWatch.
In addition to my English (IN) Alexa skill linked with the us-east-1 Lambda instance, I also tried the following combinations with no luck whatsoever:
Tried posting here on the Amazon Developer Forum but there's no response as yet / I'm clearly in a hurry. What could be the issue?
I'm having some troubles discovering devices, too.
- Account linking done successfully (although using a different oauth provider, but that shouldn't matter, right?)
- Lambda has Alexa Smart Home trigger, which is enabled, and has the correct skill arn configured
- Skill has correct lambda function ARN as the Default endpoint
- When sending test discovery event from lambda, it works fine
- When trying to discover devices using the alexa app, I get a message stating "No devices found". There are no log entries in CloudWatch after this.
- When trying to discover devices using the alexa webpage, I see the dialog which states it is trying to find devices, but ultimately does not find any. No log entries in CloudWatch after this.
- My skill is in devUK and lambda function in ireland
Ideas?
i have found the reason. the skill language must be same with your lambda region.
I ended up creating lambda endpoints to every region and checked from the logs which one alexa calls. For reasons unknown to me, it calls the US endpoint so now I'm just using that...
lambda calling is related with region.
Mine might be a fringe case, but I had this exact problem when I changed my discovery JSON from 1 to 10 devices. I finally figured out that I had two items with the same applianceid. Bonehead move. I still find it strange that no logs were generated, as if the Lambda function wasn't getting called. Nevertheless, maybe there's someone else out there who made the same mistake as me.
I can't get discovery working, and have configured everything like the "15 minute" tutorial instructs.
Is it true that the email address for the AWS account must be the same as the "shopping account"?
The email for my AWS account was suspended when my credit card expires. Amazon supports says it's impossible to "unsuspend" that email address and instead advised me to simply insert a dummy "+" character in the email address and create the AWS account with that email.
***IF you see valid logs in the lamda cloudwatch but still DEVICES NOT DISCOVERED BY ALEXA, make sure your lambda response satisfies all the criteria as specified in https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery.html
Then make sure Discover responce is having less than 300 endpoints with all the end point id and FRIENDLY NAMES unique.
I had to log out as user in the Alexa app and log in again to see the discovery in the log;
If you follow the 'Build a Working Smart Home Skill in 15 Minutes' and your skill isn't triggered.. read the page again and make sure you have everything as is on the page. Don't take shortcuts!
Now, if it is still not working.. Make sure that, when you are creating a skill in the "English (US)" language, your lambda is created in the region "US East (N. Virginia)". This is described as "You must provide geographic-specific endpoints." in the documentation. For a non-native English speaker you quickly read over this part and i think it is not mentioned on the tutorial above. It would help if that is made more clearly.
Here is the reference from the documentation:
The issue i am having is.. Can this maybe be made more clearly in the documentation?