phillip1
(Phillip)
September 15, 2023, 8:26am
1
Inside the home assistant logs, there is information that a state change was triggered “by Google Assistant sent command OnOff” as depicted below.
How do you access this from within an automation whose trigger is a state change (or event perhaps)?
When looking in the automation’s logs’ changed variables section, there was nothing resembling the “trigger by” data so I’m hoping it’s even possible.
This is how you detect it with Alexa … I guess google will also have events?
alias: Alexa - Living Room White
description: ""
trigger:
- platform: event
event_type: alexa_smart_home
event_data:
request:
namespace: Alexa.PowerController
name: TurnOn
entity_id: light.living_room_lights
condition: []
action:
- service: mqtt.publish
data:
qos: "2"
retain: false
payload: >-
{ "color": { "r": 255, "g": 255, "b": 255 },
"brightness": 1 }
topic: zigbee2mqtt/Living Room Lights/set
- service: mqtt.publish
data:
qos: "2"
retain: false
payload: >-
{ "color": { "r": 255, "g": 255, "b": 255 },
"brightness": 1 }
topic: zigbee2mqtt/Living Room Spots/set
- service: light.turn_on
data:
rgb_color:
- 255
- 255
- 255
brightness: 0
target:
entity_id: light.tasmota_uplighter
- service: script.living_room_lights_white_50
data: {}
mode: single
This automation detects Alexa turning on the lights and then makes sure they are all set to white to override whatever settings they may have been on previously.