- id: '1698524075327'
  alias: light spot when motion
  description: ''
  trigger:
  - type: turned_on
    platform: device
    device_id: 80ecd4d9a212d4bc811d958b336ccec0
    entity_id: 390b057edde8e3a7ce5dd96fbc8f7486
    domain: binary_sensor
  condition:
  - condition: state
    entity_id: binary_sensor.g5_flex_is_dark
    state: 'on'
  action:
  - service: light.turn_on
    data:
      color_temp: 359
      brightness_pct: 100
    target:
      entity_id: light.garage_spot
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.garage_spot
  mode: single
- id: '1700687177645'
  alias: Handle_motorvärmare
  description: ''
  triggers:
  - at: input_datetime.motorvarmare_start
    trigger: time
  conditions:
  - condition: state
    entity_id: input_boolean.motorvarmare_toogle
    state: 'on'
  actions:
  - data: {}
    action: switch.turn_on
    target:
      entity_id: switch.nodeid_22_nodeid_22_switch
  - delay: 02:00:00
  - data: {}
    action: switch.turn_off
    target:
      entity_id: switch.nodeid_22_nodeid_22_switch
  mode: single
- id: '1700693056778'
  alias: motorvärmare 2h
  description: motorvärmare i 2h
  trigger:
  - platform: state
    entity_id:
    - switch.nodeid_22_switch
    from: 'off'
    to: 'on'
    for:
      minutes: 120
  condition: []
  action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.nodeid_22_switch
  mode: single
- id: '1703971688590'
  alias: Lampa trappa dag
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.h007m_occupancy
    to: 'on'
  condition:
  - condition: or
    conditions:
    - condition: time
      after: '16:00:00'
      before: '22:30:00'
    - condition: time
      after: 08:00:00
      before: '11:00:00'
  action:
  - service: light.turn_on
    data:
      brightness_pct: 52
      kelvin: 2900
    target:
      device_id: ad8c90d56d6753ae960fe61560f1de66
  - delay:
      hours: 0
      minutes: 20
      seconds: 0
      milliseconds: 0
  - service: light.turn_off
    data: {}
    target:
      device_id: ad8c90d56d6753ae960fe61560f1de66
  mode: single
- id: '1704919949019'
  alias: Update Jaffa location as MQTT location updates
  description: ''
  trigger:
  - platform: mqtt
    topic: weconnect/0/vehicles/WVGZZZE2ZPE051949/parking/parkingPosition/latitude
  - platform: mqtt
    topic: weconnect/0/vehicles/WVGZZZE2ZPE051949/parking/parkingPosition/longitude
  condition: []
  action:
  - service: device_tracker.see
    data:
      dev_id: jaffa_location
      source_type: gps
      gps:
      - '{{ states.sensor.none_jaffa_lat.state }}'
      - '{{ states.sensor.none_jaffa_long.state }}'
  initial_state: 'on'
- id: '1706989035065'
  alias: Lampa trappa natt
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.h007m_occupancy
    to: 'on'
  condition:
  - condition: time
    after: '22:30:00'
    before: 08:00:00
  action:
  - service: light.turn_on
    data:
      brightness_pct: 7
    target:
      device_id: ad8c90d56d6753ae960fe61560f1de66
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - service: light.turn_off
    data: {}
    target:
      device_id: ad8c90d56d6753ae960fe61560f1de66
  mode: single
- id: '1707166664479'
  alias: 'Oscar tts '
  description: 'Spelar upp en text på Oscars högtalare '
  trigger:
  - platform: state
    entity_id:
    - input_text.tts_syntesiser
  condition: []
  action:
  - service: tts.edge_tts_say
    metadata: {}
    data:
      cache: false
      entity_id: media_player.oscar
      language: sv_SE
      message: '{{ states(''input_text.tts_syntesiser'') }}'
    enabled: false
  - service: tts.edge_tts_say
    metadata: {}
    data:
      entity_id: media_player.oscar
      message: 'Hej '
  mode: single
- id: '1709494545609'
  alias: växtlampa schema
  trigger:
  - platform: template
    value_template: '{{ now().hour == 7  }}'
    id: 'on'
  - platform: template
    value_template: '{{ (now().hour, now().minute) == (21,30)  }}'
    id: 'off'
  action:
  - service: light.turn_{{ trigger.id }}
    target:
      entity_id: light.vaxtlampa
- id: '1713552723716'
  alias: Automation_oscar_skrivbord
  description: ''
  trigger:
  - platform: event
    event_type: button_pressed
    event_data:
      entity_id: switch.oscar_skrivbord
      state: 'off'
    id: 'off'
  - platform: event
    event_type: button_pressed
    event_data:
      entity_id: switch.oscar_skrivbord
      state: 'on'
    id: 'on'
  condition: []
  action:
  - service: light.turn_{{ trigger.id }}
    target:
      entity_id: light.oscar_skrivbord
    data: {}
  - service: switch.turn_{{ trigger.id }}
    metadata: {}
    data: {}
    target:
      entity_id: switch.nodeid_13_nodeid_13_switch
  mode: single
- id: '1713555224562'
  alias: Automation_oscar_moln
  description: ''
  trigger:
  - platform: event
    event_type: button_pressed
    event_data:
      entity_id: switch.oscar_skrivbord
      state: 'off'
    id: 'off'
  - platform: event
    event_type: button_pressed
    event_data:
      entity_id: switch.oscar_skrivbord
      state: 'on'
    id: 'on'
  condition: []
  action:
  - service: switch.turn_{{ trigger.id }}
    metadata: {}
    data: {}
    target:
      entity_id: switch.nodeid_7_nodeid_7_switch
  mode: single
- id: '1715369564640'
  alias: Bevattning 20 min
  description: ''
  trigger:
  - platform: sun
    event: sunrise
    offset: 0
  condition: []
  action:
  - type: turn_on
    device_id: ee19c0deed59d2a266b59c30dbf7ccaa
    entity_id: 068c418ccf17f83fe236590673ce7c1f
    domain: switch
  - delay:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: ee19c0deed59d2a266b59c30dbf7ccaa
    entity_id: 068c418ccf17f83fe236590673ce7c1f
    domain: switch
  mode: single
- id: '1715979338256'
  alias: Nattnotis
  description: ''
  trigger:
  - platform: state
    entity_id:
    - scene.natt
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.jaffa_locked
      state: 'on'
    - condition: state
      entity_id: lock.h014s
      state: unlocked
    - condition: state
      entity_id: binary_sensor.sensor_inne_tvattstuga_dt002_contact
      state: 'on'
    - condition: state
      entity_id: binary_sensor.sensor_inne_arum_dt003_contact
      state: 'on'
  action:
  - service: notify.mobile_app_simon_mobil
    metadata: {}
    data:
      title: Kolla lås.
      message: "**Natt-scen aktiverad!**  * Jaffadörren: {{ states('binary_sensor.jaffa_locked').state
        }} * Tvättstuga: {{ states('binary_sensor.sensor_inne_tvattstuga_dt002_contact').state
        }} * Arbetsrum: {{ states('binary_sensor.sensor_inne_arum_dt003_contact').state
        }} \n"
  mode: single
- id: '1723749734599'
  alias: Kväll_on_off
  description: ''
  triggers:
  - event: sunset
    offset: 00:30:00
    trigger: sun
  - at: '19:30:00'
    id: time_on
    trigger: time
  - at: '23:15:00'
    id: time_off
    trigger: time
  conditions: []
  actions:
  - data:
      entity_id: '{{ ''scene.kvalls_belysning'' if now().hour < 23 else ''scene.natt''
        }}

        '
    action: scene.turn_on
- id: '1723751411352'
  alias: ute_av_på
  description: ''
  triggers:
  - event: sunrise
    offset: -00:15:00
    trigger: sun
  - event: sunset
    offset: 00:15:00
    trigger: sun
  - at: 07:55:00
    trigger: time
  conditions: []
  actions:
  - data:
      entity_id: '{{ ''scene.ute'' if trigger.event == ''sunset'' else ''scene.ute_av''
        }}

        '
    action: scene.turn_on
  mode: single
- id: '1725646259613'
  alias: Kök på 5 min
  description: ''
  trigger:
  - platform: state
    entity_id:
    - light.kok_ct
    to: 'on'
  condition: []
  action:
  - entity_id: script.kok_ct_timer_2
    action: script.turn_on
  mode: restart
- id: '1729969302596'
  alias: Tänd och släck vrum upp vid helgmorgon
  description: Tänder lampan kl 06:00 och släcker den kl 07:30 på lördagar och söndagar
  triggers:
  - at: 06:00:00
    trigger: time
  - at: 07:30:00
    trigger: time
  conditions:
  - condition: time
    weekday:
    - sat
    - sun
  actions:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ trigger.platform == ''time'' and trigger.now.strftime(''%H:%M:%S'')
          == ''06:00:00'' }}'
      sequence:
      - data:
          brightness_pct: 9
        target:
          device_id: 79ba72943d4ed67fa5dc4fdbfe4fa54d
        action: light.turn_on
    - conditions:
      - condition: template
        value_template: '{{ trigger.platform == ''time'' and trigger.now.strftime(''%H:%M:%S'')
          == ''07:30:00'' }}'
      sequence:
      - target:
          device_id: 79ba72943d4ed67fa5dc4fdbfe4fa54d
        action: light.turn_off
        data: {}
      - action: switch.turn_off
        metadata: {}
        data: {}
        target:
          device_id: d93a6c62e11bec4c4d480497363d4512
  mode: single
- id: '1731354729078'
  alias: Tänd garage
  description: ''
  triggers:
  - type: occupied
    device_id: 0c06d34c097db550f6339bdf16b8b408
    entity_id: c03b9e6b324f34b4ff4dc523b49ed991
    domain: binary_sensor
    trigger: device
  - trigger: state
    entity_id:
    - binary_sensor.sensor_inne_garage_m001_occupancy
    to: 'on'
  conditions: []
  actions:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      device_id: f5781cfa34b2e0a238f6f6333e7d7fa2
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.nodeid_16_nodeid_16_switch
  - delay:
      minutes: 5
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      device_id: f5781cfa34b2e0a238f6f6333e7d7fa2
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.nodeid_16_nodeid_16_switch
  mode: single
- id: '1731870335988'
  alias: Lampa, byt slinga mot fasad
  description: ''
  triggers:
  - at: '23:15:00'
    trigger: time
  - at: 06:00:00
    trigger: time
  conditions: []
  actions:
  - choose:
    - conditions:
      - condition: time
        before: 06:00:00
      sequence:
      - action: switch.turn_off
        data: {}
        target:
          entity_id: switch.h024s
      - target:
          entity_id: switch.h015l
        action: switch.turn_on
        data: {}
    - conditions:
      - condition: time
        after: 05:59:59
      sequence:
      - action: switch.toggle
        data: {}
        target:
          entity_id: switch.h024s
      - target:
          entity_id: switch.h015l
        action: switch.toggle
        data: {}
  mode: single
- id: '1733170240917'
  alias: 'Jul belysning '
  description: ''
  triggers:
  - value_template: '{{ now().hour == 16  }}'
    id: 'on'
    trigger: template
  - value_template: '{{ (now().hour) == 8 }}'
    id: 'off'
    trigger: template
  actions:
  - target:
      entity_id: group.jul_group
    action: homeassistant.turn_{{ trigger.id }}
