0

I created an action which sends notifications to other smart home devices. It is a conversational action, i.e. i did not choose 'Smart Home Control' when creating the action. Now I want to control smart home lights, which are connected to the google account, with this action. For example when I say: "Leave a message for David", a specific light should be switched on with this action.

Is it possible to achieve this? I figured it might only be possible to control smart home gadgets when choosing a 'Smart Home Control' action. Alternatively I thought about sending a command to the google assistant directly (not the action), which says something like: "Switch on LED 1".

Is it anyhow possible to control lights with a normal action? Did I oversee something?

Thank you in advance, Oli

Oli Dev
  • 69
  • 9

1 Answers1

1

That is not an easy task, for sure it is achievable. The steps I see you need to do are:

  1. Implement the oauth flow let you customer log in to your voice application.
  2. In your auth flow you need to authorize yourself the smart home manufactures.
  3. Save the oauth client and smart home auth data per user in a (non public) database.
  4. Create an webhook to fulfill the requests of the user.
rekire
  • 47,260
  • 30
  • 167
  • 264
  • So it is necessary to authorize the 3rd-party producers to the action explicitly although the lights are already connected (and authorized) to the Google account? I can't imagine that this is the easiest. Isn't it possible to send a Google command with "Ok Google, switch in LED 1" from within the Google Action, e.g. by sending a HTTP POST? – Oli Dev Mar 17 '19 at 08:50
  • You could only create your own flow in the Google home app, but that is not what you mean. The communication is more or less one way the actions API will allow you communicate directly but not in his/her intention – rekire Mar 17 '19 at 09:02
  • Could you give me a link for some documentation or examples for your steps 1.-4.? – Oli Dev Mar 17 '19 at 13:52
  • @OliDev which programming language are you using? Maybe even the platform where you plan to host it could change my suggestions – rekire Mar 17 '19 at 14:01
  • A third-party action cannot directly control devices from other third parties. – Nick Felker Mar 17 '19 at 16:44
  • @NickFelker it can control it if you connect yourself to the smart home provider. My answer points the steps out to achieve that. I have implemented that once for a private use case so it is possible, however again it is not trivial and not the simple way as to talk to your google assistant – rekire Mar 17 '19 at 17:24
  • Using NodeJS. I found a acceptable solution. I send a IFTTT webhook trigger from my action. The user can use this to trigger his own ifttt actions if wanted, e.g. connects lights to it or send mails. So I dont need to get any annoying authorization. I will post my solution here as soon as it is finished. Thank you guys! – Oli Dev Mar 18 '19 at 07:52