Alexa skill that lets you control MyHabeetat devices, including BGH Smart Control.
Unfortunately this means I can not submit the skill to the Alexa Skills Store on their behalf, and none of the involved parties seem to be interested in doing it either. You can get around that by creating your own development skill, which will only be available for your account (it's what I'm currently using and it works like a charm). See Installation instructions below for a detailed step by step.
This skill implements integration with MyHabeetat's cloud platform which allows among other things to control BGH Smart Control devices. This skill has not been tested to work with BGH Smart Control's cloud platform.
Both platforms were developed by the same company and are essentially the same but MyHabeetat allows for adding more devices. If you have your devices registered under the BGH Smart Control's platform or smartphone app please consider migrating to MyHabeetat's platform/app.
Accepts the following standard Thermostat commands:
Turn on
Utterance: Alexa, turn on <device>
Initially set to auto
mode when turned on
Turn off
Utterance: Alexa, turn off <device>
Set temperature
Utterance: Alexa, set <device> to <temperature>
Sometimes Alexa replies with <device> is not responding
even though the command is successfully executed. See #1 for details
Set mode
Utterance: Alexa, set <device> to <mode>
Available modes: heat
, cool
, auto
Other commands might also work but are untested, feel free to PR or let me know and I'll add them here.
The process of installing your own custom skill is not as simple as installing one from the Skills Store so I added this installation section to hopefully guide you throughout the way.
You don't really need to have programming skills or be very tech savvy to get it up and running, anyone can do it. What you do need is to pay close attention to each step as one misconfiguration can be difficult to trace or debug. Feel free to reach out if you run into any trouble and I'll be happy to assist you; to do so, please open an issue here or send me an email at tomasmigone@gmail.com
.
There are two distinct pieces we need to create and configure to get our skill working:
- Alexa Custom Skill: Integration with Alexa ecosystem.
- AWS Lambda Function: Backend code that interacts with MyHabeetat's cloud platform.
Custom skills allow you to create an Alexa skill that follows the Alexa protocol, endpoints and utterance model but that relays command execution to other services, in this case a Lambda function.
Before we start, create or sign in to your Alexa developer account. Remember this skill will be treated as a development skill, only accesible to your account, so make sure you use the same account you connected to your Alexa devices.
To create your custom skill:
- Navigate to the Alexa developer console.
- Click
Create skill
. - Enter the skill name (for example:
My Habeetat
), selectSmart Home
as the skill model andProvision your own
as the skill hosting. ClickCreate skill
in the top right corner. - Choose
Start from scratch
as the template and clickChoose
to move to the next screen. - Navigate back to the Alexa developer console. Click on
View Skill ID
below your Skill and copy the the Skill ID. It should look like this:amzn1.ask.skill.1a2b55555-c325-1234-d56e-1f234d5e6a78
.
We'll go back to the skill configuration, but before we need to create the Lambda function.
The code that interacts with MyHabeetat's platform is hosted as a Lambda function on AWS. AWS Lambda is a service that lets you run code in the cloud without managing servers. Alexa sends your skill requests and your code inspects the request, takes any necessary actions such as communicating with the device cloud for that customer, and then sends back a response.
Before we start, create or sign in to your AWS account.
First we need to create an IAM (Identity and Access Management) role that enables basic execution for our lambda function.
- Navigate to the IAM console.
- Click
Roles
on the sidebar. - Click
Create role
. - Select
AWS service
as type of trusted entity and thenLambda
as use case. ClickNext
. - Search for
AWSLambdaBasicExecutionRole
, select it with the checkbox and clickNext
. - Click
Next
as we won't be adding any tags. - Enter a name the identifies this role (for example:
AWSLambdaBasicExecution
) and clickCreate role
.
You should now see the role you created in your IAM console:
Next we will be creating the Lambda function that will run our code.
- Navigate to the Lambda console.
- Ensure that your region is set to
US East (N. Virginia)us-east-1
: - Click
Create function
. - Select
Author from scratch
. UnderBasic information
give it a name (for example:myHabeetat
) and selectNode.js 10.x
as runtime. MyHabeetat uses an old TLS version that is no longer supported as default inNode.js 12.x
. Lastly, underPermissions
expand the dropdown, chooseUse an existing role
and select the IAM role we created in the previous step. ClickCreate function
to continue. - Under
Designer
section clickAdd trigger
. SelectAlexa Smart Home
as the trigger source and paste the Skill ID you copied after we generated the skill. ClickAdd
. - Download a copy of this repository from here.
- Under
Designer
click on the block that represents your lambda function. UnderEdit code inline
, select theUpload a .zip file
option and upload the ZIP you just downloaded: - Scroll down a bit and under
Basic settings
clickEdit
. Change theTimeout
value to6 seconds
and hitSave
. - Click
Save
(again) on the top right corner of your screen. Ensure the ZIP you uploaded is still there. - Copy the
ARN
string that is located on the top right corner. It looks like this:arn:aws:lambda:us-east-1:901579287795:function:myHabeetat
.
Next up is to finish off the skill configuration.
- Navigate back to the Alexa developer console.
- Click on your skill to access it's configuration.
- You should now be at the
Build
configuration section. If you are not, click on theBuild
tab. - Select
v3
as thePayload version
. Paste theARN
you copied from the Lambda function into theDefault endpoint
box. Check the theNorth America
box and paste theARN
in there too. ClickSave
. - Click on
Account linking
, fill in the following information and clickSave
:
Option | Value |
---|---|
Authorization URI | https://myhabeetat.tmigone.com/v1/oauth/authorize |
Access Token URI | https://myhabeetat.tmigone.com/v1/oauth/access_token |
Client ID | alexa-myhabeetat |
Secret | <anything-you-want> |
Authentication schema | HTTP Basic |
Scope | Add default |
This makes use of a series of OAuth 2.0 services (https://myhabeetat.tmigone.com
) I developed to make account linking work. They are deployed using a public Zeit Now project so you can review the source code through their website (https://myhabeetat.tmigone.com/_src
) or at the project repository (https://github.com/tmigone/myhabeetat-api
).
Last step is to install the development skill we just created on our smartphone.
- Open the Alexa app (Android / iOS).
- Go to
Skills & Games
tab. - Go to
Your Skills
and selectDev
skills. - You should now see your custom skill listed and available to install with a red warning that reads
Account linking required
. - Open the skill, click
Enable to use
. - Log in with your MyHabeetat credentials and follow the rest of the wizard through the end.
Congratulations! You can now ludicrously control your devices with voice commands!