- 18 Aug 2021: 1.0.5 Revert to PyMyQ 3.0.4 to avoid errors on open and close (Issue 20)
- 10 Aug 2021: 1.0.4 Update to PyMyQ 3.1.1
- 22 Apr 2021: 1.0.3 Revert to old instructions that support Python 3.8 (required by PyMyQ 3.0.4)
- 23 Feb 2021: 1.0.2 Update to PyMyQ 3.0.4
- 13 Jan 2021: 1.0.1 Update to PyMyQ 2.0.14 to fix API issues
- 29 Dec 2020: 1.0.0 Created based on https://github.com/tigerbrain/Alexa-MyQ-WithMultiDoorSupport.
Use Alexa to activate your Chamberlain/LiftMaster MyQ garage gateway that is connected to one or two doors.
By using the Alexa Skills Kit, you can control your Chamberlain or LiftMaster MyQ garage door through your Amazon Echo device. Many thanks for previous work:
- https://github.com/tigerbrain/Alexa-MyQ-WithMultiDoorSupport the code that this skill is directly based on.
- https://github.com/jbnunn/Alexa-MyQGarage the original skill for a one-car garage.
- https://github.com/pfeffed/liftmaster_myq the Ruby API that Alexa-MyQGarage adapted to Python.
The major changes from Alexa-MyQ-WithMultiDoorSupport:
- Move to Python 3.8 (required by PyMyQ).
- Move to PyMyQ.
-
Create a free Amazon developer account or sign in at https://developer.amazon.com/alexa.
-
On the Amazon Alexa developer main page, click on the three dots at top right and choose "Alexa Developer Console".
-
Click Create Skill to add a new skill.
-
Provide the following settings:
-
Skill name: Your own custom skill name such as Operate Garage
-
Default language: Your preferred language
-
Choose a model to add to your skill: Custom
-
Choose a method to host your skill's backend resources: Provision your own
-
-
Click Create skill at the top right.
-
-
Choose a template: Start from Scratch
-
Click Choose at the top right.
-
Click Invocation on the left. Provide a Skill Invocation Name: "my garage" or a name of your choice.
-
Click Interaction Model and then JSON Editor on the left. Paste the contents of interaction_model.json here, replacing the Hello World contents.
-
Click Build Model at top.
-
-
Click on Your Skills to return to the list of skills.
-
Click Copy Skill ID of your new skill.
Sample Application ID: amzn1.ask.skill.2dc3256e-f143-41a6-ab8f-194c3df2d789
-
-
In a new browser tab, go to https://aws.amazon.com. Sign in as the root user or create a new account.
-
At the top right, to the right of your name, if the location is not N. Virginia, choose US East (N. Virginia) us-east-1.
-
Search for the Lambda service.
-
-
Click Create function at the top right.
-
Provide the following information under Basic information:
- Function name: A name without spaces such as OperateGarage
- Runtime: Python 3.8
-
Click Create function.
-
-
On the function page, click Add trigger.
-
Choose Alexa Skills Kit as the trigger. (If it's not available, make sure you have set the region to N. Virginia.)
-
Paste the skill ID from the Alexa console.
-
Click Add.
-
-
Click General configuration on the left.
- Click Edit.
- Change the Timeout value to 5 sec.
- Click Save.
-
Click Environment variables on the left.
- Click Edit.
- Click Add environment variable to add the following variables:
-
Key: USER_NAME
Value: your MyQ account user name
-
Key: PASSWORD
Value: Your MyQ account password
-
Key: ONLY_CLOSE
Value: Y or N. Enter Y if you don't want Alexa to open doors for security reasons.
-
Key: LEFT
Value: 0 or 1. Door 0 is the door first set up with MyQ. If you're unsure, try 0. After deployment, if the wrong door opens, switch from 0 to 1.
-
- Click Save.
-
Click the Code tab (below Add trigger)
- Click Upload from on the right and choose .zip file.
- Click Upload and choose lambda-upload.zip.
- Click Save.
-
Click the Test tab (Optional)
- Enter HelpIntent as the Name.
- Replace the event JSON with the contents of tests/HelpIntent.json.
- Click Save changes
- Click Test
If you've done everything correctly, you should see "Execution result: succeeded (logs)". This test only communicates with Alexa and not your garage. If it failed, verify all the steps above.
- Choose New event
- Enter TestAllStates as the Name.
- Replace the event JSON with the contents of tests/TestAllStates.json.
- Click Save changes
- Click Test
If the test succeeds, you should see "Execution result: succeeded (logs)" again. The log output should show your actual door state (open or closed). If the test fails, make sure you have set up the environment variables correctly.
-
In the Function overview, copy the Function ARN by clicking the Copy icon.
-
Return to your Amazon developer account >> Alexa >> Alexa Skills Kit project and edit the custom skill that you have already started creating back in step 5.
- Choose Endpoint on the left.
- Paste the function ARN as the value of the Default Region.
- Click Save Endpoints
-
Click Build at the top.
- Click Build Model on the right.
- Wait for "Full Build Successful"
-
Click Test at the top.
- Change the pulldown value from Off to Development.
-
Congratulations! You are now ready to test your skill by giving Alexa the commands below:
Assuming that your skill invocation name is "my garage"
If your MyQ unit is only linked to a single garage door, you would say:
"Alexa, ask MY GARAGE if DOOR is open" OR "Alexa, ask MY GARAGE DOOR to close"
If your MyQ unit is linked to two garage doors, you would say:
"Alexa, ask MY GARAGE if THE LEFT DOOR is open" OR "Alexa, ask MY GARAGE if THE RIGHT DOOR is closed" OR "Alexa, ask MY GARAGE what's up?"
In addition, for units linked to two garage doors, you may also drop the DOOR keyword and just say:
"Alexa, ask MY GARAGE LEFT to close" OR "Alexa, ask MY GARAGE if RIGHT is open"
IMPORTANT: Before attempting to troubleshoot an issue, first verify that Alexa and AWS Lambda are fully up and running by checking their status on the AWS Service Health Dashboard.
Viewing the skill logs can usually tell you what's gone wrong.
Go to the Alexa Developer Console, click the Code tab and then click the Logs icon.
This takes you to CloudWatch, where you can check the logs with the most recent
one at the top of the list.
For more detailed logging, add LOG_LEVEL=DEBUG
to the environment variables and redeploy.
The most common problem is that Chamberlain makes an incompatible change to their server.
Look for an update to this code or possibly to PyMyQ
if this is the problem.
To see lambda logs, go to your lambda function in the AWS Console and click Monitor. From there, you can look at CloudWatch metrocis or go directly to the logs.
You can also go to Alexa console and test commands by clicking on the Test tab.
You can say or enter commands there:
- open my garage
- ask my garage what's up
- ask my garage to close the left door
If you make a change to the source here or get an update from git, you will need to update one or more components using the instructions above.
New releases usually include a new upload-lambda.zip. To deploy it, go to your lambda function in the AWS Console and upload the zip file, following the instructions above. If you want to verify that the new zip has successfully deployed, test a command such as "What's up?" on your Alexa device. Then click the Monitor tab in the AWS Console and click "View logs in CloudWatch". Click on the latest log stream (you may have to click the refresh button to see it). The first line of the logs for your command should include "Alexa-PyMyQ" followed by the version number.
If you change lambda_function.py yourself, you can just replace lambda_function.py
itself on the Code tab and click Deploy.
If you change the requirements,
you need to rebuild lambda-upload.zip. Run scripts/create-lambda-old.sh
.
Then upload the zip file as described above.
If you change interaction_model.json, reload it through the Alexa console following the instructions above.
If you do change anything, you may want to run tests locally first (this assumes you have created a virtualenv):
pytest test_lambda.py
The documentation for the Alexa Skills Kit is available on the Amazon Alexa Portal.
The code here is based off of an unsupported API from Chamberlain and is subject to change without notice. The authors claim no responsibility for damages to your garage door or property by use of the code within.