Closed mocallins closed 2 weeks ago
The on-screen display doesn't necessarily mean the event got sent 'cos the app goes into a polling loop when you have the device displayed.
What you need to look at are the log messages.
You should see something like
2024/08/22 18:37:36 Handler started
2024/08/22 18:37:36 Incoming data: ...
2024/08/22 18:37:36 API call
2024/08/22 18:37:37 Body is: ...
2024/08/22 18:37:37 Decoded body:
{
"command": "pushcontactbyname",
"param1": "Drier Button",
"param2": "0"
}
2024/08/22 18:37:37 Pushing a notification to Alexa
2024/08/22 18:37:37 No refresh needed
024/08/22 18:37:37
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ChangeReport",
....
}
}
2024/08/22 18:37:37 Running in region: us-east-1
2024/08/22 18:37:37 Using API endpoint: https://api.amazonalexa.com/v3/events
2024/08/22 18:37:37 Status response: 401 Unauthorized
2024/08/22 18:37:37 Body response:
{
"header": {
"namespace": "System",
"name": "Exception",
"messageId": "486737f8-8728-47db-ae95-92a3275efc9a"
},
"payload": {
"code": "INVALID_ACCESS_TOKEN_EXCEPTION",
"description": "Access token is not valid."
}
}
2024/08/22 18:37:37 Retrying with new token
2024/08/22 18:37:37 Pushing a notification to Alexa
2024/08/22 18:37:37 Refreshing auth token
2024/08/22 18:37:37 Attempting to get tokens for code: Atzr|...
2024/08/22 18:37:37 200
2024/08/22 18:37:37 Body response:
{
"access_token": "Atza|...",
"refresh_token": "Atzr|...",
"token_type": "bearer",
"expires_in": 3600
}
2024/08/22 18:37:37
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ChangeReport",
"messageId": "...",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "Atza|..."
},
"endpointId": "switch-000012"
},
"payload": {
"change": {
"cause": {
"type": "PHYSICAL_INTERACTION"
},
"properties": [
{
"namespace": "Alexa.ContactSensor",
"name": "detectionState",
"value": "DETECTED",
"timeOfSample": "2024-08-22T18:37:37.872783316Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
},
"context": {
"properties": [
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2024-08-22T18:37:37.872783316Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
2024/08/22 18:37:37 Running in region: us-east-1
2024/08/22 18:37:37 Using API endpoint: https://api.amazonalexa.com/v3/events
2024/08/22 18:37:37 Status response: 202 Accepted
2024/08/22 18:37:37 Body response:
There's a lot happening here.
Firstly we receive the incoming API call and determine it's a button press. So far so normal.
Now we try to send an event to Alexa. The code thinks it has a valid access token, so looks up the region it's running in and picks the correct Alexa endpoint. And it sends a message.
Which fails with a 401 error! Oh dear, the access token isn't valid after all.
So now we try again, but with a new access token. We see it attempting to get a new token, which succeeds ("200" response) and we try to send the event report. This time it is accepted ("200" response). And my Alexa told me my Drier had finished.
You'll need to find this in your cloudwatch logs and verify the event was successfully sent.
cloudwatch logs are on the Amazon developer site ?
No, AWS; it's part of the "cloud" side where the skill runs.
aahhh AWS Console, holy cow lots of data,lol to much.
Yeah I log lots of stuff 'cos it's the only way of seeing what's going on in the skill and helps debug config issues.
well i don't know if i'm looking at the corect timetamp, but it looks like a problem in there uuggghhh that copy and paste looks terrible, what's the trick ?
For an individual log element, click on the "twisty" then on the "copy" icon
This will format correctly in github if you do it inside a code block which can be three backticks ``` on a line on it's own with markdown mode. You can click on the "preview" to see how it looks.
So three backticks paste the code three backticks
twisty ?
2024/08/23 21:30:12 Incoming data:
{
"directive": {
"header": {
"namespace": "Alexa",
"name": "ReportState",
"payloadVersion": "3",
"messageId": "bdae9c55-55be-40b7-b30f-4f103b6f8532",
"correlationToken": "AAAAAAAAAAAszjFzGzfZVVlskBllEGC6AAIAAAAAAABkxNGk4eACgGrKYu/6v1UsbxI/nA0LPcHkGzh65AP9P3J68z6wPQEGlP5CVIyttKrDQ0T/qDmR3RxKbH7C4e8lyPJpcAvQZn6+EQ3VDbXYWxi5xd/NIRwXtYlN0wBnKIqmUs/g8WlOoaxe7QYa21cnSaF4Seg1EAicNmrVDaXITciGYUZcu/Rgr7mShnHx15z/tovbkSLL94hTmuhqZfJJ6rZGu1yN6XAIxBFDkW33zf99jiu6NNcq8I7aWpPHxFFBmYn2ewwtsyxQUoOVrlaNfnJNHWWhYnh0EeBKbAtWNilAHUxJDm2WT3xcbrupDLrLbB8zezi6ePHnBz56eocLr6C04tdzxv/dB8FKfWGOja0MpmeeMqzDVcbE1nGzl2iYQ5sqYSIty4s+wPXwRsUKNg+MIJYo5KcrvCBE7sY4qYqsWEFCspXODeJ/b4lbR3aQcyc07GT6NXshbYNIeFnXMrzMv3k5RgawPuOwkR5WxRwyTf0ewkkhnJo94PMrV1zpeSj/kyVC4CExWBIFtigWH0QcVeGmDWa6Wb+sFW/ab77DwKU81mdlNKHC+JTs95mss+3erHOuZmNSnqyo8vHOLbH9xaw1rphfRtpK1iqtaAeDvSsiiG1AJM957sDlx9MmYKMtPiXA+8AOXEVHWaCi9QI8QR7L6STEV911q1vH/A=="
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "Atza|IwEBIItsZTyLMKaD-BswFxYRKsg-KKuiyQR7RvGtXH5-GNK7DHOe8IFxabE61Iv-mxOBtYih7mGFuQTkuC7TmU6vBCFcRCkfSMutZh1spo0mTcz1FcMdkDXCrxZOBkVQBUfsc7yv-8KWpWAGb4k4J4WdgaNf77t3LznHRvg9w0yUFZNVo0tyObMZQbjLXM4c8_yNECf2sGLXPvSI5bVmsNSgDRV7DErcWwVFjSNL2pJgKu3Iokh9qQmU1INJ6H80nfENndXPXFQYkV9azC_jdAhI7wk0m70kYl8VPW1wm47J7XfiYAYDyjVGOHIwf9_EQ7yZdqSsXc66-wkLyGy2Ab77f8rr"
},
"endpointId": "switch-000007",
"cookie": {}
},
"payload": {}
}
}
2024/08/23 21:30:12 Alexa call
2024/08/23 21:30:12 NameSpace: Alexa, Name: ReportState
2024/08/23 21:30:12 Result of Handler:
{
"event": {
"header": {
"namespace": "Alexa",
"name": "StateReport",
"messageId": "fa4ad18a-8533-4ff3-ba1e-8d74d4dc64b8",
"payloadVersion": "3",
"correlationToken": "AAAAAAAAAAAszjFzGzfZVVlskBllEGC6AAIAAAAAAABkxNGk4eACgGrKYu/6v1UsbxI/nA0LPcHkGzh65AP9P3J68z6wPQEGlP5CVIyttKrDQ0T/qDmR3RxKbH7C4e8lyPJpcAvQZn6+EQ3VDbXYWxi5xd/NIRwXtYlN0wBnKIqmUs/g8WlOoaxe7QYa21cnSaF4Seg1EAicNmrVDaXITciGYUZcu/Rgr7mShnHx15z/tovbkSLL94hTmuhqZfJJ6rZGu1yN6XAIxBFDkW33zf99jiu6NNcq8I7aWpPHxFFBmYn2ewwtsyxQUoOVrlaNfnJNHWWhYnh0EeBKbAtWNilAHUxJDm2WT3xcbrupDLrLbB8zezi6ePHnBz56eocLr6C04tdzxv/dB8FKfWGOja0MpmeeMqzDVcbE1nGzl2iYQ5sqYSIty4s+wPXwRsUKNg+MIJYo5KcrvCBE7sY4qYqsWEFCspXODeJ/b4lbR3aQcyc07GT6NXshbYNIeFnXMrzMv3k5RgawPuOwkR5WxRwyTf0ewkkhnJo94PMrV1zpeSj/kyVC4CExWBIFtigWH0QcVeGmDWa6Wb+sFW/ab77DwKU81mdlNKHC+JTs95mss+3erHOuZmNSnqyo8vHOLbH9xaw1rphfRtpK1iqtaAeDvSsiiG1AJM957sDlx9MmYKMtPiXA+8AOXEVHWaCi9QI8QR7L6STEV911q1vH/A=="
},
"endpoint": {
"endpointId": "switch-000007"
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.ContactSensor",
"name": "detectionState",
"value": "NOT_DETECTED",
"timeOfSample": "2024-08-23T21:30:12.043443761Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2024-08-23T21:30:12.043443761Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
2024/08/23 21:30:12 Handler ended:
{
"event": {
"header": {
"namespace": "Alexa",
"name": "StateReport",
"messageId": "fa4ad18a-8533-4ff3-ba1e-8d74d4dc64b8",
"payloadVersion": "3",
"correlationToken": "AAAAAAAAAAAszjFzGzfZVVlskBllEGC6AAIAAAAAAABkxNGk4eACgGrKYu/6v1UsbxI/nA0LPcHkGzh65AP9P3J68z6wPQEGlP5CVIyttKrDQ0T/qDmR3RxKbH7C4e8lyPJpcAvQZn6+EQ3VDbXYWxi5xd/NIRwXtYlN0wBnKIqmUs/g8WlOoaxe7QYa21cnSaF4Seg1EAicNmrVDaXITciGYUZcu/Rgr7mShnHx15z/tovbkSLL94hTmuhqZfJJ6rZGu1yN6XAIxBFDkW33zf99jiu6NNcq8I7aWpPHxFFBmYn2ewwtsyxQUoOVrlaNfnJNHWWhYnh0EeBKbAtWNilAHUxJDm2WT3xcbrupDLrLbB8zezi6ePHnBz56eocLr6C04tdzxv/dB8FKfWGOja0MpmeeMqzDVcbE1nGzl2iYQ5sqYSIty4s+wPXwRsUKNg+MIJYo5KcrvCBE7sY4qYqsWEFCspXODeJ/b4lbR3aQcyc07GT6NXshbYNIeFnXMrzMv3k5RgawPuOwkR5WxRwyTf0ewkkhnJo94PMrV1zpeSj/kyVC4CExWBIFtigWH0QcVeGmDWa6Wb+sFW/ab77DwKU81mdlNKHC+JTs95mss+3erHOuZmNSnqyo8vHOLbH9xaw1rphfRtpK1iqtaAeDvSsiiG1AJM957sDlx9MmYKMtPiXA+8AOXEVHWaCi9QI8QR7L6STEV911q1vH/A=="
},
"endpoint": {
"endpointId": "switch-000007"
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.ContactSensor",
"name": "detectionState",
"value": "NOT_DETECTED",
"timeOfSample": "2024-08-23T21:30:12.043443761Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2024-08-23T21:30:12.043443761Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
END RequestId: 2c77e88a-bd2f-401c-a332-1c3023e0084b
REPORT RequestId: 2c77e88a-bd2f-401c-a332-1c3023e0084b Duration: 5.85 ms Billed Duration: 6 ms Memory Size: 128 MB Max Memory Used: 33 MB
That's a request from Alexa to report the state of the button; 2024/08/23 21:30:12 Alexa call
shows this.
API calls will show as "API call" and that's what will trigger the event.
Any way i can clear these logs out and only see the latest when i make the api ccall
The way AWS works is that if no data is sent for a while (so don't have the app open, don't make API calls, etc) then the logstream is closed. Next time an event occurs it will open a new log stream.
The newest logstream is at the top of the list
You can delete logstreams by clicking on the radio button to the left of it (or the one at the top of the list) and then click the delete button.
Ok closed the Alexa app, cleared all logs, waited a few seconds, made the api cal, lol
1 positive, i see the call to getbuttons, and it looks correct, which i knew, because i parsed it, lol
Not so sure about the contact action though.
INIT_START Runtime Version: provided:al2.v38 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:f4d7a18770044f40f09a49471782a2a42431d746fcfb30bf1cadeda985858aa0
2024/08/23 22:28:20 Lambda started
START RequestId: f2e77707-a8e0-447a-afd4-31e062287fd8 Version: $LATEST
2024/08/23 22:28:20 Handler started
2024/08/23 22:28:20 Incoming data:
{
"version": "2.0",
"routeKey": "ANY /Smart_Home_Virtual_Buttons",
"rawPath": "/default/Smart_Home_Virtual_Buttons",
"rawQueryString": "",
"headers": {
"accept": "*/*",
"accept-encoding": "gzip,deflate,compress",
"authorization": "fauxmo",
"content-length": "25",
"content-type": "application/x-www-form-urlencoded",
"host": "slmm6ckakd.execute-api.us-east-1.amazonaws.com",
"user-agent": "Mozilla/5.0 (Unix; U; Linux 6.1.21+) http/2.9.8 Tcl/8.6.13",
"x-amzn-trace-id": "Root=1-66c90d03-1e8a397e193bcfea72a38da7",
"x-forwarded-for": "24.253.232.195",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"requestContext": {
"accountId": "802330637144",
"apiId": "slmm6ckakd",
"domainName": "slmm6ckakd.execute-api.us-east-1.amazonaws.com",
"domainPrefix": "slmm6ckakd",
"http": {
"method": "POST",
"path": "/default/Smart_Home_Virtual_Buttons",
"protocol": "HTTP/1.1",
"sourceIp": "24.253.232.195",
"userAgent": "Mozilla/5.0 (Unix; U; Linux 6.1.21+) http/2.9.8 Tcl/8.6.13"
},
"requestId": "c-74nh90oAMEYMg=",
"routeKey": "ANY /Smart_Home_Virtual_Buttons",
"stage": "default",
"time": "23/Aug/2024:22:28:19 +0000",
"timeEpoch": 1724452099697
},
"body": "eyJjb21tYW5kIjogImdldGJ1dHRvbnMifQ==",
"isBase64Encoded": true
}
2024/08/23 22:28:20 API call
2024/08/23 22:28:20 Body is: eyJjb21tYW5kIjogImdldGJ1dHRvbnMifQ==
2024/08/23 22:28:20 Decoded body:
{
"command": "getbuttons"
}
2024/08/23 22:28:20 Handler ended:
{
"Answer:": " 1 OFF Test Button\n 2 OFF Button4\n 3 OFF Button5\n 4 ON push butn 1\n 5 OFF Cellar Door\n 6 ON Garage\n 7 ON screen\n 9 OFF Test 9\n"
}
END RequestId: f2e77707-a8e0-447a-afd4-31e062287fd8
REPORT RequestId: f2e77707-a8e0-447a-afd4-31e062287fd8 Duration: 749.04 ms Billed Duration: 842 ms Memory Size: 128 MB Max Memory Used: 31 MB Init Duration: 92.03 ms
START RequestId: fa05520b-3a6e-45f7-a72a-c2c51b8b0c03 Version: $LATEST
2024/08/23 22:28:21 Handler started
2024/08/23 22:28:21 Incoming data:
{
"version": "2.0",
"routeKey": "ANY /Smart_Home_Virtual_Buttons",
"rawPath": "/default/Smart_Home_Virtual_Buttons",
"rawQueryString": "",
"headers": {
"accept": "*/*",
"accept-encoding": "gzip,deflate,compress",
"authorization": "fauxmo",
"content-length": "48",
"content-type": "application/x-www-form-urlencoded",
"host": "slmm6ckakd.execute-api.us-east-1.amazonaws.com",
"user-agent": "Mozilla/5.0 (Unix; U; Linux 6.1.21+) http/2.9.8 Tcl/8.6.13",
"x-amzn-trace-id": "Root=1-66c90d05-6bdd295f58fa508e083fa184",
"x-forwarded-for": "24.253.232.195",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"requestContext": {
"accountId": "802330637144",
"apiId": "slmm6ckakd",
"domainName": "slmm6ckakd.execute-api.us-east-1.amazonaws.com",
"domainPrefix": "slmm6ckakd",
"http": {
"method": "POST",
"path": "/default/Smart_Home_Virtual_Buttons",
"protocol": "HTTP/1.1",
"sourceIp": "24.253.232.195",
"userAgent": "Mozilla/5.0 (Unix; U; Linux 6.1.21+) http/2.9.8 Tcl/8.6.13"
},
"requestId": "c-743gURoAMEM2g=",
"routeKey": "ANY /Smart_Home_Virtual_Buttons",
"stage": "default",
"time": "23/Aug/2024:22:28:21 +0000",
"timeEpoch": 1724452101232
},
"body": "eyJjb21tYW5kIjoic2V0c3RhdGUiLCJwYXJhbTEiOiI3IiwicGFyYW0yIjoiMSJ9",
"isBase64Encoded": true
}
2024/08/23 22:28:21 API call
2024/08/23 22:28:21 Body is: eyJjb21tYW5kIjoic2V0c3RhdGUiLCJwYXJhbTEiOiI3IiwicGFyYW0yIjoiMSJ9
2024/08/23 22:28:21 Decoded body:
{
"command": "setstate",
"param1": "7",
"param2": "1"
}
2024/08/23 22:28:21 Pushing a notification to Alexa
2024/08/23 22:28:21
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ChangeReport",
"messageId": "1e9883b9-596a-418b-b6a7-4ef8440cb3b8",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": ""
},
"endpointId": "switch-000007"
},
"payload": {
"change": {
"cause": {
"type": "PHYSICAL_INTERACTION"
},
"properties": [
{
"namespace": "Alexa.ContactSensor",
"name": "detectionState",
"value": "DETECTED",
"timeOfSample": "2024-08-23T22:28:21.29034458Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
},
"context": {
"properties": [
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2024-08-23T22:28:21.29034458Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
2024/08/23 22:28:21 Running in region: us-east-1
2024/08/23 22:28:21 Using API endpoint: https://api.amazonalexa.com/v3/events
2024/08/23 22:28:21 Status response: 400 Bad Request
2024/08/23 22:28:21 Body response:
{
"header": {
"namespace": "System",
"name": "Exception",
"messageId": "8caa645e-3e76-4f4f-b99e-acacfae2508a"
},
"payload": {
"code": "INVALID_REQUEST_EXCEPTION",
"description": "The request was malformed."
}
}
2024/08/23 22:28:21 Handler ended:
{
"Answer:": "screen"
}
END RequestId: fa05520b-3a6e-45f7-a72a-c2c51b8b0c03
REPORT RequestId: fa05520b-3a6e-45f7-a72a-c2c51b8b0c03 Duration: 73.18 ms Billed Duration: 74 ms Memory Size: 128 MB Max Memory Used: 32 MB
START RequestId: d7112f3b-f630-43f9-9bc5-d1bc5e84e70d Version: $LATEST
2024/08/23 22:28:21 Handler started
2024/08/23 22:28:21 Incoming data:
{
"version": "2.0",
"routeKey": "ANY /Smart_Home_Virtual_Buttons",
"rawPath": "/default/Smart_Home_Virtual_Buttons",
"rawQueryString": "",
"headers": {
"accept": "*/*",
"accept-encoding": "gzip,deflate,compress",
"authorization": "fauxmo",
"content-length": "25",
"content-type": "application/x-www-form-urlencoded",
"host": "slmm6ckakd.execute-api.us-east-1.amazonaws.com",
"user-agent": "Mozilla/5.0 (Unix; U; Linux 6.1.21+) http/2.9.8 Tcl/8.6.13",
"x-amzn-trace-id": "Root=1-66c90d05-5f1681d74fd1dde717be36b6",
"x-forwarded-for": "24.253.232.195",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"requestContext": {
"accountId": "802330637144",
"apiId": "slmm6ckakd",
"domainName": "slmm6ckakd.execute-api.us-east-1.amazonaws.com",
"domainPrefix": "slmm6ckakd",
"http": {
"method": "POST",
"path": "/default/Smart_Home_Virtual_Buttons",
"protocol": "HTTP/1.1",
"sourceIp": "24.253.232.195",
"userAgent": "Mozilla/5.0 (Unix; U; Linux 6.1.21+) http/2.9.8 Tcl/8.6.13"
},
"requestId": "c-747gxiIAMEPTg=",
"routeKey": "ANY /Smart_Home_Virtual_Buttons",
"stage": "default",
"time": "23/Aug/2024:22:28:21 +0000",
"timeEpoch": 1724452101666
},
"body": "eyJjb21tYW5kIjogImdldGJ1dHRvbnMifQ==",
"isBase64Encoded": true
}
2024/08/23 22:28:21 API call
2024/08/23 22:28:21 Body is: eyJjb21tYW5kIjogImdldGJ1dHRvbnMifQ==
2024/08/23 22:28:21 Decoded body:
{
"command": "getbuttons"
}
2024/08/23 22:28:21 Handler ended:
{
"Answer:": " 1 OFF Test Button\n 2 OFF Button4\n 3 OFF Button5\n 4 ON push butn 1\n 5 OFF Cellar Door\n 6 ON Garage\n 7 ON screen\n 9 OFF Test 9\n"
}
END RequestId: d7112f3b-f630-43f9-9bc5-d1bc5e84e70d
REPORT RequestId: d7112f3b-f630-43f9-9bc5-d1bc5e84e70d Duration: 26.54 ms Billed Duration: 27 ms Memory Size: 128 MB Max Memory Used: 32 MB
You're getting
{
"header": {
"namespace": "System",
"name": "Exception",
"messageId": "8caa645e-3e76-4f4f-b99e-acacfae2508a"
},
"payload": {
"code": "INVALID_REQUEST_EXCEPTION",
"description": "The request was malformed."
}
}
We saw this in #5 and it was caused by not having a bearer token. In your request you have
"scope": {
"type": "BearerToken",
"token": ""
},
I can't tell if the token is empty or if you removed it. If it is empty then it means your dynamodb record for that entry has been removed. The solution should be to remove the skill from Alexa and relink.
That seems like a fairly exotic step, to remove something. And I'm sure i don't know enough to do anything like that, unless was something easy to get to, doesn't seem like it.
And to remove from Alexa and relink, does that mean just disable the skill, and the relink it ?
Yeah, disable and relink.
I don't think i worded that corretly. Disable the skill in my alexa device and reenable ? or do something in the Alexa developer console ?
From the alexa app, disable the skill and relink it.
Yep, i figured that seemed the quickest and easiest. Aaaaannndd its not linking again :((
Ok had to turn Send Alexa events off again to get it to link And i left i off and checked with the api again, and its controlling it, but still not working. that BearerToken, still the same, empty
Then something else is wrong with your setup. Send alexa events MUST be on.
There's an undocumented "debug" API call called "getbuttonsall" that shouldn't normally be used because it shows passwords and stuff. You can use it to check all the magic numbers you entered (eg clientid, clientsecret).
100000 is the API password, 100001 is the Authentication token in JSON format 100002 is the clientID 100003 is the clientSecret
If I was you I would unlink the skill, delete all the Alexa/LWA/AWS stuff and start from scratch and ensure you record all the magic numbers properly as documented because you've got something wrong somewhere. And make sure you deploy to the right region for wherever you're based.
Make sure you follow every line of the install guide; missing one line can break things (I know; last time I rebuilt from scratch I missed out one step and confused myself). Every step must be followed accurately because Amazon don't make it easy.
Should these all be in the DynamoDB ? 100000 is the API password, 100001 is the Authentication token in JSON format 100002 is the clientID 100003 is the clientSecret
If so, i'm missing: 100001 is the Authentication token in JSON format
Yes, 100001 gets populated at skill link time. This is what is used to add the Bearer token to the change notification message
Arrrggghhhh, so i thought i gor everything reset. And went thought the steps again, now i get Insternal Server Error Any way to clear out the Alexa developer account and all the defined services, or is there an easy fix for this error ?
Interanl Server Error with the API call
Have you checked the cloudwatch logs? That might tell you what is broken.
Just clered them, and reran getbuttons:
INIT_START Runtime Version: provided:al2023.v26 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:15ef025e292d9223dc8698563e381c5993aead1a7966fd56d204c6a60b314ee5
2024/08/29 15:24:33 Lambda started
START RequestId: 9cd255be-ed26-41f6-bfe1-1e37447e04cc Version: $LATEST
2024/08/29 15:24:33 Handler started
2024/08/29 15:24:33 Incoming data:
{
"version": "2.0",
"routeKey": "ANY /Smart_Home_Virtual_Buttons",
"rawPath": "/default/Smart_Home_Virtual_Buttons",
"rawQueryString": "",
"headers": {
"accept": "*/*",
"authorization": "fauxmo",
"content-length": "24",
"content-type": "application/x-www-form-urlencoded",
"host": "r2cbf6auol.execute-api.us-east-1.amazonaws.com",
"user-agent": "curl/7.88.1",
"x-amzn-trace-id": "Root=1-66d092b0-1257bfa42ef8adf0033cb0dd",
"x-forwarded-for": "24.253.232.195",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"requestContext": {
"accountId": "802330637144",
"apiId": "r2cbf6auol",
"domainName": "r2cbf6auol.execute-api.us-east-1.amazonaws.com",
"domainPrefix": "r2cbf6auol",
"http": {
"method": "POST",
"path": "/default/Smart_Home_Virtual_Buttons",
"protocol": "HTTP/1.1",
"sourceIp": "24.253.232.195",
"userAgent": "curl/7.88.1"
},
"requestId": "dRvbpjetoAMEVMw=",
"routeKey": "ANY /Smart_Home_Virtual_Buttons",
"stage": "default",
"time": "29/Aug/2024:15:24:32 +0000",
"timeEpoch": 1724945072627
},
"body": "eyJjb21tYW5kIjoiZ2V0YnV0dG9ucyJ9",
"isBase64Encoded": true
}
2024/08/29 15:24:33 API call
2024/08/29 15:24:34 Got error calling Scan: ResourceNotFoundException: Requested resource not found
RequestId: 9cd255be-ed26-41f6-bfe1-1e37447e04cc Error: Runtime exited with error: exit status 1
Runtime.ExitError
END RequestId: 9cd255be-ed26-41f6-bfe1-1e37447e04cc
REPORT RequestId: 9cd255be-ed26-41f6-bfe1-1e37447e04cc Duration: 1472.33 ms Billed Duration: 1568 ms Memory Size: 128 MB Max Memory Used: 35 MB Init Duration: 94.85 ms
INIT_START Runtime Version: provided:al2023.v26 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:15ef025e292d9223dc8698563e381c5993aead1a7966fd56d204c6a60b314ee5
2024/08/29 15:24:34 Lambda started
No newer events at this moment.
You don't have DynamoDB set up correctly; the code is unable to read from the database.
Ok, well good news and bad, lol :( I got the table recreated, and the API worked correctly. So of course, on to the next step. I tried enabling the skill, and it succeeded, However, wheni went and looked at the table, i do indeed see the 100001 item, but it shows error.
I think i mistyped the table name slightly, so where is the linkage to the table that i can correct ?
If you''re wanting to change the code then you need to look at dynamo.go
. Line 31
TABLE_NAME = "Smart_Home_Virtual_Buttons"
But if you had the table name wrong then the API should fail just as if the table didn't exist. So I doubt that's the problem
Ok, well then there's probably an issue with the linking. Again.
Orrrr what do you need to see ?
100001:
{"error":"","error_description":"","access_token":"Atza|...","refresh_token":"Atzr|...","expires_in":3600,"TimeSet":1724949665}
That's the Alexa result from llinking and it shows a good entry; the error
field is empty, showing there's no error. So linking was successful. (I removed the access token values because it's sensitve information)
Ok, sorry
Where to now ?
Not sure I understand the question. You've rebuilt and it looks like you have the right token values this time so you can link. So what problems do you still have?
Ok, got it. Had a bunch of old routines, when nothing was working, and had to clean that up.
All is working now.
Thanks for your patience.
Yay, glad you finally got there!
Alexa routine not being triggering on button press
So i've got a script in my preferred language tcl/tk, and to show that it functions here is the result of getbuttons all parsed into a dictionary:
And here is the result when i use the API to press a button:
and alexa device:
and the reverse:
device:
And my Alexa routine: I have altered the routine multiple ways, this is the latest, while trying to figure this out
I've tried with screen closes and screen opens , but makes no difference.