0

I'm trying to develop an Android app that can request the smart devices connected to a google home account, check the state of those devices and change some of them, like turn on or off, is this possible programmatically?

i was trying to build some custom Actions with Google Actions SDK, the problem is that Actions SDK only works with Google Assistant commands, so either Actions o Dialogflow are not options

Basically what i need is to "control" or send commands programmatically to query devices states and be able to change those states(i just need to turn on or off)

Andres Rodriguez
  • 209
  • 1
  • 6
  • 13

2 Answers2

0

No there is no API for a third-party developer to get access to a user's devices from a different provider.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • what about the **smart home nodejs** sample from **Google Actions**? i'm building it right now, but i don't know how far can i take that sample to work as i need [SmartHomeNodejs Sample](https://github.com/actions-on-google/smart-home-nodejs#steps-for-testing-with-google-assistant) – Andres Rodriguez Jun 06 '19 at 07:14
  • With the smart home sample, you can see the devices that you've set up in that project only. You have no access to devices from other projects/companies. – Nick Felker Jun 06 '19 at 13:38
  • my situation is this, i have a smart switch and a google home device, both linked with my google account, i already build a firebase project, build the fulfillments, setup the account linking on actions and i want to check what devices are in my account using the api of homegraph here [Request Sync docs](https://developers.google.com/actions/smarthome/develop/request-sync), but how can i link my devices with a agentuserid with a first time sync? with a command on google home maybe? to sync devices with a particular id? – Andres Rodriguez Jun 10 '19 at 08:26
  • Linking in your firebase project? Linking to the Google account? – Nick Felker Jun 10 '19 at 14:54
  • i have my google account, i setup my smart switch with my google account in Google Home, now what i would like to do as developer NOT provider is check the devices linked to my google account programmatically or using a service, not using google home, and maybe if is possible change the state of the switch, that's it @nick-felker – Andres Rodriguez Jun 11 '19 at 06:19
  • 1
    You can't check all of the devices linked to a Google account. – Nick Felker Jun 11 '19 at 13:41
  • a perfectly straight answer, that's what i was looking for, how about send a text command maybe in a POST or something to Google Assistant linked to my Google account? could it trigger my device? – Andres Rodriguez Jun 11 '19 at 13:46
  • 1
    You could send a text command to the Google Assistant logged in as you, but that would be a virtual Google Assistant surface and not a local Google Home. It also wouldn't be able to return a structured list of your devices or states. – Nick Felker Jun 11 '19 at 13:50
0

You can use Dialogflow for this! If you create intents, you find at the bottom of the page an option "Fulfillment Enable webook call for this intent". I routed the intents to a PHP script on my web space. The server must be a server in the Internet (not the local net of your Google-Home) and must be accessible via HTTPS. Basically you get the parameter as JSON and you have to answer with JSON structured data.

Update: I uploaded my code https://github.com/Limag/aiplayer

Limag
  • 23
  • 5
  • but how do you get the devices linked in google home? so you can answer then with those devices, i have a smart switch and i register it on google home, now i would like to programmatically in my server check the state of my linked devices – Andres Rodriguez Jun 10 '19 at 10:58
  • First, devices can only respond to Google Home and never start the interaction by itself (I afraid). The link between Google Home and your device happens is the, so called, Fulfillment request. In my example PHP code on a self hosted web space. – Limag Jun 16 '19 at 12:28