Automation : Failure on front-porch lights when motion OR Door open

Hi all,

I’m struggling with the automation where I would like to:

Turn lights on in front-yard when there is motion and lux_low is true + turn lights off after 3 mintues
Turn lights on in front-yard when front-door is open and lux_low is true + turn lights off after 3 minutes

I have two automations configured:

- alias: Voortuin lights when dark and motion
  description: ''
  trigger:
   - type: state
     entity_id: binary_sensor.hue_outdoor_motion_sensor_1_motion
     state: 'on'
  condition:
   - type: state
     entity_id: sensor.lowlux_outside
     state: 'True'
  action:
   - service: light.turn_on
     data:
       entity_id: group.voortuin_lights
   - delay: 00:03:00
   - service: light.turn_off
     data:
       entity_id: group.voortuin_lights

and second automation:

- alias: Voordeur lights
  description: ''
  trigger:
   - platform: state
     entity_id: binary_sensor.openclose_34
     from: 'off'
     to: 'on'
  condition:
   - type: state
     entity_id: sensor.lowlux_outside
     state: 'True'
  action:
   - service: light.turn_on
     data: 
       entity_id: group.voortuin_lights
   - delay: 00:02:00
   - service: light.turn_off
     data:
      entity_id: group.voortuin_lights

Does anyone see the mistake ? Automations are not working

Thanks very much in advance !

Kind regards,

Bart

1 Like

- type: state should be - platform: state plus many more errors like that.

Try this:

- alias: Voortuin lights when dark and motion or door open
  description: ''
  trigger:
    - platform: state
      entity_id: binary_sensor.hue_outdoor_motion_sensor_1_motion
      from: 'off'
      to: 'on'
    - platform: state
      entity_id: binary_sensor.openclose_34
      from: 'off'
      to: 'on'
  condition:
    - condition: state
      entity_id: sensor.lowlux_outside
      state: 'True'  # this is possibly `true` instead, check developer tools states
  action:
    - service: light.turn_on
      target:
        entity_id: group.voortuin_lights
- alias: Voortuin lights off when no motion or door closed for 3 minutes
  description: ''
  trigger:
    - platform: state
      entity_id: binary_sensor.hue_outdoor_motion_sensor_1_motion
      to: 'off'
      for:
        minutes: 3
    - platform: state
      entity_id: binary_sensor.openclose_34 # you may or may not want this
      to: 'off'
      for:
        minutes: 3
  action:
    - service: light.turn_off
      target:
        entity_id: group.voortuin_lights
1 Like

Wow, such a fast answer. you enlightened my day with the new logic. I changed the config and will let you know !

Thanks a lot !!!

Kr,

Bart