Google home action rest api call
Asked Answered
G

2

6

I am struggling to find how to let google home do a local network rest call.

I have some ESP8266 laying around with mDNS and rest api in them. Now with the google home I want it to send a rest call to the device.

I don't want any web hooks / services like IFTTT. I don't want the communication going through these 3rd party services.

It should work like this google home gets input (google service to understand is oke). It retrieves the action (local network, url rest call with body). Google home sends the rest api call to the local device.

No need to have port forwarding / firewall changes.

Galileo answered 6/11, 2017 at 15:8 Comment(2)
I bet you find out that you can't do that. I hope I'm wrong.Brott
@SamHartman i am also losing hope it can do such simple task as a action.Galileo
E
2

The Google Home does very very little on-device processing. Sending out local network calls is not one of the things it does. Almost all processing, including IoT controls through the Smart Home API, are done through cloud-based services.

Update

I can't answer "why" it doesn't do this, since I'm not one of the engineers that built it, but I can make a lot of guesses about why.

For starters - it increases the complexity of the software and hardware on the device dramatically. Right now, the device is really little more than a microphone and a speaker, with a little logic to detect the hotword and then stream everything else to the server, and then get a result back and play it. Most of the rest of the code is likely to handle setup and configuration.

If the device has to also be a general purpose IoT hub, then it needs software and hardware for Bluetooth and possibly other signaling systems. It needs to be able to keep track of the state of other devices on the network and manage that in between power cycles of the device (or even handle interruptions in power for the device itself). Some of the implications of that may need to open up the networking on the device to receive messages, not just send them. It has to have more extensive network configuration - to understand what local networking is and not just what the local router is and how to deal with that configuration (and that configuration when it changes). These are all possible, to be sure, but increase the complexity and, in some cases, lower the security of a device.

And that might be reasonable... if there was significant value in doing so. But you've already stipulated in the question that the voice processing could be done in the cloud, so once commands are sent to the cloud and parsed there - why not also do all of the above (device and state tracking, changing, etc) in the cloud? Particularly since most IoT devices maintain cloud servers anyway because people also want to be able to control or monitor their home devices when they aren't on their home LAN. Having a dual set of commands (some for when you're local, and some when you're not) does make sense in some cases - but also dramatically increases the complexity of both the controller and devices, so most just rely on the cloud, again.

So while I understand why some people would like to have a nice little system that can just sent your play local REST server a command now and then, the reality is that to do this for a consumer system isn't that reasonable.

If you really wanted a system that can do this - you can continue in the hobbyist spirit and build something with the Assistant SDK and your favorite IoT platform.

Eady answered 6/11, 2017 at 15:10 Comment(2)
why? the only gain is now more companies have the data instead of only google.Galileo
i would like to comment on the 3the alinea and the 4th alinea. the 3th alinea, i don't share your statement. sins it is already connected you only have to state a action wich is the Rest call it self. which url, and which body. via mDNS it doesn't need to know IP stuff. the IOT device itself has these services build in. so it will react. the 4th alinea, it doesn't need to keep track of state, the iot device is doing that, all it had to do is ask the current state and act on the action with the state. no real state machine tracking needed.Galileo
R
1

The “local” API for Google Home is a bit limited. Here’s a doc from someone who reverse-engineered the API.

Looks like they expose Bluetooth and Alarms/Timers, and some limited configuration stuff.

https://rithvikvibhu.github.io/GHLocalApi/

Rapid answered 30/6, 2018 at 20:33 Comment(1)
Anyone interested in this approach should probably also check out: github.com/rithvikvibhu/GHLocalApi/issues/39Romelda

© 2022 - 2024 — McMap. All rights reserved.