Presence activated light automation

Hi all!

I am struggling a bit with my automation. I want to turn on lights with two conditions:

  • A certain time frame has to be met
  • I am at home

So for instance, if I am at home between 5pm and 10pm, turn on the lights, if I am not home or it is not in the specified timeframe, the light hast to be turned off.

Right now it looks like this:


 alias: Außenlicht_Geo
description: ""
trigger: []
condition: []
action:
  - choose:
      - conditions:
          - condition: device
            device_id: 2d481213b9031a3cdd777693856a1b86
            domain: device_tracker
            entity_id: 890b5379160a0000328a3ac8dd73153f
            type: is_home
        sequence:
          - type: turn_on
            device_id: 559ff6af1498d25f8270c6335b20eced
            entity_id: ccbcbb085da155099faba3664b7098ca
            domain: switch
      - conditions:
          - condition: device
            device_id: 2d481213b9031a3cdd777693856a1b86
            domain: device_tracker
            entity_id: 890b5379160a0000328a3ac8dd73153f
            type: is_not_home
        sequence:
          - type: turn_off
            device_id: 559ff6af1498d25f8270c6335b20eced
            entity_id: ccbcbb085da155099faba3664b7098ca
            domain: switch
mode: single

If I understand correct my automation is missing a trigger. But what could be the trigger in this case? It is not working with entering a zone or leaving, because sometimes I am already in the zone and there will be no change at all.

Thanks in advance!

BR Luke