Conditional Triggers for Smart Lighting Automation

I’ve been exploring the new Conditional Triggers feature in Rule 5.1, and it’s been a game-changer for my smart home setup! :dart: One of my favorite projects has been automating my kitchen lighting using RGBWW LED strips controlled by an ESPThings Analog controller. The idea was to have the lights switch from a slow rainbow effect to full brightness cold white when motion is detected, ensuring ample lighting when someone enters the kitchen.

Initially, I faced some challenges with the automation setup. I tried using the automation wizard in Home Assistant but found it limited for my specific needs. So, I dove into the YAML configuration, which was a bit daunting at first. I kept getting an error message about malformed data, specifically mentioning extra keys not allowed. After some trial and error, I realized the issue was with how I was structuring the data_template section in my automation.

Here’s the setup that finally worked for me:
yaml
alias: Kitchen Motion Automation
description: Switches kitchen lights to cold white upon motion detection.
trigger:

  • platform: state
    entity_id: binary_sensor.kitchen_pir
    to: ‘on’
    condition:
    action:
  • service: light.turn_on
    target:
    entity_id: light.kitchen_colour_leds
    data:
    effect: ‘None’
    rgbww_color: [0, 0, 0, 255, 0]
    brightness: 255

This automation now seamlessly switches the lights to cold white when motion is detected, providing clear visibility while maintaining an energy-efficient setup. The integration with the ESPThings controller was crucial, as it allowed me to precisely control the RGBWW channels and effects.

I’d love to hear if anyone has similar setups or tips for optimizing motion-based lighting automation! :rocket: