1
votes

I am looking for some clarification to how Google Smart Home works. I am looking to integrate my current end device which control lights with Google Smart Home.

My end device is running a very small microcontroller utilizing an RTOS (Linux is not available)

Here is how I see it (Please correct or comment)

  • To my understanding this requires me to host my own cloud service which will talk to my current end device?
  • My cloud service will then talk to Google cloud service.
  • My cloud service defines the protocol to talk to multiple end devices
  • Google Smart Home define the protocol to talk to my cloud service

Questions

  1. Is there any method of doing this without having my own cloud Service?
2
its a bit rubbish that google home devices cannot talk directly to local network endpoints. It would cut out a lot of middleware.nick fox

2 Answers

2
votes

That is a pretty basic summary of things - yes.

The crucial point there is that issuing a command to the Google Home does not have it send out a message on your local network. Google issues any commands from their network - not from your device.

This might seem like a minor detail, but it doesn't need to be a "cloud service" that you control that Google talks to. It does need to be a publicly accessible HTTPS endpoint. This could be a cloud service (and it would be in most cases), a public non-cloud server, or even just a public URL that has a tunnel to your private network (such as with ngrok).

The last is really how you'd get around having your own cloud service - you can setup the control on a local machine, and have a tunnel using ngrok.

1
votes

I think a specific example may be beneficial: here's how to connect Google Home to your devices using an intermediary service like IFTTT:

  1. Create a recipe (applet) on IFTTT to connect Google Assistant to an ngrok tunnel using the Webhook service. This permits you to define a simple keyword phrase that the Google Home will recognize (like "Hey Google turn on my device"). The applet will then call a webhook - e.g. ngrok - with a custom command that you get to define (like "https://myngroktunnel.ngrok.io/Control.cgi?mydevice=on" ), where myngroktunnel is your ngrok tunnel address (see below #2) and Control.cgi is the CGI script that you have placed on your microcontroller (see below #3).

  2. You would need to install and run ngrok on your microcontroller: this will connect the IFTTT applet to your microcontroller via the ngrok tunnel and give you a publicly-accessible URL that forwards requests to your microcontroller. You would typically forward your ngrok tunnel to a specific port on your microcontroller where you are running a web server (e.g. Apache) with CGI scripts to control your device. There are other secure tunnel services available on the web: ngrok is just one of them. So, you do not have to host your own webservice, but you do have to use a tunnel to a publicly-accessible service.

  3. The web server that you have placed on your microcontroller has CGI scripts that control your device (for example, let's say you have a Control.cgi script that turns your device on or off, given a command string like mydevice=on, e.g. the hook in the IFTTT applet is "/Control.cgi?mycommand=on"

Of course, the RTOS on your microcontroller muse be capable of running ngrok and a web server - this is why many people have chosen to use a single-board computer like the Raspberry Pi or Orange Pi running a form of linux to host and control their devices. Since your device's RTOS is not linux, I would suggest getting a linux device which would then forward the request to your RTOS device over your LAN.