Driveway Light wont turn off, two seperate automations fail

Hello,

I like to accomplice the following scenario,
When leaving the house in the evening the driveway light turns on at 10:30 pm (22:30) hrs.

The light turns off:

a) automatically one and a half hours later, after turning on.

or

b) when I close the garage door and it stays closed for 3 minutes.

I made 3 automatons with the automation editor.

first:
Turning the driveway light on automatically at 10.30 pm (22:30) hrs. This works.

but the following scenarios to turn off the light dont/wont work.

Both are made with the automation editor and my automations.yaml contains the following,
the first : turn off after one and a half hours.

- id: '1630592729562'
  alias: Lamp Oprit Uitschakelen na anderhalf uur
  description: ''
  trigger:
  - platform: device
    type: turned_on
    device_id: 4661c36a185d3e51cddc051cd42e72b8
    entity_id: light.lamp_oprit
    domain: light
    id: LampOpritAan
    for:
      hours: 1
      minutes: 30
      seconds: 0
      milliseconds: 0
  condition: []
  action:
  - service: light.turn_off
    target:
      device_id: 4661c36a185d3e51cddc051cd42e72b8
    data:
      transition: 10
  mode: single

and the second: turn off after i close the garage door and it stays closed for 3 minutes

- id: '1630593035151'
  alias: Oprit Lamp Uit Indien Garagedeur Gesloten Wordt
  description: ''
  trigger:
  - type: not_opened
    platform: device
    device_id: ebaeed44033ef1f48369c986da97940e
    entity_id: binary_sensor.deur_garage
    domain: binary_sensor
    id: GarageDeurDicht
    for:
      hours: 0
      minutes: 3
      seconds: 0
      milliseconds: 0
  condition: []
  action:
  - service: light.turn_off
    target:
      device_id: 4661c36a185d3e51cddc051cd42e72b8
    data:
      transition: 10
  mode: single

none of them are working and i am a bit puzzled why…

Any help would be appreciated, thanks in advance,

Regards Frank

I would suggest to make 1 automation and just put delay between on action and off action.
Trigger use time
And test it.

Try this to combine all 3 automations-

trigger:
  - platform: time
    at: '22:30'
  - platform: time
    at: '00:00'
  - platform: state
    entity_id: binary_sensor.deur_garage
    to: 'off'
    for: '00:03:00'
action:
  - choose:
      - conditions: "{{ trigger.platform == 'time' }}"
        sequence:
          - service: >-
              light.turn_{{'on' if now().hour == 22 else 'off' }}
            target:
              entity_id: light.lamp_oprit
      - conditions:
          - "{{ trigger.to_state.state == 'off' and (22,30) <= (now().hour,now().minute) < (23,59) }}"
        sequence: 
          - service: light.turn_off
            target:
              entity_id: light.lamp_oprit

In an effort to help you find the problem (and not suggesting you make other automations instead :wink:) to help you learn to troubleshoot let’s try some other things first.

  1. try to run the actions of both automations. find the automations in the states page of dev tools and select the automations and in the pop up box for each click “run actions” (be sure the desired light is actually on first. Did the light turn off? If not then you have a problem in the action section. if yes then the trigger is the issue.

  2. check the automation trace to see which part failed. go to configuration-> automations and find the automations in there and click the trace icon on the right. You will see a trace of the times the automation ran and it will show you where it failed. the traces get cleared when HA restarts or you reload automations so you may have to wait till it should have run the actions again before you see anything there.

  3. it gets harder from here because I don’t use the automation editor. let me know the results of the first two items above and I can go from there

1 Like

thnx guys for a solution and a method to find the problem.

Regards
Frank