Exploring Smart Lighting Automation for Nighttime

I’ve been diving into creating a smart lighting automation for my hallway, and I’d love to share my experiences and seek some advice. The goal is to have one of the IKEA Tradfri LED lights (806lm) turn on for 5 minutes at 20% brightness when the Sonoff motion sensor is triggered, but only during specific times on weekdays and weekends.

Here’s what I’ve tried so far: I set up the automation to activate between 1:26 AM and 6:49 AM on weekdays, and until 9:04 AM on weekends. It worked initially, but after manually dimming the lights a few times, the automation stopped functioning. I’m wondering if manual adjustments interfere with the automation settings or if there’s a way to make it more resilient to manual changes.

I’d also love to hear if others have similar setups and how they handle such scenarios. Any tips on troubleshooting or improving the reliability of the automation would be greatly appreciated! Here’s the YAML configuration I’m using:

yaml
triggers:

  • type: occupied
    device_id: xxxxa9
    entity_id: xxxx8a
    domain: binary_sensor
    trigger: device
    conditions:
  • condition: time
    after: “01:26:00”
    before: “06:49:00”
    weekday:
    • mon
    • tue
    • wed
    • thu
    • fri
  • condition: time
    after: “01:26:00”
    before: “09:04:00”
    weekday:
    • sat
    • sun
      actions:
  • type: turn_on
    device_id: xxxx252
    entity_id: xxxxc46
    domain: light
    brightness_pct: 20
  • delay:
    hours: 0
    minutes: 5
    seconds: 0
    milliseconds: 0
  • type: turn_off
    device_id: xxxx252
    entity_id: xxxxc46
    domain: light
    mode: single

Thanks in advance for any insights or suggestions!