Search code examples
dialogflow-esactions-on-googledialogflow-es-fulfillmentgoogle-smart-home

Set Lights from google action


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


Solution

  • 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.