House Light Automation

Hi

I have had the house lights on a schedule which has been working for a long time, now i have added a motion sensor which i dont want the lights to go off if there is still motion in a certain area but once that has cleared after certain amount of time switch them off almost like start the trigger again.
I added the motion which stopped the lights going off

Setup(I have set the clear motion timer to 30 seconds that was for testing so its quick)

platform: state
entity_id:

  • schedule.house_lights_on
    id: House Light Schedule Off
    to: “off”

if:

  • condition: trigger
    id:
    • House Light Schedule Off
  • condition: and
    conditions:
    • condition: state
      entity_id: schedule.house_lights_on
      state: “off”
    • condition: state
      entity_id: binary_sensor.living_room_epl_occupancy
      state: “off”
      for:
      hours: 0
      minutes: 0
      seconds: 30
      then:
  • service: light.turn_off
    target:
    entity_id: light.group_house_lights
    data: {}

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16