-
Notifications
You must be signed in to change notification settings - Fork 1
How to deploy the service.
The MozAssist is a Google Assistant smart home service that integrate with Gateway.
git clone https://github.com/sogaani/mozassist.git
Create a file named config.staging.json
with following text.
{
"clientId": "some text[0-9a-zA-Z]*",
"clientSecret": "some text[0-9a-zA-Z]*",
"redirectUrl": "fill later",
"googleServiceAccount": "fill later",
"homeGraphServiceAccount": "fill later",
"isLocal": true,
"mongodb": "fill later",
"smartHomeProviderApiKey": "not used currently"
}
- In the Action Console. Create a new project and redirect to https://console.actions.google.com/project//onboarding.
- Select Home Control > Smart home
- Fill
redirectUrl
value onconfig.staging.json
.
"redirectUrl": "https://oauth-redirect.googleusercontent.com/r/<google developer project ID>",
Google Assistant smart home services use Home Graph API to store available devices and their states.
- Follow the directions from report-state to enable Home Graph API and get credentials.
- Fill
homeGraphServiceAccount
value onconfig.staging.json
.
"homeGraphServiceAccount": <JSON format text downloaded above>,
The MozAssist use Firestore as database to store oauth state, oauth token, and Gateway address.
- Go to firebase console.
- Select the project created above. Click the database. Enable Cloud Firestore Beta, and select lock mode.
- Go to Service Accounts. Click
Generate new private key
and get credentials. - Fill
googleServiceAccount
value onconfig.staging.json
.
"googleServiceAccount": <JSON format text downloaded above>,
The MozAssist use Mongodb and agenda to polling the devices properties and report the state. Setup the Mongodb and get the database uri.
"mongodb": {
"uri": "mongodb://....
}
If not setup Mongod, the MozAssist response a device state with Query request.
- Execute following commands on project root folder.
npm install
npm start
- You get a following text on console and remember the address placed after
COPY & PASTE NGROK URL BELOW:
.
|###################################################|
| |
| COPY & PASTE NGROK URL BELOW: |
| |
| https://036f847c.ngrok.io |
| |
|###################################################|
Access google actions console. Select the project created above.
Click Name your Smart Home action
. Set a name what you want. Click save
.
- Click
Setup account linking
. SelectNo, I only want to allow account creation on my website
and click next. - Select Linking type to
OAuth
andAuthorization code
. Click next. - Fill Client information as forllowing and click next.
- Client ID issued by your Actions to Google: clientId value on
config.staging.json
. - Client secret: clientSecret value on
config.staging.json
. - Authorization URL:
https://<your-service-address>/oauth
- Token URL:
https://<your-service-address>/token
- Client ID issued by your Actions to Google: clientId value on
- Fill Scopes as
readwrite
and click Next. - Fill least one word to Testing instructions and click Save.
Click Add Action(s) > Add your first action. Fill Add fulfillment URL as https://<your-service-address>/smarthome
and click DONE.
Click TEST.