I’ve been working on a smart lighting setup for my living room and wanted to share my journey in case it helps anyone else. The goal was to automate the lights based on motion detection, but I also wanted Alexa integration to work seamlessly. Here’s how I tackled it!
Initially, I set up an automation using a remote control and motion sensors. Everything worked well when I used the remote—turning the lights on or off triggered the automation correctly. However, when I tried controlling the lights via Alexa, the automation didn’t recognize the changes. After some research, I found that using an Event Trigger could bridge this gap.
I configured the Event Trigger to monitor both the remote control state and Alexa commands. The key was ensuring that the trigger only reacted to changes in the specific light group in the living room. I struggled a bit with the syntax at first, but breaking it down step by step helped.
Here’s the setup I ended up with:
yaml
trigger:
- platform: state
entity_id: input_boolean.living_room_night
from: null
to: ‘off’ - platform: event
event_type: alexa_smart_home
event_data:
request:
namespace: Alexa.PowerController
condition: - ‘>-
{{ trigger.id == ‘device’ or trigger.event.data.request.name == ‘TurnOff’ or trigger.event.data.entity_id == ‘light.living_room_lighting’ }}’
action: - service: automation.turn_off
data:
stop_actions: true
target:
entity_id: automation.living_room_automation
mode: single
This configuration ensures that the automation only activates when the specific light group is targeted, whether through the remote or Alexa. It took some tweaking, but now everything works like clockwork!
If anyone else is struggling with similar automation issues, I’d recommend starting with simple triggers and gradually adding conditions. Testing each part individually before combining them also helps in troubleshooting. Happy automating! ![]()