Home Assistant Cloud / Google Assistant entities

I’m looking at moving some of my HA automations into appdaemon and have a question. I can have entries defined in scripts.yaml show up as Google Assistant entities so they can be triggered by voice commands.

How can I trigger an entry in apps.yaml from Google Assistant? FYI, I’m using the HA Cloud integration with Assistant.

Thanks!

What do you mean with trigger an entry in apps.yaml from Google Assistant? What exactly do you want to do with AppDaemon, can you give an specific example?

The standard example would be a “Good Night” routine. I’d like to say “Hey Google, good night” and have it trigger a good-night-app in appdaemon. This would do things like turn off lights, lock the doors, etc. Registering devices and scripts from HA seem to automatically show up as Google Assistant entities, but my appdaemon apps are not.

It doesn’t work this way. You can’t trigger AppDaemon apps from Home Assistant and your apps will also not show up in Home Assistant.

It’s certainly possible to do what you want in AppDaemon, however from the example you provided it seems easier to do in Home Assistant.
Wouldn’t it be easier to create a scene in Home Assistant that does all this (turn off lights, lock doors, etc.) and trigger the scene when you say “Hey Google, good night”?

It’s certainly possible and I already have some set up in HA. I was hoping to move these into appdaemon so I could have all my automations in one place. I also like that appdaemon is decoupled from the core HA and I don’t have to restart services when I make changes.

I suppose I can do a hack like have GA change the state of an input_boolean and use that to trigger an app in appdaemon. Not the cleanest approach but it should work.

Ok understand. Seems like your approach with an input_boolean is the only option. I don’t think that google assistant fires an event in home assistant when you give it a command.

I do it with events. You still need to have a small script that fires the event and expose it to Google Assistant.

good_night:
  sequence:
    - event: GOOD_NIGHT

And them from AppDaemon:

self.listen_event(self.good_night, "GOOD_NIGHT")
2 Likes

I use the same approach @spasche uses and it works well for me. The input_boolean method works fine too, and, in some cases is better. For instance, if you want to make sure the app doesn’t do its job twice at the same time, with the last task of the app being to turn the input_boolean back off.