- alias: "Der er nogen i huset"
  mode: single
  trigger:
    - platform: state
      entity_id: binary_sensor.hue_motion_sensor_2_motion_2
      to: "on"
    - platform: state
      entity_id: binary_sensor.hue_motion_sensor_2_motion
      to: "on"
    - platform: state
      entity_id: binary_sensor.hue_motion_sensor_1_motion_2
      to: "on"
    - platform: state
      entity_id: binary_sensor.bad_motion_sensor_motion
      to: "on"
    - platform: state
      entity_id: binary_sensor.gang_sensor_motion
      to: "on"
    - platform: state
      entity_id: binary_sensor.forgang_sensor_motion
      to: "on"
  condition:
    - condition: state
      entity_id: binary_sensor.family_presence
      state: "off"
    - condition: not
      conditions:
        - condition: state
          entity_id: vacuum.roborock_s8_pro_ultra
          state:
            - cleaning
            - returning
  action:
    - service: notify.mobile_app_claus_iphone_15pro
      data:
        message: >-
          Der er nogen i huset.
          Bevægelse registreret af {{ trigger.to_state.name or trigger.entity_id }}.
    - service: scene.create
      data:
        scene_id: before
        snapshot_entities:
          - light.pendle1
    - service: light.turn_on
      data:
        entity_id: light.pendle1
        brightness: 255
        rgb_color: [255, 0, 0]
        flash: long
    - delay: 2
    - service: scene.turn_on
      target:
        entity_id: scene.before


      
#      - service: script.sonos_say
#        data:
#          sonos_entity: media_player.kontor
#          volume: 0.7
#          message: 'Hej Claus er det dig der går i gangen?'
#          delay: '00:00:05'
