- alias: Vacation Mode - Stop ved slutdato
  trigger:
    - platform: time_pattern
      minutes: "/1"

  condition:
    - condition: state
      entity_id: input_boolean.vacation_mode
      state: "on"

    - condition: template
      value_template: >
        {% set dt = states('input_datetime.vacation_end') %}
        {{ dt not in ['unknown','unavailable',''] and
           now() >= as_datetime(dt) }}

  action:
    - service: input_boolean.turn_off
      target:
        entity_id:
          - input_boolean.vacation_mode
          - input_boolean.presence_simulation

    - service: media_player.media_stop
      target:
        entity_id:
          - media_player.kokken
