Unsolved [Under-Writing] Installation of Gateway with SmartHome functionality
-
SmartHome Installation
I think do you know the Google Home app of your smartphone
It is used to control the connected devices
We are therefore going to create the extension in order to control Jatvis from this application!
Naturally… when done, you can therefore control it by voice from another device that uses the google assistantProcess
SmartHome needs to receive and send data
Send data it’s not a problem
Receive data in live from google Server in live get a little more complex
And again… it’s use https protocal
So I tried to simplify as much as possible (as usual) the installationPreRequire
- Domaine name or DynDNS (or equivalentq) account
- a Router
- an Google Account: same like
MMM-GoogleAssistant
, Google Home app, SmartPhone account
Screenshot
Google Home
Jarvis
icon:On the App:
What can this plugin do?
It’s able to control plugin
EXT-Screen
: for Force turn on/off screenEXT-Volume
: for volume and mute/unMute controlEXT-Spotify
: Play/previous/next/pauseEXT-CanvasLyrics
: Force (or not) full screen lyricsEXT-FreeboxTV
: display FreeboxTV and control it with CH +/-EXT-Pages
: change the page with source- Naturally …
stop
command is available too !
(… More features will be added (again) soon!)
-
Installation
Project_id
You know to remember what is you
project_id
used when you createcredentials.json
file of MMM-GoogleAssistantI create a command line for discover it ! (so don’t have to search ahahah !)
try this in a Terminal:cd ~/MagicMirror/modules/Gateway npm run project
result will be something like this:
~/MagicMirror/modules/Gateway$ npm run project > Gateway@3.X.X project > installer/check_ProjectID.sh Your MMM-GoogleAssistant project_id is: XXXXXXXXX --- Your SmartHome project_id is: credentials not found!
Open a note pad and past your MMM-GoogleAssistant project_id!
Note: Don’t worry about
credentials not found
for SmartHome, we will create it later!It’s time to change default
username
andpassword
ofGateway
configurationwhy ?
You will have access from internet toGateway
so, for security, it’s better to don’t use defaultusername
andpassword
This part will help and replace it by your own !Domaine name with fixed WAN ip address or DynDNS
What’s IP WAN /IP LAN ?
IP WAN
is your ip from Internet
IP LAN
is your device ip from your local network (inside your home)What’s a domain name and a sub-domain ?
a domaine sample it’s like
bugsounet.fr
a sub-domain it’s likeforum.bugsounet.fr
(forum
is the sub-domain)–> If you have a domaine name and an fixed WAN ip address:
create a sub-domaine and redirect it to your WAN ip–> if you have a dyndns domain name, verify if really redirect to your WAN adress
External connect port (from internet)
SmartHome need 2 ports:
80
: for create http server and initialize https protocol443
: for using https protocol with SmartHome and Google SmartHome
Enter inside your router setting and redirect this 2 ports to your raspberry pi LAN ip address
My Sample value used in this wiki
sub-domaine name:
demo.bugsounet.fr
When routing done, check if this is configured correctly
Open the webpage with your
sub-domaine
name (or dyn-dns)
sample:http://demo.bugsounet.fr
(replacedemo.bugsounet.fr
by yours)If works: You must have the
nginx
default page -
Google Actions
Let’s configure google actions!Connect to Google Action Console
Create a new Project
Name it
MMM-GoogleAssisant
(and make it in accord with your language and country)/!\ it must be the same project name like when you create your credentials for
MMM-GoogleAssistant
there… and
Create project
orImport project
Select
Smart Home
… and clickstart Building
-
At this point you have to verify if this project is linked to your
MMM-GoogleAssistant
project IDClose your brower and reconnect to google actions
Select your project
Select 3 dots on the top right
Select Project setting
It’s must match with
npm run project
result (copied in note pad) -
Configure Google Actions
Select
overview
Quick Setup
Select
Name your Smart Home action
Display Name
set it toJarvis
… andSave
Select
Actions
on the leftFulfillment URL
/!\ Replacedemo.bugsounet.fr
by your sub-domaine or dyn-dns addressAdd capabilities
checkSupport local query
… andSave
it !Select
Account linking
on the leftOAuth Client Information
Client ID issued by your Actions to Google
: enter your prefered Client login (as you wish) and note it in your NotePad asClient ID
Client secret
: enter the password used in the config ofGateway
(password field of the Gateway config)
Authorization URL
andToken URL
:
Replace
demo.bugsounet.fr
by your sub-domain or your dyndns addressConfigure your client
:
check this:
… And clickNext
andSave
click on
Deploy
click onDirectory information
Fill in the fieldsDescription
,Images
,contact details
,Privacy and consent
.
When done:Save
itclick on
Company details
on the left
Fill in the fields tooclick on
Release
the last step !
Create anew release
Channel
: choosealpha
Release name
: keep by default
and …Submit
Google Action is now configured !
-
It’s time to reopen your note pad !
You have 2 values:
the first is theproject_id
and the second is the Client IDopen the config of
Gateway
Your have a field namedCLIENT_ID
by default :
CLIENT_ID
is null
replacenull
value by your own value ofClient ID
of the note padsample:
CLIENT_ID: "mypreferedlogin",
-
Let’s configure
HomeGraph
for live update in Google Home App (optional but recommended!)Enable HomeGraph API for your project in the Cloud Platform Console
select the same project as Smarthome !
Enable
HomeGraph
APIMake the same process like this
and searchHomeGraph
and enable itcreate
credentials
Select
API & Services
->Credentials
Create Credentials
Select
Service Account
step 1:
Service account name:Gateway
Service account ID : it’s auto complete… don’t touch it !
Service account description:Gateway
And…
Create and continue
step 2:
Select a role and searchtoken
Note: translatetoken
into your language, for examplejeton
in frenchand select
Service Account Token Creator
click on
Continue
and clickDone
-
Your
credentials
is now reated, let’s download it !DownLoad
credentials
Go back again to
Credentials
Select
Gateway
account inService Account
sectionSelect
KEYS
Click on
ADD KEY
and selectCreate new key
CREATE
the key inJSON
formatThe file will be generated and the download will start automatically
-
Copy credentials to
Gateway
Rename the downloaded file to
credentials.json
and past it to~/MagicMirror/modules/Gateway
directoryWarn: This
credentials
are NOTMMM-GoogleAssistant
credentials !Verify
project_id
ofMMM-GoogleAssistant
andSmarHome
Run again this script:
cd ~/MagicMirror/modules/Gateway/ npm run project
You MUST have same value on each credentials!
Your MMM-GoogleAssistant project_id is: XXXXXX --- Your SmartHome project_id is: XXXXXX
-
Remove registration of
MMM-GoogleAssistant
fromGoogleHome app
If you have an existing
Jarvis
in GoogleHome app: Let’s delete itcd ~/MagicMirror/modules/MMM-GoogleAssistant npm run delete
Note: Don’t worry, we will create it again later !
-
Let’s configure the webserver for
https
usingRequire Warning:
- You have already configured and authorized your router in order to communicate from the internet on ports
80
and443
- MagicMirror² is NOT launched
- For this sample I use
demo.bugsounet.fr
as sub-domaine name !
Try this prepared command:
cd ~/MagicMirror/modules/Gateway npm run smarthome
-
[SMARTHOME]~What is your domain name?~
enter your sub-domaine name sample:demo.bugsounet.fr
-
The prepared command will auto configure
nginx
[SMARTHOME] Router is ready ? [Y/n]
By respondY
: you have prepared your router and installation will continue and installhttps
certificate
**Notes:
- Maybe It can ask you for information to fill in (registration to cerbot)**
- If failed prepared program will inform you, in RED with the reason above !
- You have already configured and authorized your router in order to communicate from the internet on ports
-
It’s time to Start
MagicMirror²
So … start MagicMirror and wait all is initialized !
Verify link of
Gateway
andsmarthome
Test this 2 links and see if it’s ok
Naturally changedemo.bugsounet.fr
by your own !Yeah, You have now access to
Gateway
everywhere in the world ! -
Make a link with
Google Home app
[Under Writing]
-
Make or Remake the link with
MMM-GoogleAssistant
Just try this command:
cd ~/MagicMirror/modules/MMM-GoogleAssistant npm run register
MMM-GoogleAssistant
configurationVerify that deviceRegistred field is set to
true
Restart again your
MagicMirror
Look at your Google Home app
Jarvis
is alive !