- id: '1735463627194'
  alias: Ada släck 0800
  description: ''
  triggers:
  - trigger: time
    at: 08:00:00
  conditions: []
  actions:
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: light.ada_jordglob2
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.ada_slnga
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      device_id: 069299a3de0a369de40dd512292a2828
  mode: single
- id: '1740430707464'
  alias: Sov gott Oscar när sleep timer är 0
  description: ''
  triggers:
  - entity_id: sensor.sonos_sleep_timer
    to: '0'
    trigger: state
  actions:
  - action: script.talk_on_oscar
    data:
      message: Sov Gott Oscar! Dags att sova
  mode: single
- id: '1741036830396'
  alias: 'Reser temp '
  description: ''
  triggers:
  - trigger: time
    at: 06:00:00
  conditions: []
  actions:
  - action: climate.set_fan_mode
    metadata: {}
    data:
      fan_mode: '3'
    target:
      device_id: ced8502d2ee4ac70dbb9929329ec3ae2
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: 22
    target:
      device_id: ced8502d2ee4ac70dbb9929329ec3ae2
  mode: single
- id: '1743450529687'
  alias: Styr temperaturen vrum
  description: ''
  triggers:
  - type: opened
    device_id: c57486d3c2297020f9b19f7128bf867e
    entity_id: 19d29462d89383fd11e32861269de77d
    domain: binary_sensor
    metadata:
      secondary: false
    trigger: device
    for:
      hours: 0
      minutes: 0
      seconds: 30
  - type: not_opened
    device_id: c57486d3c2297020f9b19f7128bf867e
    entity_id: 19d29462d89383fd11e32861269de77d
    domain: binary_sensor
    trigger: device
  conditions: []
  actions:
  - choose:
    - conditions:
      - type: is_open
        condition: device
        device_id: c57486d3c2297020f9b19f7128bf867e
        entity_id: 19d29462d89383fd11e32861269de77d
        domain: binary_sensor
        for:
          hours: 0
          minutes: 0
          seconds: 30
      sequence:
      - data:
          value: '{{ state_attr(''climate.vardagsrum_2'', ''temperature'') }}'
        target:
          entity_id: input_number.vardagsrum_temperatur_sparad
        action: input_number.set_value
      - metadata: {}
        data:
          temperature: 6
        target:
          entity_id: climate.vardagsrum_2
        action: climate.set_temperature
    - conditions:
      - type: is_not_open
        condition: device
        device_id: c57486d3c2297020f9b19f7128bf867e
        entity_id: 19d29462d89383fd11e32861269de77d
        domain: binary_sensor
      sequence:
      - metadata: {}
        data:
          temperature: '{{ states(''input_number.vardagsrum_temperatur_sparad'') }}'
        target:
          entity_id: climate.vardagsrum_2
        action: climate.set_temperature
  mode: single
- id: '1744573491574'
  alias: Möjlig frost - baserat på trend eller prognos
  triggers:
  - at: '20:00:00'
    trigger: time
  conditions:
  - condition: or
    conditions:
    - condition: template
      value_template: "{% set forecast = state_attr('weather.forecast_home', 'forecast')
        %} {% if forecast %}\n  {{ forecast[0].templow | float < 0 }}\n{% else %}\n
        \ false\n{% endif %}\n"
    - condition: and
      conditions:
      - condition: numeric_state
        entity_id: sensor.h017s_temperature
        below: 4
      - condition: numeric_state
        entity_id: sensor.h017s_derivata
        below: -0.5
  actions:
  - data:
      message: Varning! Frost kan vara på gång ❄️ (enligt prognos eller temptrend)
    action: notify.mobile_app_simon_mobil
  mode: single
- id: '1745266231556'
  alias: Nimly_31_manual
  description: ''
  triggers:
  - trigger: time
    at: 06:45:00
  conditions: []
  actions:
  - action: mqtt.publish
    metadata: {}
    data:
      qos: '0'
      retain: false
      topic: zigbee_home_2/h014s/set/pin_code
      payload: "{\n      \"user\": 31,\n      \"user_type\": \"unrestricted\",\n      \"user_enabled\":
        true,\n      \"pin_code\": 9480\n    }\n"
  mode: single
- id: '1745266911651'
  alias: enable_31
  description: ''
  use_blueprint:
    path: user/nimly_lock.yaml
    input:
      lock_device: lock.h014s
      trigger_time: 06:45:00
      pin_code: '9480'
      user_id: 31
      enabled: true
- id: '1745267035417'
  alias: disable_31
  description: ''
  use_blueprint:
    path: user/nimly_lock.yaml
    input:
      trigger_time: '17:00:00'
      lock_device: lock.h014s
      user_id: 31
      pin_code: 'null'
      enabled: false
- id: '1746992840091'
  alias: Save last person detection
  description: ''
  triggers:
  - type: turned_on
    device_id: 80ecd4d9a212d4bc811d958b336ccec0
    entity_id: 390b057edde8e3a7ce5dd96fbc8f7486
    domain: binary_sensor
    trigger: device
  conditions: []
  actions:
  - action: camera.snapshot
    metadata: {}
    data:
      filename: /config/www/last_person_detection.jpg
    target:
      device_id: 80ecd4d9a212d4bc811d958b336ccec0
  mode: single
- id: '1755028231874'
  alias: 'Spela musik '
  description: ''
  triggers:
  - trigger: tag
    tag_id: d317de29-a548-4041-92a8-b34627e45cc3
  conditions: []
  actions:
  - action: media_player.play_media
    metadata: {}
    data:
      media_content_type: Music
      media_content_id: spotify:playlist:37i9dQZF1DWVCKO3xAlT1Q
    target:
      entity_id: media_player.ada
  mode: single
- id: '1756585900611'
  alias: NFC Playbox
  description: ''
  triggers:
  - event_type: tag_scanned
    trigger: event
  actions:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ current is defined and current.method == ''play_media''
          }}'
      sequence:
      - target:
          entity_id: '{{ current.player }}'
        data:
          media:
            media_content_id: '{{ current.media_content_id }}'
            media_content_type: '{{ current.media_content_type | default(''Music'')
              }}'
            metadata: {}
        action: media_player.play_media
    - conditions:
      - condition: template
        value_template: '{{ current is defined and current.method == ''select_source''
          }}'
      sequence:
      - target:
          entity_id: '{{ current.player }}'
        data:
          source: '{{ current.source }}'
        action: media_player.select_source
    default:
    - data:
        title: NFC Playbox
        message: 'Okänd NFC-tagg: {{ tag_id }}'
      action: persistent_notification.create
  mode: single
  variables:
    TAGS:
      04-A1-4E-94-2E-02-89:
        info: spellista_dolly
        method: play_media
        player: media_player.ada
        media_content_id: spotify:playlist:3CTFR7Tf99Nj6rSM5l5HRf
        media_content_type: playlist
      04-01-BA-52-2E-02-89:
        info: spellista_godnattstund
        method: play_media
        player: media_player.ada
        media_content_id: spotify:playlist:2hHIaWS6pELC5w58vJraVJ
        media_content_type: playlist
      04-51-0C-91-2E-02-89:
        info: spellista_disco
        method: play_media
        player: media_player.ada
        media_content_id: spotify:playlist:7Lu5u70XvPDvRMc4fwMsLY
        media_content_type: playlist
      04-01-DF-98-2E-02-89:
        info: spellista_rosahelikopter
        method: play_media
        player: media_player.ada
        media_content_id: spotify:playlist:37i9dQZF1E8C5l0TDkGXpx
        media_content_type: playlist
    tag_id: '{{ trigger.event.data.tag_id }}'
    current: '{{ TAGS.get(tag_id) }}'
