Help with light automation with motion

Hi I’ve just started using home assistant after taking the leap from SmartThings and would like to do something like Reed has done in webcore (i originally had this working using web core but I cannot for the love of money work out how to do it in HA.

I would like the lights in the room to stay on for 10 seconds if motion was less than a minute and on for 5 mins if morion was detected for more than 1 minute.

Can someone please help a complete Noob?

Video in question below.

Thanks

Robb

Let simplify with 2 automations - you can combine with trigger id

The on is simple but you will need a Timer helper.

Here is how I envision it working

Trigger - Motion goes from off to on
Condition - Light is off
Action - Turn on light(s)
Action - Set Timer to 61 seconds

Trigger - Motion goes from on to off
Condition - Light is on
Action - Choose
Condition - Timer is idle
Action - delay 300 seconds
Action - Turn off light(s)
Condition - Default
Action delay 10 seconds
Action - Turn off light(s)

You can create all of this from the UI.

Does this get you to where you want to be?

Edit - I built all of this from the UI and copied the yaml.

alias: turn on light
description: ''
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.shellymotionsensor_60a423c66d96_motion
    from: 'off'
    to: 'on'
condition:
  - condition: state
    entity_id: light.study_cans_current_value
    state: 'off'
action:
  - service: light.turn_on
    target:
      entity_id: light.study_cans_current_value
    data:
      brightness_pct: 98
- service: timer.start
    data:
      duration: '61'
    target:
      entity_id: timer.mechanicalroom_timer

alias: turn off light
description: ''
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.shellymotionsensor_60a423c66d96_motion
    to: 'off'
    from: 'on'
condition:
  - condition: state
    entity_id: light.study_cans_current_value
    state: 'on'
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: timer.mechanicalroom_timer
            state: 'idle'
        sequence:
          - delay:
              hours: 0
              minutes: 0
              seconds: 60
              milliseconds: 0
          - service: light.turn_off
            target:
              entity_id: light.study_cans_current_value
    default:
      - delay:
          hours: 0
          minutes: 0
          seconds: 10
          milliseconds: 0
      - service: light.turn_off
        target:
          entity_id: light.study_cans_current_value
1 Like

That’s fantastic. Let me try and I’ll let you know.

That seemed to work a treat. Thanks :grinning: