- id: doods_testing
  alias: Doods Testing
  trigger:
  - entity_id: binary_sensor.driveway_motion
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: input_boolean.sentry_mode
    state: 'on'
  action:
  - service: image_processing.scan
    entity_id: image_processing.doods_driveway
  - choose:
    - conditions:
      - condition: numeric_state
        entity_id: image_processing.doods_driveway
        above: '0'
      sequence:
      - service: script.text_alert_image
        data:
          who: jeff
          title: Person Detected!
          message: '{{ states("image_processing.doods_driveway") | int}} people detected
            near vehicles/'
          url: /media/images/driveway_latest.jpg
          content_type: JPEG
    default: []
  mode: single
- id: family_has_arrived
  alias: Family Has arrived
  trigger:
  - entity_id: sensor.family_status
    from: Away
    platform: state
    to: Home
    id: family
  - platform: zone
    entity_id: person.jeffrey
    zone: zone.home
    event: enter
    id: jeffrey
  - entity_id: device_tracker.mal
    from: not_home
    platform: state
    to: home
    id: mal
  - platform: zone
    entity_id: person.katherine
    zone: zone.home
    event: enter
    id: kat
  condition: []
  action:
  - service: script.family_is_home
  - choose:
    - conditions:
      - condition: trigger
        id: jeffrey
      sequence:
      - service: input_boolean.turn_off
        data: {}
        entity_id: input_boolean.jeff_travel_monitor
    - conditions:
      - condition: trigger
        id: kat
      sequence:
      - service: input_boolean.turn_off
        data: {}
        entity_id: input_boolean.kat_travel_monitor
    default: []
  - service: script.driveway_on
    data: {}
  mode: single
  initial_state: true
- id: family_has_left
  alias: Family Has Left
  initial_state: true
  trigger:
  - entity_id: sensor.family_status
    from: Home
    platform: state
    to: Away
  - entity_id: group.family
    from: home
    platform: state
    to: not_home
  mode: single
  condition:
  - condition: state
    entity_id: input_boolean.guest_mode
    state: 'off'
  action:
  - service: script.family_is_away
- id: upstairs_fan_on
  alias: Upstairs Fan On
  initial_state: true
  trigger:
  - entity_id: binary_sensor.upstairs_occupancy
    from: 'Off'
    platform: state
    to: 'On'
  condition:
  - above: 73
    condition: numeric_state
    entity_id: sensor.upstairs_temperature
  action:
  - data:
      entity_id: switch.upstairs_fan
    service: switch.turn_on
- id: '1562066108032'
  alias: Living Room Fan On
  initial_state: true
  trigger:
  - entity_id: binary_sensor.living_room_occupancy
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: switch.livingroom_fan
    state: 'off'
  - above: 73
    condition: numeric_state
    entity_id: sensor.living_room_temperature
  action:
  - data:
      entity_id: switch.livingroom_fan
    service: switch.turn_on
- id: '1562067639239'
  alias: Upstairs Fan Off
  initial_state: true
  trigger:
  - entity_id: binary_sensor.upstairs_occupancy
    from: 'on'
    platform: state
    to: 'off'
  condition:
  - condition: state
    entity_id: switch.croft_fan
    state: 'on'
  - below: 72
    condition: numeric_state
    entity_id: sensor.upstairs_temperature
  action:
  - data:
      entity_id: switch.croft_fan
    service: switch.turn_off
- id: turn_off_kitchen_speaker
  alias: Turn Off Kitchen Display
  trigger:
  - platform: state
    entity_id: media_player.googlehomehub3492
    from: playing
    to: idle
  action:
  - service: media_player.turn_off
    entity_id: media_player.googlehomehub3492
  initial_state: true
- id: driveway_motion_lighting
  alias: Driveway Motion Lighting
  trigger:
  - platform: state
    entity_id: binary_sensor.aarlo_motion_driveway
    to: 'on'
  condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
  - condition: state
    entity_id: switch.driveway_light
    state: 'off'
  action:
  - service: switch.turn_on
    entity_id: switch.driveway_light
  - delay:
      minutes: 1
  - service: script.turn_on
    entity_id: script.driveway_off
  initial_state: true
  mode: single
- id: show_time_over
  alias: Show Time over
  initial_state: true
  trigger:
  - platform: state
    entity_id: media_player.theater_tv
    to: 'off'
    for:
      minutes: 20
  action:
  - service: scene.turn_on
    entity_id: scene.theater_dark
- id: theater_light_pressed_up
  alias: Theater Light Pressed Up
  initial_state: true
  trigger:
  - platform: state
    entity_id: sensor.theater_light_up
  action:
  - service: scene.turn_on
    entity_id: scene.theater_bright
- id: theater_light_pressed_down
  alias: Theater Light Pressed Down
  initial_state: true
  trigger:
  - platform: state
    entity_id: sensor.theater_light_down
  action:
  - service: scene.turn_on
    entity_id: scene.theater_dark
- id: '1607350354349'
  alias: WFH Video Call Lights On
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.latlmacr0f9jg5m_c922_pro_stream_webcam_camera
    - binary_sensor.latlmacr0f9jg5m_c922_pro_stream_webcam_2
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: scene.turn_on
    data: {}
    entity_id: scene.jeff_desk_on
  - service: switch.turn_on
    data: {}
    entity_id: switch.tplink_a2
  mode: single
- id: '1607350405537'
  alias: WFH Video Lights Off
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.latlmacr0f9jg5m_c922_pro_stream_webcam_camera
    from: 'on'
    to: 'off'
  condition: []
  action:
  - service: switch.turn_off
    data: {}
    entity_id: switch.tplink_a2
  mode: single
- id: test_tag_event
  alias: Tag desk is scanned
  description: ''
  trigger:
    platform: event
    event_type: tag_scanned
    event_data:
      tag_id: 27cb75e7-ea9f-4395-a747-28eb1118a890
      device_id: 3B33820C-9851-40CD-931E-32801D4BAE3D
  condition: []
  action:
  - service: notify.jeff_ios
    data:
      message: Jeff someone scanned desk tag
  mode: single
- id: '1613442280682'
  alias: Master Bath Humidity Too High
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.master_bath_humidity
    above: '68'
    for: 00:03:00
  condition:
  - condition: state
    entity_id: switch.master_bath_fan
    state: 'off'
  - condition: state
    entity_id: binary_sensor.quiet_time
    state: 'off'
  - condition: state
    entity_id: group.family
    state: home
  action:
  - service: switch.turn_on
    data: {}
    entity_id: switch.master_bath_fan
  mode: single
- id: '1613442381930'
  alias: Master Bath Humidity Normal
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.master_bath_humidity
    below: '69'
  condition:
  - condition: state
    entity_id: switch.master_bath_fan
    state: 'on'
  action:
  - service: switch.turn_off
    data: {}
    entity_id: switch.master_bath_fan
  mode: single
- id: '1614313318267'
  alias: testing wh
  description: ''
  trigger:
  - platform: webhook
    webhook_id: test-webooking
  condition: []
  action:
  - event: test_complete
    event_data: {}
  mode: single
- id: '1622313738769'
  alias: Room Presence Detection
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.master_bedroom_motion_occupancy
    - binary_sensor.kitchen_motion_occupancy
    - binary_sensor.living_room_motion_occupancy
    - binary_sensor.skylar_bedroom_motion_occupancy
    - binary_sensor.croft_occupancy
    - binary_sensor.back_door_motion
    from: 'off'
    to: 'on'
  - platform: state
    entity_id:
    - media_player.kitchen_echo
    - media_player.living_room_echo
    - media_player.skylar_s_bedroom
    attribute: last_called
    to: 'true'
  - platform: state
    entity_id: media_player.theater_tv
    from: 'off'
    to: 'on'
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: media_player.theater_tv
        state: 'on'
      sequence:
      - service: input_text.set_value
        data:
          entity_id: input_text.room_presence
          value: theater
    - conditions:
      - condition: template
        value_template: '{{ "Kitchen" in trigger.to_state.attributes.friendly_name
          or  "Back Door" in trigger.to_state.attributes.friendly_name }}'
      sequence:
      - service: input_text.set_value
        data:
          entity_id: input_text.room_presence
          value: kitchen
    - conditions:
      - condition: template
        value_template: '{{ "Living" in trigger.to_state.attributes.friendly_name
          }}'
      sequence:
      - service: input_text.set_value
        data:
          entity_id: input_text.room_presence
          value: main
    - conditions:
      - condition: template
        value_template: '{{ "Master" in trigger.to_state.attributes.friendly_name
          }}'
      sequence:
      - service: input_text.set_value
        data:
          entity_id: input_text.room_presence
          value: master_bedroom
    - conditions:
      - condition: template
        value_template: '{{ "Croft" in trigger.to_state.attributes.friendly_name }}'
      sequence:
      - service: input_text.set_value
        data:
          entity_id: input_text.room_presence
          value: croft
    - conditions:
      - condition: template
        value_template: '{{ "Skylar" in trigger.to_state.attributes.friendly_name
          }}'
      sequence:
      - service: input_text.set_value
        data:
          entity_id: input_text.room_presence
          value: skylar_bedroom
    default: []
  mode: restart
- id: '1622731659354'
  alias: Tornado Alarm
  description: Sound the Tornado Alarm!
  trigger:
  - platform: state
    entity_id: input_boolean.tornado_alarm
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: input_boolean.tornado_alarm
        state: 'on'
      sequence:
      - delay:
          seconds: 15
      - service: media_player.volume_set
        data:
          entity_id: media_player.ha_blue
          volume_level: 0.99
      - service: media_player.play_media
        target:
          entity_id: media_player.ha_blue
        data:
          media_content_id: /media/sounds/tornado_alarm.mp3
          media_content_type: music
      - delay:
          seconds: 110
      - service: media_player.play_media
        target:
          entity_id: media_player.ha_blue
        data:
          media_content_id: /media/sounds/tornado_alarm.mp3
          media_content_type: music
    - conditions:
      - condition: state
        entity_id: input_boolean.tornado_alarm
        state: 'off'
      sequence:
      - service: media_player.media_stop
        target:
          entity_id: media_player.ha_blue
    default: []
  mode: restart
- id: '1626618008890'
  alias: Garden Needs Watering
  description: ''
  trigger:
  - platform: time
    at: '18:00:00'
  condition:
  - condition: numeric_state
    entity_id: sensor.previous_rainfall
    below: '.6'
  action:
  - service: script.text_notify
    data:
      who: all_ios
      message: The Garden has received {{ states('sensor.previous_rainfall') | round(2)
        }} inches of rain in the last 48 hours.
  mode: single
- id: '1627078744808'
  alias: buy more xlm
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.xlm_exchange_rate
    below: '.20'
  condition: []
  action:
  - service: notify.mobile_app_jeffrey_ha_app
    data:
      message: XLM is now at ${{ states('sensor.xlm_exchange_rate') }}!!
  mode: single
- id: '1627080083081'
  alias: XLM to the Moon
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.xlm_price_stats
    attribute: change
    above: '20'
  condition: []
  action:
  - service: notify.mobile_app_jeffrey_ha_app
    data:
      message: XLM to the Moon!
  mode: single
- id: '1627174942201'
  alias: run vacation lights
  description: ''
  trigger:
  - platform: sun
    event: sunset
    id: sundown
  - platform: sun
    event: sunrise
    id: sunup
  - platform: state
    entity_id: input_boolean.vacation_mode
    id: cancel
    from: 'on'
    to: 'off'
  condition: []
  action:
  - choose:
    - conditions:
      - condition: trigger
        id: sundown
      - condition: state
        entity_id: input_boolean.vacation_mode
        state: 'on'
      sequence:
      - service: input_boolean.turn_on
        entity_id: input_boolean.randomize_vacation_lights
    - conditions:
      - condition: or
        conditions:
        - condition: trigger
          id: sunup
        - condition: trigger
          id: cancel
      sequence:
      - service: nput_boolean.turn_off
        entity_id: input_boolean.randomize_vacation_lights
    default: []
  mode: single
- id: '1627694115326'
  alias: Skylar Bedtime Announcement
  description: ''
  trigger:
  - platform: time
    at: input_datetime.skylar_school_bedtime
    id: school_night
  - platform: time
    at: input_datetime.skylar_bedtime_holiday
    id: no_school
  condition:
  - condition: state 
    entity_id: input_boolean.skylar_awake
    state: 'on'
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: sensor.school_tomorrow
        state: 'on'
      - condition: trigger
        id: school_night
      sequence:
      - service: script.turn_on
        target:
          entity_id: script.skylar_nightly_briefing
    - conditions:
      - condition: state
        entity_id: sensor.school_tomorrow
        state: 'off'
      - condition: trigger
        id: no_school
      sequence:
      - service: script.turn_on
        target:
          entity_id: script.skylar_nightly_briefing
    default: []
  mode: single
- id: hauntedhouse_on_demo
  alias: HauntedHouse Automation
  trigger:
  - platform: state
    entity_id: input_boolean.this_is_halloween
    to: 'on'
    from: 'off'
    id: start
  - platform: state
    entity_id: input_boolean.this_is_halloween
    id: stop
    from: 'on'
    to: 'off'
  action:
  - choose:
    - conditions:
      - condition: trigger
        id: start
      sequence:
      - service: script.turn_on
        target:
          entity_id: script.haunted_house
    - conditions:
      - condition: trigger
        id: stop
      sequence:
      - service: script.turn_off
        target:
          entity_id: script.haunted_house
      - service: media_player.media_stop
        target:
          entity_id: media_player.ha_blue
    default: []
  initial_state: true
  mode: single
- id: '1628522379902'
  alias: Test Turn on Vacation Lights
  description: ''
  trigger:
  - platform: state
    entity_id: input_boolean.randomize_vacation_lights
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: input_boolean.randomize_vacation_lights
        state: 'on'
      sequence:
      - service: script.turn_on
        target:
          entity_id: script.randomize_vacation_lights
    - conditions:
      - condition: state
        entity_id: input_boolean.randomize_vacation_lights
        state: 'off'
      sequence:
      - service: script.turn_off
        target:
          entity_id: script.randomize_vacation_lights
    default: []
  mode: single
- id: '1629578209876'
  alias: Remote System Heartbeat
  description: ''
  trigger:
  - platform: webhook
    webhook_id: remote_system_heartbeat
    id: heartbeat
  - platform: time_pattern
    id: update
    minutes: /30
  condition: []
  action:
  - choose:
    - conditions:
      - condition: trigger
        id: heartbeat
      sequence:
      - service: input_datetime.set_datetime
        target:
          entity_id: input_datetime.remote_system_heartbeat
        data:
          datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
      - service: input_select.select_option
        target:
          entity_id: input_select.remote_system_status
        data:
          option: alive
    - conditions:
      - condition: trigger
        id: update
      - condition: template
        value_template: '{{ (as_timestamp(now()) - as_timestamp(states(''input_datetime.remote_system_heartbeat'')))
          < 3600 }}'
      sequence:
      - service: input_select.select_option
        target:
          entity_id: input_select.remote_system_status
        data:
          option: alive
    default:
    - service: input_select.select_option
      target:
        entity_id: input_select.remote_system_status
      data:
        option: unknown
  mode: single
- id: '1629581648846'
  alias: Remote System Alert
  description: ''
  trigger:
  - platform: state
    entity_id: input_select.remote_system_status
    from: alive
    to: unknown
    id: alert
  - platform: state
    entity_id: input_select.remote_system_status
    id: alive
    from: unknown
    to: alive
  condition: []
  action:
  - choose:
    - conditions:
      - condition: trigger
        id: alert
      sequence:
      - service: notify.mobile_app_jeffrey_ha_app
        data:
          message: Remote System is Down!!
    - conditions:
      - condition: trigger
        id: alive
      sequence:
      - service: notify.mobile_app_jeffrey_ha_app
        data:
          message: Remote System is Alive again
    default: []
  mode: single
- id: '1629837216637'
  alias: Send Heartbeat
  description: ''
  trigger:
  - platform: time_pattern
    minutes: /30
  - platform: homeassistant
    event: start
  condition: []
  action:
  - service: rest_command.remote_system_webhook
  mode: single
- id: just_a_test_webhook
  alias: Testing Webhooks
  description: ''
  trigger:
  - platform: webhook
    webhook_id: send_a_message
  action:
  - service: notify.mobile_app_jeffrey_ha_app
    data:
      message: '{{ trigger.json.message }}'
  - service: '{{ trigger.json.service }}'
    data:
      entity_id: '{{ trigger.json.entity }}'
  mode: single
- id: '1630181709370'
  alias: ifttt webhook
  description: ''
  trigger:
  - platform: webhook
    webhook_id: ifttt_webhook
  condition: []
  action:
  - service: notify.mobile_app_jeffrey_ha_app
    data:
      message: 'A New Note: {{ trigger.json.message }}'
  mode: single
- id: '1630186526302'
  alias: Daily Agenda
  description: ''
  trigger:
  - platform: webhook
    webhook_id: daily_agenda
  condition: []
  action:
  - service: mqtt.publish
    data:
      topic: house/daily/events
      payload: '{{ trigger.json.events | truncate(250, False) | replace("anchoragehouse677@gmail.com","")
        }}'
      retain: true
  mode: single
- id: honiture_q6
  alias: Honiture Q6
  description: ''
  trigger:
  - platform: state
    entity_id: input_boolean.q6s2
    id: q6s2_on
    from: 'off'
    to: 'on'
  - platform: state
    entity_id: input_boolean.q6s2
    id: q6s2_off
    from: 'on'
    to: 'off'
  condition: []
  action:
  - choose:
    - conditions:
      - condition: trigger
        id: q6s2_on
      sequence:
      - service: media_player.play_media
        target:
          device_id: edb192da8c7f80c32410147961257fae
        data:
          media_content_id: q six s two go to work
          media_content_type: routine
    - conditions:
      - condition: trigger
        id: q6s2_off
      sequence:
      - service: media_player.play_media
        target:
          device_id: edb192da8c7f80c32410147961257fae
        data:
          media_content_id: q six s two go home
          media_content_type: routine
    default: []
  mode: single
- id: '1636680118730'
  alias: Turn of Skylar's Humidifer
  description: ''
  trigger:
  - platform: state
    entity_id: humidifier.diffuser_skylars_bedroom
    to: 'on'
    for:
      hours: 1
      minutes: 0
      seconds: 0
      milliseconds: 0
  condition: []
  action:
  - service: humidifier.turn_off
    target:
      entity_id: humidifier.diffuser_skylars_bedroom
  - service: switch.turn_off
    entity_id: switch.skylars_microphone
  - service: scene.turn_on
    entity_id: scene.skylars_night_light
  mode: single
