Read the statement by Michael Teeuw here.
MMM-MirrorMirrorOnTheWall installation issue
-
Just a heads up –
I was running into the same issues as you both. After hours of research I eventually discovered that the AWS IoT security policy for your certificates must be properly configured…otherwise you’ll be hit with authorization issues when clients attempt to connect to the IoT thing for subscribing, publishing, connections, etc. Once i corrected this, I had no further issues with the installation.
The change I made to my policy in ‘AWS IoT>Secure>Policies’ is below:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Publish", "iot:Receive" ], "Resource": [ "arn:aws:iot:us-east-1:543211234567:topic/sdk/test/java", "arn:aws:iot:us-east-1:543211234567:topic/sdk/test/Python", "arn:aws:iot:us-east-1:543211234567:topic/topic_1", "arn:aws:iot:us-east-1:543211234567:topic/topic_2", "arn:aws:iot:us-east-1:543211234567:topic/MagicMirror:new-text", "arn:aws:iot:us-east-1:543211234567:topic/MagicMirror:new-images", "arn:aws:iot:us-east-1:543211234567:topic/MagicMirror:change-module", "arn:aws:iot:us-east-1:543211234567:topic/MagicMirror:new-video" ] }, { "Effect": "Allow", "Action": [ "iot:Subscribe" ], "Resource": [ "arn:aws:iot:us-east-1:543211234567:topicfilter/sdk/test/java", "arn:aws:iot:us-east-1:543211234567:topicfilter/sdk/test/Python", "arn:aws:iot:us-east-1:543211234567:topicfilter/topic_1", "arn:aws:iot:us-east-1:543211234567:topicfilter/topic_2", "arn:aws:iot:us-east-1:543211234567:topicfilter/MagicMirror:new-text", "arn:aws:iot:us-east-1:543211234567:topicfilter/MagicMirror:new-images", "arn:aws:iot:us-east-1:543211234567:topicfilter/MagicMirror:change-module", "arn:aws:iot:us-east-1:543211234567:topicfilter/MagicMirror:new-video" ] }, { "Effect": "Allow", "Action": [ "iot:Connect" ], "Resource": [ "arn:aws:iot:us-east-1:543211234567:client/sdk-java", "arn:aws:iot:us-east-1:543211234567:client/basicPubSub", "arn:aws:iot:us-east-1:543211234567:client/sdk-nodejs-*", "arn:aws:iot:us-east-1:543211234567:client/MagicMirror*" ] } ] }
Make sure your client id defined in MirrorMirror.js matches the wildcard (“MagicMirror” in this case) that was added to iot:Connect action of the policy. This needs to be modified locally in the module and also in the uploaded lambda function!
// Setup our AWS IoT device and receive messages app.setup = function() { app.device = awsIot.device({ keyPath: __dirname + "/certs/MagicMirror.private.key", certPath: __dirname + "/certs/MagicMirror.cert.pem", caPath: __dirname + "/certs/root-CA.crt", clientId: "MagicMirror" + (new Date().getTime()), region: "us-east-1", host: "YOURID.iot.us-east-1.amazonaws.com", });
Best of luck and happy new year!
-
@blackpanda Hey thank you for reviving the topic and happy new year.
Quick question were do i find the ‘AWS IoT>Secure>Policies’
so i can make the necessary changes at??Is it over on the MirrorMirrorOnTheWallSkill i have a aws-iot-device-sdk folder under src/node_modules but there is no Secure sub folder in it!!!
D
-
@richland007 said in MMM-MirrorMirrorOnTheWall installation issue:
Quick question were do i find the ‘AWS IoT>Secure>Policies’
Policies are modified via the Amazon Web Services (AWS) management console.
You can update the policy by submitting JSON through the API. Or you can use the management console and just duplicate the settings posted above.
-
@blackpanda thanx bro! I will try this later today, I will report back. @richland007 did it work for you?
-
@blackpanda SO you got this to work? I still have problem =( When building the model could you paste your interactionmodel? the one that goes into the json editor…
-
@oceank I haven’t gotten the chance to give it another try but i will soon :)
Did you do the changes that @blackpanda suggested ?? whats it telling you now??@blackpanda It took me a while to realize that it says MagicMirror but on our MirrorMirror.js file the ClienId is MirrorMirror so i changed that and i uploaded on Lambda and i made the appropriate policy changes on the IoT to reflect my arn:aws and my number nut just copy paste yours
but when i test Lambda now i get this error: The applicationIds don’t match: amzn1.ask.skill.[unique-value-here] and amzn1.ask.skill.e0223a06-d061-48bd-9b1c-3XXXXa950fcfAnd the app ID has not changed?? And also when i go to test the skill now on the Alexa developer side now i dont even get"Hello My queen…" i used to get it just goes straight to there was a problem with the requested skills response.
What else do i need to change cause i doubt there is anything major …has the syntax changed again appID or aplicationId etc???
Thank you any help is greatly appreciated
D -
@richland007 so you changed the clientId in the lambda function and uploaded it. Did you change the client id in the module as well? Can you post your security policy? You should also define your queues (modules) there.
The app id is defined in index.js of the skill. APP_ID is defined in a variable near the top of the file.
Looks like this currently:
alexa.appId = APP_ID
Also, you can verify what your skill id is by checking in the amazon developer console then selecting ‘endpoint’ (it’s an option on the left pane under interaction model and interfaces).
-
pro-tip:
A way to check and see if you’re actually subscribing to the topics that are publishing search results:
if you run the following command from a remote putty session…
cd ~/MagicMirror Display=:0 npm start
you should eventually see that you’re subscribing to the topics!
Initially, the misconfigured security policy was preventing this from happening and authorization errors were being thrown in the background (had to dig into cloudwatch logs for this). In putty, the command would simply hang at “Attempt to connect to AWS”
Basically your youtube api search results will be published to the “new-video” queue…and if your aren’t subscribed to that queue then you wont see anything change on your monitor. Same for your google image searches and “new-images”. and so on.
-
when building the alexa model and enter the interaction model, is this the correct model?
{
“interactionModel”: {
“languageModel”: {
“invocationName”: “magic mirror”,
“intents”: [
{
“name”: “AMAZON.FallbackIntent”,
“samples”: []
},
{
“name”: “AMAZON.CancelIntent”,
“samples”: []
},
{
“name”: “AMAZON.HelpIntent”,
“samples”: []
},
{
“name”: “AMAZON.StopIntent”,
“samples”: []
},
{
“name”: “MirrorMirrorHelloIntent”,
“slots”: [],
“samples”: [
“good evening”,
“good afternoon”,
“good morning”,
“hey”,
“hi”,
“hello”
]
},
{
“name”: “ShowTextIntent”,
“slots”: [
{
“name”: “displayText”,
“type”: “LIST_OF_TEXT”
}
],
“samples”: [
“say {displayText}”,
“display text of {displayText}”,
“show text of {displayText}”
]
},
{
“name”: “TurnOnModuleIntent”,
“slots”: [
{
“name”: “moduleName”,
“type”: “LIST_OF_MODULES”
}
],
“samples”: [
“open {moduleName}”,
"open module {moduleName} ",
“show {moduleName}”,
"show module {moduleName} ",
“turn on {moduleName}”,
"turn on module {moduleName} ",
“start {moduleName}”,
"start module {moduleName} "
]
},
{
“name”: “TurnOnAllModuleIntent”,
“slots”: [],
“samples”: [
“open all”,
“open all modules”,
“open every module”,
“open each module”,
“show all modules”,
“show me all modules”,
“show every module”,
“show each module”,
“turn on all”,
“turn on all modules”,
“turn on every module”,
“turn on each module”,
“start all”,
“start all modules”,
“start every module”,
“start each module”
]
},
{
“name”: “TurnOffAllModuleIntent”,
“slots”: [],
“samples”: [
“close all”,
“close all modules”,
“close every module”,
“close each module”,
“hide all”,
“hide all modules”,
“hide every module”,
“hide each module”,
“turn off all”,
“turn off all modules”,
“turn off every module”,
“turn off each module”
]
},
{
“name”: “TurnOffModuleIntent”,
“slots”: [
{
“name”: “moduleName”,
“type”: “LIST_OF_MODULES”
}
],
“samples”: [
“close {moduleName}”,
"close module {moduleName} ",
“hide {moduleName}”,
"hide module {moduleName} ",
“turn off {moduleName}”,
“turn off module {moduleName}”
]
},
{
“name”: “ShowImagesIntent”,
“slots”: [
{
“name”: “searchTerm”,
“type”: “LIST_OF_IMAGES”
}
],
“samples”: [
“find {searchTerm}”,
“find images of {searchTerm}”,
“find pictures of {searchTerm}”,
“show me {searchTerm}”,
“show me pictures of {searchTerm}”,
“show me images of {searchTerm}”,
“show pictures of {searchTerm}”,
“show images of {searchTerm}”,
“display pictures of {searchTerm}”,
“display images of {searchTerm}”
]
},
{
“name”: “ShowVideoIntent”,
“slots”: [
{
“name”: “searchTermVideo”,
“type”: “LIST_OF_VIDEOS”
}
],
“samples”: [
“show me how to {searchTermVideo}”,
“show me video of {searchTermVideo}”,
“show me a video of {searchTermVideo}”,
“show video of {searchTermVideo}”,
“show a video of {searchTermVideo}”,
“display video of {searchTermVideo}”,
“display a video of {searchTermVideo}”,
“find video of {searchTermVideo}”,
“find a video of {searchTermVideo}”
]
},
{
“name”: “AMAZON.MoreIntent”,
“samples”: []
},
{
“name”: “AMAZON.NavigateHomeIntent”,
“samples”: []
},
{
“name”: “AMAZON.NavigateSettingsIntent”,
“samples”: []
},
{
“name”: “AMAZON.NextIntent”,
“samples”: []
},
{
“name”: “AMAZON.PageUpIntent”,
“samples”: []
},
{
“name”: “AMAZON.PageDownIntent”,
“samples”: []
},
{
“name”: “AMAZON.PreviousIntent”,
“samples”: []
},
{
“name”: “AMAZON.ScrollRightIntent”,
“samples”: []
},
{
“name”: “AMAZON.ScrollDownIntent”,
“samples”: []
},
{
“name”: “AMAZON.ScrollLeftIntent”,
“samples”: []
},
{
“name”: “AMAZON.ScrollUpIntent”,
“samples”: []
}
],
“types”: [
{
“name”: “LIST_OF_TEXT”,
“values”: [
{
“name”: {
“value”: “hello”
}
},
{
“name”: {
“value”: “hello everyone”
}
},
{
“name”: {
“value”: “good morning”
}
},
{
“name”: {
“value”: “good morning to you”
}
},
{
“name”: {
“value”: “how are you doing”
}
}
]
},
{
“name”: “LIST_OF_MODULES”,
“values”: [
{
“name”: {
“value”: “calendar”
}
},
{
“name”: {
“value”: “current weather”
}
},
{
“name”: {
“value”: “smile test”
}
},
{
“name”: {
“value”: “compliments”
}
}
]
},
{
“name”: “LIST_OF_IMAGES”,
“values”: [
{
“name”: {
“value”: “queen”
}
},
{
“name”: {
“value”: “snow white”
}
},
{
“name”: {
“value”: “seven dwarfs”
}
},
{
“name”: {
“value”: “sharks”
}
},
{
“name”: {
“value”: “elon musk”
}
},
{
“name”: {
“value”: “apples”
}
},
{
“name”: {
“value”: “sea animals”
}
},
{
“name”: {
“value”: “octopus”
}
},
{
“name”: {
“value”: “volcanoes”
}
},
{
“name”: {
“value”: “birds”
}
},
{
“name”: {
“value”: “bill gates”
}
},
{
“name”: {
“value”: “animals”
}
},
{
“name”: {
“value”: “rattle snakes”
}
}
]
},
{
“name”: “LIST_OF_VIDEOS”,
“values”: [
{
“name”: {
“value”: “draw”
}
},
{
“name”: {
“value”: “paint”
}
},
{
“name”: {
“value”: “make slime”
}
},
{
“name”: {
“value”: “unlock locks”
}
},
{
“name”: {
“value”: “apples”
}
},
{
“name”: {
“value”: “bananas”
}
},
{
“name”: {
“value”: “movie trailer”
}
},
{
“name”: {
“value”: “video games”
}
},
{
“name”: {
“value”: “volcanoes”
}
},
{
“name”: {
“value”: “birds”
}
},
{
“name”: {
“value”: “bill gates”
}
},
{
“name”: {
“value”: “animals”
}
},
{
“name”: {
“value”: “rattle snakes”
}
},
{
“name”: {
“value”: “cats”
}
},
{
“name”: {
“value”: “dogs”
}
},
{
“name”: {
“value”: “lego superman”
}
},
{
“name”: {
“value”: “lego batman”
}
},
{
“name”: {
“value”: “apple and orange”
}
},
{
“name”: {
“value”: “evil queen”
}
}
]
}
]
}
}
} -
@oceank does it compile? what happens when you test? That model can vary, mine has been customized a bit.