Google assistant commands use

Hi,

If I use Google Nest to switch off some lights, I see this in the log:

licht.eh.kast.l is uitgeschakeld getriggerd door Google Assistant sent command OnOff (via local)

So how can I use the GA action to trigger other automations?

Thanks in advance!

I believe you need to listen to the state_changed event and look at the entity and the context.

I just tried to turn on one of our lights with GH and this is the state changed event for that event:

{
    "event_type": "state_changed",
    "data": {
        "entity_id": "light.sonoff_1000cb7905",
        "old_state": {
            "entity_id": "light.sonoff_1000cb7905",
            "state": "off",
            "attributes": {
                "effect_list": [
                    "Colorful",
                    "Colorful Gradient",
                    "Colorful Breath",
                    "DIY Gradient",
                    "DIY Pulse",
                    "DIY Breath",
                    "DIY Strobe",
                    "RGB Gradient",
                    "DIY Gradient",
                    "RGB Breath",
                    "RGB Strobe",
                    "Music"
                ],
                "supported_color_modes": [
                    "hs"
                ],
                "manufacturer": "SONOFF",
                "model": "L1",
                "sw_version": "PSF-BTA-GL v2.9.1",
                "cloud": "online",
                "rssi": -21,
                "friendly_name": "Tavlan",
                "supported_features": 21,
                "templates": {
                    "icon": "mdi:image-frame"
                }
            },
            "last_changed": "2022-06-14T20:46:02.741882+00:00",
            "last_updated": "2022-06-14T20:46:02.741882+00:00",
            "context": {
                "id": "78273708839b51f2a596c459cc37a9cb",
                "parent_id": "e9cf397b4add099013d6f48c0078b804",
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "light.sonoff_1000cb7905",
            "state": "on",
            "attributes": {
                "effect_list": [
                    "Colorful",
                    "Colorful Gradient",
                    "Colorful Breath",
                    "DIY Gradient",
                    "DIY Pulse",
                    "DIY Breath",
                    "DIY Strobe",
                    "RGB Gradient",
                    "DIY Gradient",
                    "RGB Breath",
                    "RGB Strobe",
                    "Music"
                ],
                "supported_color_modes": [
                    "hs"
                ],
                "color_mode": "hs",
                "brightness": 255,
                "hs_color": [
                    29.032,
                    100
                ],
                "rgb_color": [
                    255,
                    123,
                    0
                ],
                "xy_color": [
                    0.617,
                    0.37
                ],
                "effect": "Colorful",
                "manufacturer": "SONOFF",
                "model": "L1",
                "sw_version": "PSF-BTA-GL v2.9.1",
                "cloud": "online",
                "rssi": -21,
                "friendly_name": "Tavlan",
                "supported_features": 21,
                "templates": {
                    "icon": "mdi:image-frame"
                }
            },
            "last_changed": "2022-06-15T12:34:15.796455+00:00",
            "last_updated": "2022-06-15T12:34:15.796455+00:00",
            "context": {
                "id": "b20320135304803cf6f3b6c10d1fbc03",
                "parent_id": null,
                "user_id": "9a2b0a52bd8342fcb96f6df6a128a04c"
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2022-06-15T12:34:15.796455+00:00",
    "context": {
        "id": "b20320135304803cf6f3b6c10d1fbc03",
        "parent_id": null,
        "user_id": "9a2b0a52bd8342fcb96f6df6a128a04c"
    }
}

Alright, I’ll see what I can do with this. Thanks

I’ve made a few HA helpers that are exposed to Google Assistant that as such can be triggered by a GA command. For example a toggle if the house is in nightmode on/off and exposed it to GA. Allowing GA to switch the helper toggle and HA to act on that again. The same I think can be done with scenes.

Ofc. any change GA makes to a smart-device you can continue on. Like a light turned on/off.