Overriding motion sensor with timed automation

Hi folks. I realise these are questions that have been asked many times - and I have done my reading, I swear! - but there are a lot of topics, some going back many years, with very different approaches, and I’m struggling to get my head around the “right” (or at least “a good”) way to do this.

I am just experimenting with adding motion sensors to my lights. My setup is Zigbee throughout, mostly through a ConbeeII and DeConz, but I also have a Tradfri hub with a few devices still attached to it.

My upstairs landing light (“Landing”) is connected to the Conbee, and is in a native DeConz group with a Tradfri motion sensor.

What I want:

  • the landing light to come on with motion control (this works automatically via the DeConz group).
  • at “Bedtime” (this could either be a set time, or triggered by an automation, either is fine), the landing light should come on at 20% and stay on.
  • (Possibly - brightness should increase to 50% when motion is detected, then drop again when motion timeout reached)
  • at 9am, switch back to “daytime” mode - off by default, on with motion sensor.

I’d really appreciate some tips as to how to go about this.

I’ve tried time and sun triggered automations to turn it on, but I think it just turns off again because no motion.

Currently it comes on with the motion sensor, but goes off entirely without, which leaves my kids stumbling around in the dark if they wake up in the night/come in to our bed (which happens most nights) - no good.

Do I need to ditch the native group and automate the whole thing explicitly in HA?

Have you looked at Entity Controller in HACS? It’s designed for this sort of thing.

I have motion sensors for several rooms. When I run my robot vacuum I need to keep the lights on. Here is what I did.

First I created an input boolean:

In configuration.yaml

input_boolean: !include input_boolean.yaml

in input_boolean.yaml

 vacuum:
  name: Vacuum Active
  icon: mdi:robot-vacuum
  initial: false

Tnen in my automations I added a condition

alias: Study Lights Off via Motion
description: Control Study Lights with Shelly Motion Detection
trigger:
  - platform: state
    entity_id: binary_sensor.shellymotionsensor_60a423c66d96_motion
    to: 'off'
    for:
      hours: 0
      minutes: 3
      seconds: 0
      milliseconds: 0
condition:
  - condition: state
    entity_id: input_boolean.vacuum
    state: 'off'
action:
  - service: light.turn_off
    target:
      entity_id: light.study_cans_current_value
mode: single

I create an action in my automation for the vacuum to turn on and off the boolean.