- id: '1663800838636'
  alias: Movie Playing in Family Room
  description: ''
  trigger:
  - platform: state
    entity_id:
    - media_player.valhalla_tv
    to: playing
    for:
      hours: 0
      minutes: 0
      seconds: 2
  condition:
  - condition: sun
    after: sunset
    enabled: false
  action:
  - type: turn_off
    device_id: b7eb915d337614def997ba6222e26360
    entity_id: light.living_room_lights
    domain: light
  - type: turn_off
    device_id: e91721c1443165238356be0911f9fd80
    entity_id: switch.kitchen_lights_outlet
    domain: switch
  - type: turn_off
    device_id: 6f8eb17254973abba6e349d76084b2df
    entity_id: switch.office_mss510x_main_channel
    domain: switch
  - type: turn_off
    device_id: 4eab625495f69aee120cbcee3da30c48
    entity_id: switch.pantry_mss510x_main_channel
    domain: switch
  mode: single
- id: '1664144387920'
  alias: Tag Unlock is scanned
  description: ''
  trigger:
  - platform: tag
    tag_id: 5c272792-8775-4fb9-8f6d-738baea1a01e
  condition: []
  action:
  - device_id: 4ac04e859b1b7cfebc5c89f16b4dd05e
    domain: lock
    entity_id: lock.back_door
    type: unlock
  mode: single
- id: '1668446634666'
  alias: 4x8 Fan On
  description: ''
  trigger: []
  condition:
  - type: is_temperature
    condition: device
    device_id: 97ca5e07e0a6b1a33aa3cb7e2068e3a3
    entity_id: sensor.ibs_th3_temperature
    domain: sensor
    above: 81
  - condition: or
    conditions:
    - type: is_humidity
      condition: device
      device_id: 97ca5e07e0a6b1a33aa3cb7e2068e3a3
      entity_id: sensor.ibs_th3_humidity
      domain: sensor
      above: 60
  action:
  - type: turn_on
    device_id: f78f8fdd7ba41875f9a8c6387ab74826
    entity_id: switch.grow_room_2
    domain: switch
  mode: single
- id: '1671994424879'
  alias: Turn on when movie paused
  description: ''
  trigger:
  - platform: state
    entity_id:
    - media_player.valhalla_tv
    to: paused
    for:
      hours: 0
      minutes: 0
      seconds: 2
  - platform: state
    entity_id:
    - media_player.valhalla_tv
    to: 'off'
    for:
      hours: 0
      minutes: 0
      seconds: 2
  condition:
  - condition: sun
    after: sunset
    enabled: false
  action:
  - type: turn_on
    device_id: b7eb915d337614def997ba6222e26360
    entity_id: light.living_room_lights
    domain: light
  - type: turn_on
    device_id: e91721c1443165238356be0911f9fd80
    entity_id: switch.kitchen_lights_outlet
    domain: switch
  - type: turn_on
    device_id: 6f8eb17254973abba6e349d76084b2df
    entity_id: switch.office_mss510x_main_channel
    domain: switch
  mode: single
- id: '1672092115231'
  alias: Living Room - HVAC Daily Schedule
  description: ''
  use_blueprint:
    path: jheddings/daily-thermostat-schedule.yaml
    input:
      at_time: 00:00:00
      climate_id: climate.living_room
      cooling_temp: 74
      heating_temp: 70
- id: '1672092948580'
  alias: MB Motion On
  description: ''
  triggers:
  - entity_id:
    - binary_sensor.lnlinkha_e04b410118a9000000000000b9ac0000_m
    to:
    - 'on'
    from:
    - 'off'
    trigger: state
  - entity_id:
    - binary_sensor.lnlinkha_e04b410118a9000000000000b9ac0000_m
    to:
    - 'off'
    for:
      minutes: 15
    from:
    - 'on'
    trigger: state
  conditions: []
  actions:
  - choose:
    - conditions:
      - condition: state
        state:
        - 'on'
        entity_id: binary_sensor.lnlinkha_e04b410118a9000000000000b9ac0000_m
      sequence:
      - choose:
        - conditions:
          - condition: time
            after: '22:30:00'
          sequence:
          - target:
              entity_id:
              - switch.master_toilet_switch_1_2
            data: {}
            action: switch.turn_on
        - conditions:
          - condition: time
            before: 06:45:00
          sequence:
          - data: {}
            action: switch.turn_on
            target:
              entity_id: switch.master_toilet_switch_1_2
        - conditions:
          - condition: time
            after: 05:00:00
            before: '22:30:00'
          sequence:
          - target:
              device_id:
              - 601fab85121adbe72943b764ea2ccc45
              - 274d1a89353f2149742d3e016f9d1c30
              - 17f934055c9bc0940cf3e2a28ee99c46
              - a69a5223b71a96224cbee49d16f2588f
            data: {}
            action: switch.turn_on
    - conditions:
      - condition: state
        state:
        - 'off'
        for:
          minutes: 15
        entity_id: binary_sensor.lnlinkha_e04b410118a9000000000000b9ac0000_m
      sequence:
      - data: {}
        action: switch.turn_off
        target:
          device_id:
          - c6b264835b3135c1120a3165c6d188f6
          - 601fab85121adbe72943b764ea2ccc45
          - a69a5223b71a96224cbee49d16f2588f
          - 274d1a89353f2149742d3e016f9d1c30
      - data: {}
        action: switch.turn_off
        target:
          device_id: 601fab85121adbe72943b764ea2ccc45
  mode: single
- &id001
  id: mb_motion_presence_control
  alias: MB Motion Presence Control
  triggers:
  - entity_id: binary_sensor.lnlinkha_e04b410118a9000000000000b9ac0000_m
    from: 'off'
    to: 'on'
    trigger: state
  - entity_id: binary_sensor.lnlinkha_e04b410118a9000000000000b9ac0000_m
    from: 'on'
    to: 'off'
    for:
      minutes: 15
    trigger: state
  conditions: []
  actions:
  - choose:
    - conditions:
      - condition: state
        entity_id: binary_sensor.lnlinkha_e04b410118a9000000000000b9ac0000_m
        state: 'on'
      sequence:
      - choose:
        - conditions:
          - condition: time
            after: '22:30:00'
            before: 06:45:00
          sequence:
          - target:
              entity_id:
              - switch.master_toilet_switch_1_2
            action: switch.turn_on
        - conditions:
          - condition: time
            after: 06:45:00
            before: '22:30:00'
          sequence:
          - target:
              entity_id:
              - switch.master_toilet_switch_1_2
              - switch.other_switch_1
              - switch.other_switch_2
            action: switch.turn_on
    - conditions:
      - condition: state
        entity_id: binary_sensor.lnlinkha_e04b410118a9000000000000b9ac0000_m
        state: 'off'
        for:
          minutes: 15
      sequence:
      - target:
          entity_id:
          - switch.master_toilet_switch_1_2
          - switch.other_switch_1
          - switch.other_switch_2
        action: switch.turn_off
  mode: single
- id: '1672892538673'
  alias: 'Phone good night '
  description: ''
  trigger:
  - type: plugged_in
    platform: device
    device_id: 1ecee444ef31658b5faba8c63f45fb60
    entity_id: binary_sensor.pixel_7_pro_is_charging
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 15
  condition:
  - condition: time
    before: 02:00:00
    after: '22:00:00'
    weekday:
    - sun
    - mon
    - tue
    - wed
    - thu
    - fri
    - sat
  - condition: device
    device_id: 1ecee444ef31658b5faba8c63f45fb60
    domain: device_tracker
    entity_id: device_tracker.pixel_7_pro
    type: is_home
  action: []
  mode: single
- id: '1673413993945'
  alias: 'Bed sensor '
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.withings_in_bed_chad
    for:
      hours: 0
      minutes: 0
      seconds: 30
    to: 'on'
  condition:
  - condition: time
    before: 04:30:00
    after: '22:00:00'
    weekday:
    - sat
    - fri
    - thu
    - wed
    - tue
    - mon
    - sun
  action:
  - type: turn_off
    device_id: d3a61f77d9b8c999fdde5c9264434104
    entity_id: light.master_lights
    domain: light
  - type: turn_on
    device_id: b889ac4c43b3bdd3ec30c8677b68645f
    entity_id: light.bedroom_lamp
    domain: light
    brightness_pct: 100
  mode: single
- id: '1673414768446'
  alias: Bed sensor out of bed
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.withings_in_bed_chad
    for:
      hours: 0
      minutes: 0
      seconds: 5
    to: 'off'
  condition:
  - condition: time
    before: 09:30:00
    after: '22:00:00'
    weekday:
    - sat
    - fri
    - thu
    - wed
    - tue
    - mon
    - sun
  action:
  - type: turn_on
    device_id: b889ac4c43b3bdd3ec30c8677b68645f
    entity_id: light.bedroom_lamp
    domain: light
    brightness_pct: 10
  mode: single
- id: '1673826243428'
  alias: Pool Light Control
  description: Turn pool light on after sunset if pool pump is on, and off when the
    pump is off.
  triggers:
  - entity_id: switch.pool_pump_socket_1
    to: 'on'
    trigger: state
  - entity_id: switch.pool_pump_socket_1
    to: 'off'
    trigger: state
  conditions:
  - condition: sun
    after: sunset
  actions:
  - choose:
    - conditions:
      - condition: state
        entity_id: switch.pool_pump_socket_1
        state: 'on'
      sequence:
      - target:
          entity_id: switch.pool_light
        action: switch.turn_on
    - conditions:
      - condition: state
        entity_id: switch.pool_pump_socket_1
        state: 'off'
      sequence:
      - target:
          entity_id: switch.pool_light
        action: switch.turn_off
  mode: single
- id: '1673826434195'
  alias: Patio Ceiling Lights
  description: ''
  trigger:
  - platform: sun
    event: sunset
    offset: 0
  condition: []
  action:
  - type: turn_on
    device_id: 559117955e10793b56f606ce3179564f
    entity_id: switch.patio_ceiling_switch_1
    domain: switch
  - wait_for_trigger:
    - platform: time
      at: '22:30:00'
  - type: turn_off
    device_id: 559117955e10793b56f606ce3179564f
    entity_id: switch.patio_ceiling_switch_1
    domain: switch
  mode: single
- id: '1674568317743'
  alias: Patio Ceiling Always On
  description: ''
  trigger:
  - platform: device
    type: turned_off
    device_id: 559117955e10793b56f606ce3179564f
    entity_id: switch.patio_ceiling_switch_1
    domain: switch
  condition: []
  action:
  - type: turn_on
    device_id: 559117955e10793b56f606ce3179564f
    entity_id: switch.patio_ceiling_switch_1
    domain: switch
  mode: single
- id: '1680102543234'
  alias: Humidifier on Fan Off
  description: ''
  trigger: []
  condition:
  - condition: device
    type: is_on
    device_id: 1dde3d94688dbbc2e3b4c71e8a0c916e
    entity_id: humidifier.humidifier
    domain: humidifier
  - condition: and
    conditions:
    - condition: state
      entity_id: sensor.gw1100b_v2_1_3_indoor_temperature
      attribute: unit_of_measurement
      state: <=77
  action:
  - type: turn_off
    device_id: f78f8fdd7ba41875f9a8c6387ab74826
    entity_id: switch.grow_room_2
    domain: switch
  mode: single
- id: '1680102724514'
  alias: High Humidity Fan On
  description: ''
  trigger: []
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: sensor.gw1100b_v2_1_3_indoor_temperature
      attribute: unit_of_measurement
      state: '>=77'
      for:
        hours: 0
        minutes: 2
        seconds: 0
    - condition: or
      conditions:
      - condition: state
        entity_id: sensor.gw1100b_v2_1_3_indoor_humidity
        state: '>=62'
        for:
          hours: 0
          minutes: 2
          seconds: 0
        attribute: unit_of_measurement
  action:
  - type: turn_on
    device_id: f78f8fdd7ba41875f9a8c6387ab74826
    entity_id: switch.grow_room_2
    domain: switch
  mode: single
- alias: Adjust Thermostat Schedule - Home
  trigger:
  - platform: state
    entity_id: device_tracker.chad_s_pixel_7_ii, device_tracker.pixel_7_pro
    from: not_home
    to: home
  action:
  - service: input_boolean.turn_on
    target:
      entity_id:
      - input_boolean.master_bedroom_schedule
      - input_boolean.living_room_schedule
      - input_boolean.bonus_room_schedule
  id: 7791c28c5bbc4c93bdf5f6141f183690
- alias: Adjust Thermostat Schedule - Away
  trigger:
  - platform: state
    entity_id: device_tracker.chad_s_pixel_7_ii, device_tracker.pixel_7_pro
    from: home
    to: not_home
  action:
  - service: input_boolean.turn_off
    target:
      entity_id:
      - input_boolean.master_bedroom_schedule
      - input_boolean.living_room_schedule
      - input_boolean.bonus_room_schedule
  id: eaae8710b6bf48d9a7e3547fb048aba7
- alias: Master Bedroom Thermostat Schedule
  trigger:
  - platform: time
    at: 05:00:00
  - platform: time
    at: '21:30:00'
  action:
  - service: climate.set_temperature
    target:
      entity_id: climate.master_bedroom
    data:
      temperature: 70 if now().hour == 21 else 72
  id: eb9ce70f6d354c4db292ecb9ddb1c1a4
- alias: Living Room Thermostat Schedule
  trigger:
  - platform: time_pattern
    minutes: /60
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: device_tracker.chad_s_pixel_7_ii, device_tracker.pixel_7_pro
      state: home
    - condition: template
      value_template: '{{ distance(states.device_tracker.chad_s_pixel_7_ii.attributes.latitude,
        states.device_tracker.chad_s_pixel_7_ii.attributes.longitude, states.zone.home.attributes.latitude,
        states.zone.home.attributes.longitude) | float <= 8046.72 }}  # 5 miles in
        meters

        '
  - condition: template
    value_template: '{% set living_room_temp = states(''sensor.living_room_temperature'')|float
      %} {% set average_temp = (living_room_temp + 74) / 2 %} {{ average_temp | round(1)
      }} <= YOUR_DESIRED_TEMPERATURE

      '
  action:
  - service: climate.set_temperature
    target:
      entity_id: climate.living_room
    data_template:
      temperature: '{% set living_room_temp = states(''sensor.living_room_temperature'')|float
        %} {% set average_temp = (living_room_temp + 74) / 2 %} {{ average_temp |
        round(1) }}

        '
  id: aa0bc7a9bfeb4ed488a3f957c729609f
- alias: Bonus Room Thermostat Schedule
  trigger:
  - platform: time_pattern
    minutes: /15
  condition:
  - condition: state
    entity_id: input_boolean.bonus_room_schedule
    state: 'on'
  action:
  - service: climate.set_temperature
    target:
      entity_id: climate.bonus_room
    data:
      temperature: 22
  id: 613e99bf046b4a3c90f775e5142e2c64
- alias: Adjust Thermostats - Home Arrival
  trigger:
  - platform: state
    entity_id: device_tracker.chad_s_pixel_7_ii, device_tracker.pixel_7_pro
    from: not_home
    to: home
  condition:
  - condition: template
    value_template: '{{ distance(states.device_tracker.chad_s_pixel_7_ii.attributes.latitude,
      states.device_tracker.chad_s_pixel_7_ii.attributes.longitude, states.zone.home.attributes.latitude,
      states.zone.home.attributes.longitude) | float <= 8046.72 }}  # 5 miles in meters

      '
  action:
  - service: climate.set_temperature
    target:
      entity_id:
      - climate.master_bedroom
      - climate.living_room
    data:
      temperature: 73
  id: ccbb4cebb85e4bae9db8ef0224d941c1
- alias: Virtual switch ON triggers garage door OPEN
  trigger:
  - platform: state
    entity_id: input_boolean.chad_s_garage_door_switch
    to: 'on'
  condition:
  - condition: state
    entity_id: cover.chad_s_garage_door
    state: closed
  action:
  - service: cover.open_cover
    entity_id: cover.chad_s_garage_door
  id: e15e39a01dbe46308119cf9690a759a4
- alias: Virtual switch OFF triggers garage door CLOSE
  trigger:
  - platform: state
    entity_id: input_boolean.chad_s_garage_door_switch
    to: 'off'
  condition:
  - condition: state
    entity_id: cover.chad_s_garage_door
    state: open
  action:
  - service: cover.close_cover
    entity_id: cover.chad_s_garage_door
  id: 6402a020a879495fa7d44a3deaf3cef9
- alias: Garage door OPEN updates virtual switch to ON
  trigger:
  - platform: state
    entity_id: cover.chad_s_garage_door
    to: open
  condition:
  - condition: state
    entity_id: input_boolean.chad_s_garage_door_switch
    state: 'off'
  action:
  - service: input_boolean.turn_on
    entity_id: input_boolean.chad_s_garage_door_switch
  id: 95222c5e50ab48d89dc730fb62c03827
- alias: Garage door CLOSED updates virtual switch to OFF
  trigger:
  - platform: state
    entity_id: cover.chad_s_garage_door
    to: closed
  condition:
  - condition: state
    entity_id: input_boolean.chad_s_garage_door_switch
    state: 'on'
  action:
  - service: input_boolean.turn_off
    entity_id: input_boolean.chad_s_garage_door_switch
  id: 13bafdb7b5cb4f9a9668119c8d8c71d6
- id: db3b29724c2e4e2f907ac6c5baaad9e5
  alias: 4x4 Grow 1 ON at 7:40 AM
  trigger:
  - platform: time
    at: 07:40:00
  action:
  - service: switch.turn_on
    entity_id: switch.4x4_grow_1
  - delay:
      hours: 0
      minutes: 12
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    entity_id: switch.4x4_grow_1
- id: 2909178796e343ae9b1873ef17b82486
  alias: 4x4 Grow 1 ON at 1:40 PM
  trigger:
  - platform: time
    at: '13:40:00'
  action:
  - service: switch.turn_on
    entity_id: switch.4x4_grow_1
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    entity_id: switch.4x4_grow_1
- id: 4451263204eb445cb819b6a42123e5c7
  alias: 4x4 Grow 1 ON at 7:40 PM
  trigger:
  - platform: time
    at: '19:40:00'
  action:
  - service: switch.turn_on
    entity_id: switch.4x4_grow_1
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    entity_id: switch.4x4_grow_1
- id: '1693187195794'
  alias: Mars300 Timer 18hrs
  description: ''
  trigger:
  - platform: time
    at: '20:00:00'
  condition: []
  action:
  - type: turn_off
    device_id: eb0bb47f34cf5c33816ca496c36d0c5d
    entity_id: switch.grow_2_socket_1
    domain: switch
  - delay:
      hours: 12
      minutes: 0
      seconds: 0
      milliseconds: 0
  - type: turn_on
    device_id: eb0bb47f34cf5c33816ca496c36d0c5d
    entity_id: switch.grow_2_socket_1
    domain: switch
  mode: single
- id: '777777777666'
  alias: Control AC Based on VPD
  trigger:
  - platform: state
    entity_id: sensor.skinnyc_s_grow_vpd
  - platform: state
    entity_id: sensor.storage_room_humidity
  condition:
  - condition: state
    entity_id: input_boolean.ac_control_lock
    state: 'off'
  - condition: template
    value_template: '{{ state_attr(''climate.storage_room'', ''temperature'') | float
      < 77 }}'
  - condition: state
    entity_id: climate.storage_room
    state:
    - 'off'
    - auto
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ trigger.to_state.state | float < 1.0 }}'
      sequence:
      - service: climate.set_temperature
        entity_id: climate.storage_room
        data:
          temperature: 61
      - service: climate.set_hvac_mode
        entity_id: climate.storage_room
        data:
          hvac_mode: auto
    - conditions:
      - condition: template
        value_template: '{{ trigger.to_state.state | float >= 1.0 and trigger.to_state.state
          | float < 1.5 }}'
      sequence:
      - service: climate.set_temperature
        entity_id: climate.storage_room
        data:
          temperature: 77
      - service: climate.set_hvac_mode
        entity_id: climate.storage_room
        data:
          hvac_mode: auto
    - conditions:
      - condition: template
        value_template: '{{ trigger.to_state.state | float >= 1.5 }}'
      sequence:
      - service: climate.set_hvac_mode
        entity_id: climate.storage_room
        data:
          hvac_mode: dry
    - conditions:
      - condition: template
        value_template: '{{ states(''sensor.storage_room_humidity'') | float > 72
          }}'
      sequence:
      - service: climate.set_hvac_mode
        entity_id: climate.storage_room
        data:
          hvac_mode: dry
  - delay:
      minutes: 5
  mode: single
- id: '1694401374207'
  alias: Check Sensor and Trigger Script
  description: Checks the sensor state every 15 minutes and triggers the script if
    the state is 1
  trigger:
  - platform: time_pattern
    minutes: /15
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: sensor.skinnyc_s_grow_humidifier_intensity_2
        state: '1'
      sequence:
      - service: script.govee_dehumidifier_on
    default: []
  mode: single
- id: '1694481945056'
  alias: Cycle Cloner Socket 1
  description: Cycles the switch.cloner_socket_1 on for 15 minutes and then off for
    15 minutes repeatedly
  trigger:
  - platform: time_pattern
    minutes: /30
  action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id:
      - switch.fogger
  - delay:
      minutes: 15
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.fogger
  mode: single
- id: detect_car_dwcam
  alias: Car Detected on DWCam
  triggers:
  - entity_id: binary_sensor.dwcam_car_occupancy_2
    from: 'off'
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 0
    trigger: state
  actions:
  - type: turn_on
    device_id: 3e1a551dd3c7859e74afd83b88d37f18
    entity_id: a11a22086f8348c28db181f83143d8ac
    domain: switch
- id: '1701009665280'
  alias: FP2 Pantry Lights
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.presence_sensor_fp2_05d5_presence_sensor_2
    to: 'on'
  - platform: state
    entity_id: binary_sensor.presence_sensor_fp2_05d5_presence_sensor_2
    to: 'off'
    for:
      seconds: 3
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: binary_sensor.presence_sensor_fp2_05d5_presence_sensor_2
        state: 'on'
      sequence:
      - type: turn_on
        device_id: 4eab625495f69aee120cbcee3da30c48
        entity_id: switch.pantry_mss510x_main_channel
        domain: switch
    - conditions:
      - condition: state
        entity_id: binary_sensor.presence_sensor_fp2_05d5_presence_sensor_2
        state: 'off'
      sequence:
      - delay:
          seconds: 3
      - type: turn_off
        device_id: 4eab625495f69aee120cbcee3da30c48
        entity_id: switch.pantry_mss510x_main_channel
        domain: switch
  mode: single
- alias: Control Cooler Based on Temperature
  trigger:
  - platform: state
    entity_id: sensor.dry_chamber_temperature
  condition:
  - condition: numeric_state
    entity_id: sensor.dry_chamber_temperature
    above: '{{ states(''input_number.target_temperature'') }}'
  - condition: numeric_state
    entity_id: sensor.dry_chamber_humidity
    below: '{{ states(''input_number.target_humidity'') }}'
  action:
  - service: switch.turn_on
    entity_id: switch.cooler_relay
  id: fbc61fb6081844f190fb3c77208ef67a
- alias: Reactivate AC When Humidity Low
  trigger:
  - platform: state
    entity_id: sensor.dry_chamber_humidity
  condition:
  - condition: numeric_state
    entity_id: sensor.dry_chamber_humidity
    below: '{{ states(''input_number.target_humidity'') }}'
  - condition: numeric_state
    entity_id: sensor.dry_chamber_temperature
    above: '{{ states(''input_number.target_temperature'') }}'
  action:
  - service: switch.turn_on
    entity_id: switch.cooler_relay
  id: 7dd9112cda7a4619b97a6d4051199336
- alias: Dehumidifier Priority Control Based on Humidity
  trigger:
  - platform: state
    entity_id: sensor.dry_chamber_humidity
  condition:
  - condition: numeric_state
    entity_id: sensor.dry_chamber_humidity
    above: '{{ states(''input_number.target_humidity'') }}'
  action:
  - service: switch.turn_off
    entity_id: switch.cooler_relay
  id: 43a77b8c3b3b453ab130e083a76452a9
- alias: AC Control Within Acceptable Humidity Range
  trigger:
  - platform: state
    entity_id: sensor.dry_chamber_temperature
  condition:
  - condition: numeric_state
    entity_id: sensor.dry_chamber_temperature
    above: '{{ states(''input_number.target_temperature'') }}'
  - condition: numeric_state
    entity_id: sensor.dry_chamber_humidity
    below: '{{ states(''input_number.target_humidity'') | float + 0.1 }}'
  action:
  - service: switch.turn_on
    entity_id: switch.cooler_relay
  id: a85f03a136774112aa47abd879d54253
- id: '1701224913742'
  alias: Control Cooler Based on Temperature
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.dry_chamber_temperature
  condition:
  - condition: template
    value_template: '{{ states(''sensor.dry_chamber_temperature'') | float > states(''input_number.target_temperature'')
      | float }}'
  - condition: template
    value_template: '{{ states(''sensor.dry_chamber_humidity'') | float < states(''input_number.target_humidity'')
      | float }}'
  action:
  - service: switch.turn_on
    entity_id: switch.cooler_relay
- id: '1701224955946'
  alias: Reactivate AC When Humidity Low
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.dry_chamber_humidity
  condition:
  - condition: template
    value_template: '{{ states(''sensor.dry_chamber_humidity'') | float < states(''input_number.target_humidity'')
      | float }}'
  - condition: template
    value_template: '{{ states(''sensor.dry_chamber_temperature'') | float > states(''input_number.target_temperature'')
      | float }}'
  action:
  - service: switch.turn_on
    entity_id: switch.cooler_relay
- id: '1701224978618'
  alias: Dehumidifier Priority Control Based on Humidity
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.dry_chamber_humidity
  condition:
  - condition: template
    value_template: '{{ states(''sensor.dry_chamber_humidity'') | float > states(''input_number.target_humidity'')
      | float }}'
  action:
  - service: switch.turn_off
    entity_id: switch.cooler_relay
- id: '1703300656557'
  alias: D1 Knock Office Light
  description: ''
  triggers:
  - device_id: d4e480f7ae3ea276c68e66ef8e5eab4c
    domain: zha
    type: device_flipped
    subtype: face_any
    trigger: device
  conditions: []
  actions:
  - type: toggle
    device_id: ae81ccac0584b1d1b23971e24e48e131
    entity_id: 1ce215545b312c75c6992a604f230574
    domain: switch
  mode: single
- id: '1703555769875'
  alias: Ikea Remote Control Lights
  description: Turns on or off all house lights with remote button long press.
  trigger:
  - device_id: a97cbc4f9f1b04ed715879a1d60963ff
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: dim_down
    id: dim_down
  - device_id: a97cbc4f9f1b04ed715879a1d60963ff
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: dim_up
    id: dim_up
  condition: []
  action:
  - choose:
    - conditions:
      - condition: trigger
        id: dim_down
      sequence:
      - service: light.turn_off
        target:
          entity_id: light.house_lights_2
    - conditions:
      - condition: trigger
        id: dim_up
      sequence:
      - service: light.turn_on
        target:
          entity_id: light.house_lights_2
  mode: single
- id: '1707512780015'
  alias: Control Sonoff Switch via Webhook
  triggers:
  - webhook_id: gateunlockw
    trigger: webhook
    allowed_methods:
    - POST
    - PUT
    local_only: true
  actions:
  - target:
      entity_id: switch.sonoff_1000b2c509
    action: switch.turn_on
    data: {}
- id: '1710081853890'
  alias: Verify PIN and Toggle Switch
  description: ''
  trigger:
  - platform: state
    entity_id: input_text.keypad_pin
    to: '2287'
  condition: []
  action:
  - service: switch.toggle
    data:
      entity_id: switch.sonoff_1000b2c509
  - service: input_text.set_value
    data:
      entity_id: input_text.keypad_pin
      value: ''
  mode: single
- id: '1710083269946'
  alias: Update PIN Text from PIN Number
  description: ''
  trigger:
  - platform: state
    entity_id: input_number.keypad_pin_number
  action:
  - service: input_text.set_value
    target:
      entity_id: input_text.keypad_pin
    data:
      value: '{{ trigger.to_state.state | int }}'
- id: '1710084293153'
  alias: Verify PIN and Toggle Switch
  description: ''
  trigger:
  - platform: state
    entity_id: input_text.keypad_pin
  condition:
  - condition: template
    value_template: '{{ trigger.to_state.state | length == 4 }}'
  - condition: template
    value_template: '{{ states(''input_text.keypad_pin'') == ''2287'' }}'
  action:
  - service: switch.toggle
    target:
      entity_id: switch.sonoff_1000b2c509
  - delay: 00:00:01
  - service: input_text.set_value
    data:
      entity_id: input_text.keypad_pin
      value: ''
  mode: single
- id: '1710465115812'
  alias: Switchbot Switch Timer 1212
  description: Ensures the switch follows a 12/12 hour cycle, turning on at 8 AM and
    off at 8 PM daily.
  trigger:
  - platform: time
    at: 08:00:00
  - platform: time
    at: '20:00:00'
  action:
  - choose:
    - conditions:
      - condition: time
        after: 07:59:59
        before: '20:00:01'
      sequence:
      - service: switch.turn_on
        target:
          entity_id: switch.relay
        data: {}
    - conditions:
      - condition: time
        after: '19:59:59'
        before: 08:00:01
      sequence:
      - service: switch.turn_off
        target:
          entity_id: switch.relay
        data: {}
  mode: restart
- id: '1710612658406'
  alias: Reset Vacuum Daily Counters
  description: ''
  trigger:
  - platform: time
    at: 00:01:00
  action:
  - service: input_number.set_value
    target:
      entity_id: input_number.vacuum_daily_runs
    data:
      value: 0
  - service: input_datetime.set_datetime
    target:
      entity_id: input_datetime.vacuum_last_run_time
    data:
      datetime: '1970-01-01 00:00:00'
- id: '1710612687640'
  alias: Start Vacuum on Leaving Home
  description: ''
  trigger:
  - platform: state
    entity_id:
    - device_tracker.s24ultra
    to: not_home
    for:
      minutes: 30
  condition:
  - condition: and
    conditions:
    - condition: time
      after: 08:00:00
      before: '22:00:00'
    - condition: numeric_state
      entity_id: input_number.vacuum_daily_runs
      below: 2
    - condition: template
      value_template: '{{ (as_timestamp(now()) - as_timestamp(states(''input_datetime.vacuum_last_run_time'')))
        > 14400 }}'
  action:
  - service: vacuum.start
    target:
      entity_id: vacuum.roborock_q5
    data: {}
  - service: input_number.increment
    target:
      entity_id: input_number.vacuum_daily_runs
    data: {}
  - service: input_datetime.set_datetime
    target:
      entity_id: input_datetime.vacuum_last_run_time
    data_template:
      datetime: '{{ now() }}'
- id: '1712375211029'
  alias: Maintain Grow Room Climate and Pump Schedule
  description: Controls the AC and dehumidifiers to maintain desired humidity, temperature,
    and VPD, respecting the irrigation pump schedule.
  trigger:
  - platform: state
    entity_id: sensor.skinnyc_s_grow_vpd
  - platform: state
    entity_id: sensor.skinnyc_s_grow_humidity
  - platform: state
    entity_id: sensor.skinnyc_s_grow_temperature
  - platform: state
    entity_id: switch.4x4_grow_1
  - platform: time
    at:
    - 07:25:00
    - '13:25:00'
    - '16:25:00'
    - '10:25:00'
    - '19:25:00'
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: switch.4x4_grow_1
        state: 'on'
      sequence:
      - service: humidifier.set_humidity
        target:
          entity_id:
          - humidifier.grow_dehu_1
          - humidifier.grow_dehu_2
        data:
          humidity: 80
    - conditions:
      - condition: state
        entity_id: switch.4x4_grow_1
        state: 'off'
      sequence:
      - delay: 00:05:00
      - service: humidifier.set_humidity
        target:
          entity_id:
          - humidifier.grow_dehu_1
          - humidifier.grow_dehu_2
        data:
          humidity: 60
    - conditions:
      - condition: numeric_state
        entity_id: sensor.skinnyc_s_grow_temperature
        above: 82
      sequence:
      - service: climate.set_hvac_mode
        target:
          entity_id: climate.midea_ac_151732604712142
        data:
          hvac_mode: cool
      - service: climate.set_temperature
        target:
          entity_id: climate.midea_ac_151732604712142
        data:
          temperature: 78
  - service: input_text.set_value
    target:
      entity_id: input_text.grow_room_log
    data:
      value: Grow room climate control ran at {{ now().strftime('%Y-%m-%d %H:%M:%S')
        }}
  mode: single
- id: '1712716247657'
  alias: Device Change Logger
  description: Logs the last three changes to selected devices.
  trigger:
  - platform: state
    entity_id:
    - climate.midea_ac_151732604712142
    - humidifier.grow_dehu_1
    - humidifier.grow_dehu_2
  action:
  - service: input_text.set_value
    target:
      entity_id: input_text.grow_room_log
    data:
      value: "{% set log_entry = namespace(entries=[]) %} {% for state in states |
        selectattr('entity_id', 'in', \n    ['climate.midea_ac_151732604712142', \n
        \   'humidifier.grow_dehu_1', \n    'humidifier.grow_dehu_2']) | list %}\n
        \ {% set log_entry.entries = log_entry.entries + \n    [state.name ~ ' changed
        to ' ~ state.state ~ ' at ' ~ now().strftime('%H:%M:%S')] %}\n{% endfor %}
        {% set log_entry.entries = log_entry.entries[-3:] %} {{ log_entry.entries
        | join(' | ') }}\n"
  mode: single
- id: '1713560117640'
  alias: Control pool pump at specific times
  description: Turns the pool pump on at 12 PM and off at 6 PM every day.
  trigger:
  - platform: time
    at: '12:00:00'
  - platform: time
    at: '18:00:00'
  action:
  - choose:
    - conditions:
      - condition: time
        after: '11:59:00'
        before: '12:01:00'
      sequence:
      - target:
          entity_id:
          - switch.pool_pump_switch_1
        action: switch.turn_on
        data: {}
    - conditions:
      - condition: time
        after: '17:59:00'
        before: '18:01:00'
      sequence:
      - target:
          entity_id:
          - switch.pool_pump_switch_1
        action: switch.turn_off
        data: {}
    default: []
- id: '1713560689750'
  alias: Pantry Presence Control
  description: 'Turns on the pantry switch when presence is detected and turns it
    off after no presence is detected for 10 minutes.

    '
  trigger:
  - platform: state
    entity_id: binary_sensor.presence_sensor_fp2_05d5_presence_sensor_2
    to: 'on'
    id: turn_on
  - platform: state
    entity_id:
    - binary_sensor.presence_sensor_fp2_05d5_presence_sensor_2
    to: 'off'
    for:
      hours: 0
      minutes: 2
      seconds: 0
    id: turn_off
  action:
  - choose:
    - conditions:
      - condition: trigger
        id: turn_on
      sequence:
      - service: switch.turn_on
        target:
          entity_id: switch.smart_switch_2005085264796725581548e1e91b6e71_outlet
        data: {}
    - conditions:
      - condition: trigger
        id: turn_off
      sequence:
      - service: switch.turn_off
        target:
          entity_id: switch.smart_switch_2005085264796725581548e1e91b6e71_outlet
        data: {}
  mode: restart
- id: '1713560829714'
  alias: Kitchen Presence Control
  description: 'Turns on the kitchen light when presence is detected and turns it
    off after no presence is detected for 10 minutes.

    '
  trigger:
  - platform: state
    entity_id: binary_sensor.presence_sensor_fp2_05d5_presence_sensor_3
    to: 'on'
    id: turn_on
  - platform: state
    entity_id: binary_sensor.presence_sensor_fp2_05d5_presence_sensor_3
    to: 'off'
    for:
      minutes: 10
    id: turn_off
  action:
  - choose:
    - conditions:
      - condition: trigger
        id: turn_on
      sequence:
      - service: light.turn_on
        target:
          entity_id: light.smart_switch_1904113165571939082834298f1de973
    - conditions:
      - condition: trigger
        id: turn_off
      sequence:
      - service: light.turn_off
        target:
          entity_id: light.smart_switch_1904113165571939082834298f1de973
  mode: restart
- id: '1713751501778'
  alias: Setup TV Watching Environment with YouTube TV
  description: Prepares the living room for watching TV, turns on YouTube TV, and
    resumes the last watched channel when presence is detected on the couch for 30
    seconds.
  trigger:
  - platform: state
    entity_id: binary_sensor.presence_sensor_fp2_05d5_presence_sensor_9
    to: 'on'
    for:
      seconds: 20
  action:
  - service: remote.turn_on
    target:
      entity_id: remote.valhalla_tv
  - delay: 00:00:05
  - service: media_player.play_media
    target:
      entity_id: media_player.valhalla_tv
    data:
      media_content_type: app
      media_content_id: com.google.android.youtube.tvunplugged
  - service: light.turn_on
    target:
      entity_id: light.island_lights
    data:
      brightness_pct: 10
  - service: light.turn_off
    target:
      entity_id:
      - light.living_room_lights
      - light.kitchen_lights
  mode: single
- id: '1713751536666'
  alias: Pause TV and Restore Lights
  description: Pauses the TV and turns lights back on when no presence is detected
    for more than a minute.
  trigger:
  - platform: state
    entity_id: binary_sensor.presence_sensor_fp2_05d5_presence_sensor_9
    to: 'off'
    for:
      minutes: 1
  action:
  - service: media_player.media_pause
    target:
      entity_id: media_player.valhalla_tv
  - service: light.turn_on
    target:
      entity_id: light.living_room_lights
  - service: light.turn_on
    target:
      entity_id: light.kitchen_lights
  mode: single
- id: '1714440145541'
  alias: Drying Cycle
  description: Gradually decreases humidity over 4 days for drying cannabis.
  trigger: []
  action:
  - repeat:
      count: 4
      sequence:
      - service: input_number.set_value
        target:
          entity_id: input_number.ezcure_humidity_target
        data:
          value: '{{ 60 - (5 * repeat.index) }}'
      - delay: '24:00:00'
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.day2
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.day3
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.day4
  mode: single
- id: '1714440160133'
  alias: Curing Mode Automation
  description: Start curing mode by managing humidity with the fan/dehumidifier.
  trigger:
  - platform: state
    entity_id: input_boolean.enable_cure_cycle
    to: 'on'
  condition:
  - condition: state
    entity_id: input_boolean.enable_dry_cycle
    state: 'off'
  action:
  - service: notify.notify
    data:
      message: Curing mode has started. Maintaining optimal humidity.
  - service: switch.turn_on
    target:
      entity_id: switch.ezcure_switch_1
  - delay:
      days: 2
  - service: switch.turn_off
    target:
      entity_id: switch.ezcure_switch_1
  - delay:
      days: 1
  - service: switch.turn_on
    target:
      entity_id: switch.ezcure_switch_1
- id: '1714442475472'
  alias: Set Daily Humidity Target for Drying
  description: Adjusts the target humidity daily during the drying phase.
  trigger:
  - platform: state
    entity_id: input_boolean.enable_dry_cycle
    to: 'on'
  - platform: time
    at: 00:00:01
  condition:
  - condition: state
    entity_id: input_boolean.enable_dry_cycle
    state: 'on'
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ (now().date() - states.input_boolean.enable_dry_cycle.last_changed.date()).days
          == 0 }}'
      sequence:
      - service: input_number.set_value
        data:
          entity_id: input_number.daily_humidity_target
          value: 60
    - conditions:
      - condition: template
        value_template: '{{ (now().date() - states.input_boolean.enable_dry_cycle.last_changed.date()).days
          == 1 }}'
      sequence:
      - service: input_number.set_value
        data:
          entity_id: input_number.daily_humidity_target
          value: 55
    - conditions:
      - condition: template
        value_template: '{{ (now().date() - states.input_boolean.enable_dry_cycle.last_changed.date()).days
          == 2 }}'
      sequence:
      - service: input_number.set_value
        data:
          entity_id: input_number.daily_humidity_target
          value: 50
    - conditions:
      - condition: template
        value_template: '{{ (now().date() - states.input_boolean.enable_dry_cycle.last_changed.date()).days
          == 3 }}'
      sequence:
      - service: input_number.set_value
        data:
          entity_id: input_number.daily_humidity_target
          value: 45
- id: '1714442600222'
  alias: Curing Mode Humidity Control
  description: Manages fan based on real-time humidity readings to maintain desired
    humidity during curing mode.
  trigger:
  - platform: state
    entity_id: input_boolean.enable_cure_cycle
    to: 'on'
  action:
  - repeat:
      while:
      - condition: state
        entity_id: input_boolean.enable_cure_cycle
        state: 'on'
      sequence:
      - choose:
        - conditions:
          - condition: template
            value_template: '{{ states(''sensor.ezcure_humidity'') | float < 55 }}'
          sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.ezcure_switch_1
        - conditions:
          - condition: template
            value_template: '{{ states(''sensor.ezcure_humidity'') | float > 60 }}'
          sequence:
          - service: switch.turn_off
            target:
              entity_id: switch.ezcure_switch_1
      - delay:
          minutes: 10
- id: '1714443432138'
  alias: Adjust Humidity Target Daily
  description: Sets the initial humidity target to 60% and decreases it by 5% each
    day during the drying process.
  trigger:
  - platform: state
    entity_id: input_boolean.enable_dry_cycle
    to: 'on'
  - platform: time
    at: 00:00:01
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: input_boolean.enable_dry_cycle
        state: 'on'
      sequence:
      - service: input_number.set_value
        target:
          entity_id: input_number.daily_humidity_target
        data:
          value: '{{ (60 - 5 * ((as_timestamp(now()) - as_timestamp(states.input_boolean.enable_dry_cycle.last_changed))
            / 86400) | int) }}'
- id: '1714443443828'
  alias: Control Fan Based on Real-time Humidity and Target
  description: Controls the fan based on current sensor readings and a dynamically
    adjusted humidity target.
  trigger:
  - platform: state
    entity_id: sensor.ezcure_humidity
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ states(''sensor.ezcure_humidity'') | float(default=0)
          > states(''input_number.daily_humidity_target'') | float(default=60) }}

          '
      sequence:
      - service: switch.turn_on
        target:
          entity_id: switch.ezcure_switch_1
    - conditions:
      - condition: template
        value_template: '{{ states(''sensor.ezcure_humidity'') | float(default=0)
          < states(''input_number.daily_humidity_target'') | float(default=60) }}

          '
      sequence:
      - service: switch.turn_off
        target:
          entity_id: switch.ezcure_switch_1
- id: '1715565105576'
  alias: Cloner Pump Off
  description: Cycles the switch.cloner_socket_1 on for 15 minutes and then off for
    15 minutes repeatedly
  trigger:
  - platform: time_pattern
    hours: /1
  condition: []
  action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.cloner_sw2
  - delay:
      minutes: 15
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.cloner_sw2
  mode: single
- id: '1717286660452'
  alias: Handle Plex Webhook
  description: ''
  trigger:
  - platform: webhook
    webhook_id: plex_event
    allowed_methods:
    - POST
    - PUT
    - GET
    local_only: false
  action:
  - service: persistent_notification.create
    data:
      message: "Received webhook from Plex: {% if trigger.data is defined and trigger.data
        != {} %}\n  {{ trigger.data | tojson }}\n{% else %}\n  No data received\n{%
        endif %}\n"
      title: Plex Webhook
- id: '1717288368155'
  alias: Auto Update Home Assistant Core and Addons
  description: Automatically updates Home Assistant core and addons daily at 3 AM
  trigger:
  - platform: time
    at: 03:00:00
  action:
  - service: hassio.addon_update
    data:
      addon: core
  - service: hassio.addon_update
    data:
      addon: core_ssh
  - service: hassio.addon_update
    data:
      addon: core_samba
  - service: hassio.addon_update
    data:
      addon: core_mosquitto
  - service: hassio.addon_update
    data:
      addon: core_configurator
  - service: hassio.addon_update
    data:
      addon: a0d7b954_ssh
  - service: hassio.addon_update
    data:
      addon: a0d7b954_vscode
  - service: hassio.addon_update
    data:
      addon: a0d7b954_file_editor
  mode: single
- id: '1717288911871'
  alias: Update HACS nightly
  description: Automatically update all HACS items every night at 2:00 AM
  trigger:
  - platform: time
    at: 02:00:00
  action:
  - service: shell_command.update_hacs
  mode: single
- id: '1717599869413'
  alias: Carbon Filter Control
  description: 'Turn on the carbon filter when motion is detected, and turn off after
    10 minutes of no motion.

    '
  trigger:
  - platform: state
    entity_id: sensor.gymmotion
    to: peaceful
  - platform: state
    entity_id: sensor.gymmotion
    to: none
    for: 00:10:00
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: sensor.gymmotion
        state: peaceful
      sequence:
      - service: switch.turn_on
        target:
          entity_id: switch.cloner_sw2
        data: {}
      - service: system_log.write
        data:
          message: Carbon filter turned on due to motion detected.
          level: debug
    - conditions:
      - condition: state
        entity_id: sensor.gymmotion
        state: none
        for: 00:10:00
      sequence:
      - service: switch.turn_off
        target:
          entity_id: switch.cloner_sw2
        data: {}
      - service: system_log.write
        data:
          message: Carbon filter turned off due to no motion for 10 minutes.
          level: debug
  mode: single
- id: '1718547322676'
  alias: Disable vacuum camera update when docked
  description: ''
  use_blueprint:
    path: PiotrMachowski/disable_vacuum_camera_update_when_docked.yaml
    input:
      vacuum: vacuum.roborock_q5
      camera: camera.xiaomi_cloud_map_extractor
- id: '1719155921407'
  alias: Maintain Grow Room Climate for Vegetative Stage
  description: 'Controls the AC and humidifier to maintain desired humidity, temperature,
    and VPD for cannabis vegetative growth, respecting the irrigation pump schedule.

    '
  trigger:
  - platform: state
    entity_id: sensor.skinnyc_s_grow_vpd
  - platform: state
    entity_id: sensor.skinnyc_s_grow_humidity
  - platform: state
    entity_id: sensor.skinnyc_s_grow_temperature
  - platform: state
    entity_id: switch.4x4_grow_1
  - platform: time
    at:
    - 07:25:00
    - '13:25:00'
    - '16:25:00'
    - '10:25:00'
    - '19:25:00'
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: switch.4x4_grow_1
        state: 'on'
      sequence:
      - service: switch.turn_on
        target:
          entity_id: switch.dehu_2
    - conditions:
      - condition: state
        entity_id: switch.4x4_grow_1
        state: 'off'
      sequence:
      - delay: 00:05:00
      - service: switch.turn_off
        target:
          entity_id: switch.dehu_2
    - conditions:
      - condition: numeric_state
        entity_id: sensor.skinnyc_s_grow_temperature
        above: 82
      sequence:
      - service: climate.set_hvac_mode
        target:
          entity_id: climate.midea_ac_151732604712142
        data:
          hvac_mode: cool
      - service: climate.set_temperature
        target:
          entity_id: climate.midea_ac_151732604712142
        data:
          temperature: 79
    - conditions:
      - condition: numeric_state
        entity_id: sensor.skinnyc_s_grow_humidity
        below: 65
      sequence:
      - service: switch.turn_on
        target:
          entity_id: switch.dehu_2
    - conditions:
      - condition: numeric_state
        entity_id: sensor.skinnyc_s_grow_humidity
        above: 70
      sequence:
      - service: switch.turn_off
        target:
          entity_id: switch.dehu_2
    - conditions:
      - condition: numeric_state
        entity_id: sensor.skinnyc_s_grow_humidity
        above: 75
      sequence:
      - service: climate.set_hvac_mode
        target:
          entity_id: climate.midea_ac_151732604712142
        data:
          hvac_mode: dry
    - conditions:
      - condition: numeric_state
        entity_id: sensor.skinnyc_s_grow_humidity
        below: 68
      sequence:
      - service: climate.set_hvac_mode
        target:
          entity_id: climate.midea_ac_151732604712142
        data:
          hvac_mode: cool
  - service: input_text.set_value
    target:
      entity_id: input_text.grow_room_log
    data:
      value: Grow room climate control ran at {{ now().strftime('%Y-%m-%d %H:%M:%S')
        }}
  mode: single
- id: '1719502704408'
  alias: Notify Car Presence at Gate with Snapshot
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.gatecam_car_occupancy_2
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 45
    from: 'off'
  action:
  - data:
      filename: /config/www/snapshots/gatecam_test.jpg
    target:
      entity_id:
      - camera.gatecam_2
    action: camera.snapshot
  - delay: 00:00:02
    enabled: false
  - data:
      message: A car has been detected at the gate for 30 seconds. Would you like
        to open the gate?
      data:
        image: https://frigate.skinnyc.pro/api/GateCam/latest.jpg?
        actions:
        - action: OPEN_GATE
          title: Open Gate
    action: notify.mobile_app_s24ultra
  - data:
      message: A car has been detected at the gate for 30 seconds. Would you like
        to open the gate?
      data:
        image: https://frigate.skinnyc.pro/api/GateCam/latest.jpg?
        actions:
        - action: OPEN_GATE
          title: Open Gate
    action: notify.mobile_app_iphone_107
- id: '1719502718934'
  alias: Open Gate Action
  description: ''
  trigger:
  - platform: event
    event_type: mobile_app_notification_action
    event_data:
      action: OPEN_GATE
  action:
  - service: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.sonoff_1000b2c509
- id: '1720099020579'
  alias: Run Vacuum if Not Run in Last 12 Hours
  description: Run the vacuum if it hasn't run in the last 12 hours, anytime between
    10 AM and 3 PM
  trigger:
  - platform: time
    at: '10:00:00'
  condition:
  - condition: template
    value_template: '{{ (as_timestamp(now()) - as_timestamp(states(''input_datetime.vacuum_last_run_time'')))
      > 43200 }}

      '
  action:
  - service: vacuum.start
    data: {}
    target:
      entity_id: vacuum.l10s_ultra
  - service: input_number.increment
    target:
      entity_id: input_number.vacuum_daily_runs
  - service: input_datetime.set_datetime
    target:
      entity_id: input_datetime.vacuum_last_run_time
    data_template:
      datetime: '{{ now() }}'
  mode: single
- id: '1720108132531'
  alias: Open Garage Door
  description: ''
  trigger:
  - platform: state
    entity_id: input_boolean.garage_door_open
    to: 'on'
  condition: []
  action:
  - service: google_assistant_sdk.send_text_command
    data:
      command: open garage
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: google_assistant_sdk.send_text_command
    data:
      command: '4228'
  - service: input_boolean.turn_off
    entity_id: input_boolean.garage_door_open
  mode: single
- id: '1720108145102'
  alias: Close Garage Door
  description: ''
  trigger:
  - platform: state
    entity_id: input_boolean.garage_door_close
    to: 'on'
  condition: []
  action:
  - service: google_assistant_sdk.send_text_command
    data:
      command: close garage
  - delay: 00:00:02
  - service: google_assistant_sdk.send_text_command
    data:
      command: '4228'
  - service: input_boolean.turn_off
    entity_id: input_boolean.garage_door_close
  mode: single
- id: '1721176583910'
  alias: Turn on Pool String Lights at Sunset
  description: ''
  trigger:
  - platform: sun
    event: sunset
  action:
  - service: switch.turn_on
    target:
      entity_id: switch.pool_string_lights_socket
  - service: light.turn_on
    target:
      entity_id: light.string_lights
  mode: single
- id: '1721176595872'
  alias: Turn off Pool String Lights at 10:30 PM
  description: ''
  trigger:
  - platform: time
    at: '22:30:00'
  action:
  - service: switch.turn_off
    target:
      entity_id: switch.pool_string_lights_socket
  - service: light.turn_off
    target:
      entity_id: light.string_lights
  mode: single
- id: '1721176646823'
  alias: Turn on Pool Switch on Occupancy after 10:30 PM
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.poolcam_person_occupancy
    to: 'on'
    for: 00:00:30
  condition:
  - condition: time
    after: '22:30:00'
  action:
  - service: switch.turn_on
    target:
      entity_id: switch.pool_string_lights_socket
  - delay: 00:05:00
  - condition: state
    entity_id: binary_sensor.poolcam_person_occupancy
    state: 'off'
  - service: switch.turn_off
    target:
      entity_id: switch.pool_string_lights_socket
  mode: single
- id: '1721178090216'
  alias: Gate Webhook
  description: ''
  triggers:
  - allowed_methods:
    - POST
    - PUT
    local_only: true
    webhook_id: gateunlockw
    trigger: webhook
  conditions: []
  actions:
  - metadata: {}
    data: {}
    target:
      entity_id: switch.sonoff_1000b2c509
    action: switch.turn_on
  mode: single
- id: '1721521059077'
  alias: Bedtime and Random Scenes Automation
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.withings_in_bed
  - platform: time_pattern
    hours: /1
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: binary_sensor.withings_in_bed
        state: 'on'
      - condition: time
        after: '19:00:00'
      sequence:
      - service: light.turn_off
        target:
          entity_id: light.wled
      - delay: 00:00:15
      - service: light.turn_off
        target:
          entity_id: light.wled
    - conditions:
      - condition: state
        entity_id: binary_sensor.withings_in_bed
        state: 'off'
      - condition: time
        after: '19:00:00'
      sequence:
      - service: light.turn_on
        target:
          entity_id: light.wled
        data:
          brightness: 255
          color_name: white
    default:
    - condition: time
      before: '19:00:00'
    - service: light.turn_on
      target:
        entity_id: light.wled
      data:
        effect: '{{ ["Solid", "Blink", "Breath", "Candle", "Chase", "Rainbow"] | random
          }}'
  mode: single
- id: '1722737709136'
  alias: Play Chime on Door Open
  description: Plays a chime on the Everywhere speaker group when a Ring door contact
    sensor is opened and resumes previous media
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.ring_contact_sensor_64140
    - binary_sensor.front_door
    - binary_sensor.back_door
    - binary_sensor.side_door
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: input_number.set_value
    data_template:
      entity_id: input_number.previous_volume
      value: '{{ state_attr("media_player.everywhere", "volume_level") }}'
  - service: media_player.volume_set
    data:
      entity_id: media_player.everywhere
      volume_level: 0.5
  - service: media_player.play_media
    data:
      media_content_type: music
      media_content_id: /homeassistant/www/ERA-2-Ding-Dong-2.mp3
    target:
      entity_id: media_player.office_echo_dot
  - delay: 00:00:05
  - service: media_player.volume_set
    data_template:
      entity_id: media_player.everywhere
      volume_level: '{{ states("input_number.previous_volume") }}'
  - service: media_player.media_play
    data_template:
      entity_id: "{{ states.media_player\n  | selectattr('attributes.entity_id', 'eq',
        'media_player.everywhere')\n  | selectattr('state', 'eq', 'playing')\n  |
        map(attribute='entity_id')\n  | first }}\n"
  mode: single
- id: '1722737966817'
  alias: Test Chime
  description: Simple test to play the chime
  trigger:
  - platform: state
    entity_id: binary_sensor.ring_contact_sensor_64140
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: media_player.play_media
    data:
      media_content_id: /homeassistant/www/ERA-2-Ding-Dong-2.mp3
      media_content_type: music
    target:
      entity_id:
      - media_player.everywhere
      - media_player.office_echo_dot
  mode: single
- id: '1722952174914'
  alias: Vegetative Stage Irrigation
  description: 'Turn on the irrigation pump when soil moisture is below 50% and notify
    when done, ensuring it doesn''t trigger more than once every 15 minutes.

    '
  trigger:
  - platform: numeric_state
    entity_id:
    - sensor.gw1100b_soil_moisture_2
    below: 50
  condition:
  - condition: state
    entity_id: input_boolean.vegetative_stage
    state: 'on'
    enabled: true
  - condition: template
    value_template: '{{ (now() - state_attr(''automation.vegetative_stage_irrigation'',
      ''last_triggered'')).total_seconds() > 900 }}

      '
    enabled: true
  action:
  - data:
      title: Irrigation Debug
      message: Irrigation automation triggered
    enabled: false
    action: notify.mobile_app_s24ultra
  - entity_id: switch.4x4_grow_1
    action: switch.turn_on
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - entity_id: switch.4x4_grow_1
    action: switch.turn_off
  - data:
      title: Irrigation Update
      message: The irrigation pump has finished watering the garden (Vegetative Stage).
    action: notify.mobile_app_s24ultra
  mode: single
- id: '1722999704035'
  alias: Early Flowering Stage Irrigation
  description: Turn on the irrigation pump when soil moisture is below 40% and notify
    when done.
  trigger:
  - platform: numeric_state
    entity_id:
    - sensor.gw1100b_soil_moisture_2
    below: 40
  condition:
  - condition: state
    entity_id: input_boolean.early_flowering_stage
    state: 'on'
  action:
  - entity_id: switch.4x4_grow_1
    action: switch.turn_on
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - entity_id: switch.4x4_grow_1
    action: switch.turn_off
  - data:
      title: Irrigation Update
      message: The irrigation pump has finished watering the garden (Early Flowering
        Stage).
    action: notify.mobile_app_s24ultra
  mode: single
- id: '1722999766581'
  alias: Veg and Mid to Late Flowering Stage Irrigation
  description: 'Turn on the irrigation pump when soil moisture is below 50%, notify
    when done, and ensure the reservoir has sufficient water before irrigation. If
    the reservoir sensor is offline, prompt for manual irrigation.

    '
  trigger:
  - platform: numeric_state
    entity_id: sensor.gw1100b_soil_moisture_2
    below: 50
  condition:
  - condition: state
    entity_id: input_boolean.mid_late_flowering_stage
    state: 'on'
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: binary_sensor.reservoir_level_moisture
        state: 'on'
      sequence:
      - entity_id: switch.4x4_grow_1
        action: switch.turn_on
      - delay:
          minutes: 1
          seconds: 30
      - entity_id: switch.4x4_grow_1
        action: switch.turn_off
      - data:
          title: Irrigation Update
          message: 'The irrigation pump has finished watering the garden (Mid to Late
            Flowering Stage).

            '
        action: notify.mobile_app_s24ultra
    - conditions:
      - condition: state
        entity_id: binary_sensor.reservoir_level_moisture
        state: 'off'
      sequence:
      - data:
          title: Reservoir Alert
          message: 'The reservoir is empty. Do you want to turn on the reservoir pump
            for 10 minutes?

            '
          data:
            actions:
            - action: TURN_ON_PUMP
              title: 'Yes'
            - action: IGNORE
              title: 'No'
        action: notify.mobile_app_s24ultra
      - wait_for_trigger:
        - platform: event
          event_type: mobile_app_notification_action
          event_data:
            action: TURN_ON_PUMP
        timeout: 00:05:00
        continue_on_timeout: false
      - choose:
        - conditions:
          - condition: template
            value_template: '{{ wait.trigger.event.data.action == ''TURN_ON_PUMP''
              }}'
          sequence:
          - entity_id: switch.reservoir_pump
            action: switch.turn_on
          - delay:
              minutes: 10
          - entity_id: switch.reservoir_pump
            action: switch.turn_off
          - entity_id: automation.veg_and_mid_to_late_flowering_stage_irrigation
            action: automation.trigger
    - conditions:
      - condition: state
        entity_id: binary_sensor.reservoir_level_moisture
        state: unavailable
      sequence:
      - data:
          title: Reservoir Sensor Offline
          message: 'The reservoir sensor is offline. Do you want to manually turn
            on the irrigation pump for 10 minutes?

            '
          data:
            actions:
            - action: TURN_ON_PUMP_OFFLINE
              title: 'Yes'
            - action: IGNORE
              title: 'No'
        action: notify.mobile_app_s24ultra
      - wait_for_trigger:
        - platform: event
          event_type: mobile_app_notification_action
          event_data:
            action: TURN_ON_PUMP_OFFLINE
        timeout: 00:05:00
        continue_on_timeout: false
      - choose:
        - conditions:
          - condition: template
            value_template: '{{ wait.trigger.event.data.action == ''TURN_ON_PUMP_OFFLINE''
              }}'
          sequence:
          - entity_id: switch.reservoir_pump
            action: switch.turn_on
          - delay:
              minutes: 10
          - entity_id: switch.reservoir_pump
            action: switch.turn_off
          - entity_id: automation.veg_and_mid_to_late_flowering_stage_irrigation
            action: automation.trigger
  mode: single
- id: '1722999807836'
  alias: Late Flowering to Pre-Harvest Irrigation
  description: Turn on the irrigation pump when soil moisture is below 60% and notify
    when done.
  trigger:
  - platform: numeric_state
    entity_id:
    - sensor.gw1100b_soil_moisture_1
    below: 60
  condition:
  - condition: state
    entity_id: input_boolean.late_flowering_pre_harvest
    state: 'on'
  action:
  - service: switch.turn_on
    entity_id: switch.4x4_grow_1
  - delay: 00:03:00
  - service: switch.turn_off
    entity_id: switch.4x4_grow_1
  - service: notify.mobile_app_s24ultra
    data:
      title: Irrigation Update
      message: The irrigation pump has finished watering the garden (Late Flowering
        to Pre-Harvest Stage).
  mode: single
- id: '1724033974669'
  alias: Alert - Bathtub Overflow Detected
  description: Notify and play sound when bathtub overflow is detected
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.bathtub_overflow_sensor_moisture
    to: 'on'
    from: 'off'
  condition:
  - condition: state
    entity_id: device_tracker.s24ultra
    state: home
  action:
  - service: notify.mobile_app_s24ultra
    data:
      title: Bathtub Overflow Alert
      message: Water detected by the bathtub overflow sensor!
      data:
        sound: default
        ttl: 0
        priority: high
  mode: single
- alias: Set AC Temperature at 8 PM
  trigger:
  - platform: time
    at: '20:00:00'
  action:
  - service: climate.set_temperature
    target:
      entity_id: climate.ac_39c8
    data:
      temperature: 78
  id: 4fbf9a7d71a249d7ac33c3749cfafdf0
- alias: Set AC Temperature at 8 AM
  trigger:
  - platform: time
    at: 08:00:00
  action:
  - service: climate.set_temperature
    target:
      entity_id: climate.ac_39c8
    data:
      temperature: 70
  id: f6128694c8df400c96324291b4aa0238
- alias: Exhaust Fan Control Based on Outdoor Conditions
  trigger:
  - platform: time_pattern
    minutes: /10
  condition:
  - condition: template
    value_template: "{{ states('sensor.gw1100b_indoor_temperature') | float > states('sensor.outdoor_temperature')
      | float and\n   states('sensor.gw1100b_indoor_humidity') | float > states('sensor.outdoor_humidity')
      | float }}\n"
  action:
  - service: switch.turn_on
    target:
      entity_id: switch.shed_humidifier_socket_1
  - delay: 00:10:00
  - service: switch.turn_off
    target:
      entity_id: switch.shed_humidifier_socket_1
  id: afca1d1efa144382a4af96b0eab1a0f3
- id: '1725508141063'
  alias: Full Grow Room Environmental Control with Fan-Only and Adjustable Dry Mode
  description: Complete grow room control using adjustable temperature in dry mode,
    fan-only, dry mode, and cool mode AC controls, along with dehumidifiers and exhaust
    fan based on VPD.
  trigger:
  - platform: numeric_state
    entity_id: sensor.gw1100b_humidity_1
    above: 68
  - platform: numeric_state
    entity_id: sensor.gw1100b_humidity_1
    below: 65
  - platform: numeric_state
    entity_id: sensor.gw1100b_temperature_1
    above: 78
  - platform: numeric_state
    entity_id: sensor.gw1100b_temperature_1
    below: 74
  condition: []
  action:
  - choose:
    - conditions:
      - condition: numeric_state
        entity_id: sensor.gw1100b_humidity_1
        above: 68
      sequence:
      - target:
          entity_id: humidifier.grow_dehu_2
        action: humidifier.turn_on
      - target:
          entity_id: humidifier.grow_dehu_1
        action: humidifier.turn_on
      - target:
          entity_id: switch.shed_humidifier_switch_1
        action: switch.turn_on
      - target:
          entity_id: climate.shed_ac_none
        data:
          hvac_mode: dry
        action: climate.set_hvac_mode
      - target:
          entity_id: climate.shed_ac_none
        data:
          temperature: 76
        action: climate.set_temperature
      - delay: 00:15:00
    - conditions:
      - condition: numeric_state
        entity_id: sensor.gw1100b_humidity_1
        below: 65
      sequence:
      - target:
          entity_id:
          - humidifier.grow_dehu_2
          - humidifier.grow_dehu_1
        action: humidifier.turn_off
      - choose:
        - conditions:
          - condition: numeric_state
            entity_id: sensor.gw1100b_temperature_1
            below: 78
          sequence:
          - target:
              entity_id: climate.shed_ac_none
            data:
              hvac_mode: fan_only
            action: climate.set_hvac_mode
          - target:
              entity_id: switch.shed_humidifier_switch_1
            action: switch.turn_on
    - conditions:
      - condition: numeric_state
        entity_id: sensor.gw1100b_temperature_1
        above: 78
      sequence:
      - target:
          entity_id: climate.shed_ac_none
        data:
          hvac_mode: cool
        action: climate.set_hvac_mode
      - delay: 00:10:00
    - conditions:
      - condition: numeric_state
        entity_id: sensor.gw1100b_temperature_1
        below: 74
      - condition: state
        entity_id: climate.shed_ac_none
        state: dry
      sequence:
      - target:
          entity_id: switch.shed_humidifier_switch_1
        action: switch.turn_on
      - delay: 00:05:00
  - target:
      entity_id: switch.shed_fans_switch_1
    action: switch.turn_on
  variables:
    vpd_target: "{% if is_state('input_boolean.vegetative_stage', 'on') %}\n  1.2\n{%
      elif is_state('input_boolean.early_flowering_stage', 'on') %}\n  1.3\n{% elif
      is_state('input_boolean.mid_late_flowering_stage', 'on') %}\n  1.4\n{% elif
      is_state('input_boolean.late_flowering_pre_harvest', 'on') %}\n  1.5\n{% else
      %}\n  1.2  # Default value if no stage is selected\n{% endif %}\n"
  mode: single
- id: '1725769085981'
  alias: Ensure Vegetative Shed Lights Off
  trigger:
  - platform: time
    at: '23:45:00'
  - platform: time_pattern
    minutes: /5
  condition:
  - condition: time
    after: '23:45:00'
    before: 05:45:00
  action:
  - repeat:
      sequence:
      - condition: state
        entity_id:
        - switch.veg_shed_1_switch
        - switch.veg_shed_2_switch
        state: 'on'
      - target:
          entity_id:
          - switch.veg_shed_1_switch
          - switch.veg_shed_2_switch
        action: switch.turn_off
      until:
      - condition: state
        entity_id:
        - switch.veg_shed_1_switch
        - switch.veg_shed_2_switch
        state: 'off'
  mode: single
- id: '1725795992709'
  alias: Ensure Vegetative Shed Lights On
  description: ''
  trigger:
  - platform: time
    at: 05:45:00
  - platform: time_pattern
    minutes: /5
  condition:
  - condition: time
    after: 05:45:00
    before: '23:45:00'
  action:
  - repeat:
      sequence:
      - condition: state
        entity_id:
        - switch.veg_shed_1_switch
        - switch.veg_shed_2_switch
        state: 'off'
      - target:
          entity_id:
          - switch.veg_shed_1_switch
          - switch.veg_shed_2_switch
        action: switch.turn_on
      until:
      - condition: state
        entity_id:
        - switch.veg_shed_1_switch
        - switch.veg_shed_2_switch
        state: 'on'
  mode: single
- id: '1729918381447'
  alias: Forward OMI Webhook to Node-RED
  description: ''
  trigger:
  - platform: webhook
    webhook_id: omi_integration_webhook
    allowed_methods:
    - POST
    - PUT
    local_only: true
  condition: []
  action:
  - data:
      url: http://192.168.1.175:1880/omi_integration_webhook
      method: post
      headers:
        Content-Type: application/json
      data: "{\n  \"text\": \"{{ trigger.json.segments[0].text }}\"\n}\n"
    action: rest_command.http_request
  mode: single
- id: '1730427691899'
  alias: Debug Webhook
  description: ''
  triggers:
  - webhook_id: omi_voice
    trigger: webhook
  actions:
  - data:
      title: Webhook Received
      message: 'Got webhook data: {{ trigger.json }}'
    action: persistent_notification.create
  mode: single
- id: '1732104340789'
  alias: Pool Control
  description: Controls the pool pump and light
  triggers:
  - at: '10:00:00'
    trigger: time
  - at: '20:00:00'
    trigger: time
  - entity_id:
    - switch.pool_pump_socket_1
    to: 'on'
    trigger: state
  - entity_id:
    - switch.pool_pump_socket_1
    to: 'off'
    trigger: state
  conditions: []
  actions:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ trigger.platform == ''time'' and trigger.now.strftime(''%H:%M:%S'')
          == ''10:00:00'' }}'
      sequence:
      - target:
          entity_id: switch.pool_pump_socket_1
        action: switch.turn_on
        data: {}
    - conditions:
      - condition: template
        value_template: '{{ trigger.platform == ''time'' and trigger.now.strftime(''%H:%M:%S'')
          == ''20:00:00'' }}'
      sequence:
      - target:
          entity_id: switch.pool_pump_socket_1
        action: switch.turn_off
        data: {}
    - conditions:
      - condition: template
        value_template: '{{ trigger.platform == ''state'' and trigger.to_state.state
          == ''on'' }}'
      - condition: sun
        after: sunset
      sequence:
      - target:
          entity_id: switch.pool_light
        action: switch.turn_on
        data: {}
    - conditions:
      - condition: template
        value_template: '{{ trigger.platform == ''state'' and trigger.to_state.state
          == ''off'' }}'
      sequence:
      - target:
          entity_id: switch.pool_light
        action: switch.turn_off
        data: {}
  mode: single
- id: '1735346994065'
  alias: 'Gate Relay '
  description: ''
  triggers:
  - type: turned_on
    device_id: 3e1a551dd3c7859e74afd83b88d37f18
    entity_id: a11a22086f8348c28db181f83143d8ac
    domain: switch
    trigger: device
    for:
      hours: 1
      minutes: 0
      seconds: 0
  conditions: []
  actions:
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.gate_relay
  mode: single
- id: '1736105899369'
  alias: Notify when children detected in the pool zone
  description: Send a notification with a snapshot when a person is detected in the
    pool zone
  triggers:
  - topic: frigate/events
    trigger: mqtt
  conditions:
  - condition: template
    value_template: "{{\n  trigger.payload_json['type'] == 'new' and\n  trigger.payload_json['label']
      == 'person' and\n  'pool_zone' in trigger.payload_json['zones'] and\n  trigger.payload_json['area']
      >= 500 and\n  trigger.payload_json['area'] <= 2000\n}}\n"
  actions:
  - data:
      message: Child detected in the pool area!
      title: Pool Alert
      data:
        image: 'https://ha.skinnyc.pro/api/frigate/notifications/{{ trigger.payload_json[''id'']
          }}/snapshot.jpg

          '
        clickAction: 'https://ha.skinnyc.pro/api/frigate/events/{{ trigger.payload_json[''id'']
          }}

          '
    action: notify.mobile_app
  - action: shell_command.save_pool_snapshot
- id: '1736870581934'
  alias: Gate Relay Webhook
  description: ''
  triggers:
  - trigger: webhook
    allowed_methods:
    - POST
    - PUT
    local_only: false
    webhook_id: gaterelay
  conditions: []
  actions:
  - type: turn_on
    device_id: 3e1a551dd3c7859e74afd83b88d37f18
    entity_id: a11a22086f8348c28db181f83143d8ac
    domain: switch
  mode: single
- id: '1737163235344'
  alias: jane train relay
  description: ''
  triggers:
  - trigger: webhook
    allowed_methods:
    - POST
    - PUT
    local_only: false
    webhook_id: janetrain
  conditions: []
  actions:
  - type: turn_on
    device_id: 14cf11ea112d1b9daf0491287a044711
    entity_id: 306150f55f6a792ad538a523b7496d00
    domain: switch
  mode: single
- id: '1740353559683'
  alias: Reservoir Alert and Pump Control
  description: Monitor reservoir level and control pump via notifications
  triggers:
  - entity_id: binary_sensor.reservoir_level_moisture
    to: dry
    trigger: state
  conditions: []
  actions:
  - data:
      message: Reservoir level is low!
      title: Reservoir Alert
      data:
        actions:
        - action: TURN_ON_PUMP
          title: Turn on pump for 15 minutes
    action: notify.mobile_app_pixel_9_pro_xl
  mode: single
- id: '1740353572392'
  alias: Handle Pump Notification Action
  description: Turn on pump when notification action is triggered
  triggers:
  - event_type: mobile_app_notification_action
    event_data:
      action: TURN_ON_PUMP
    trigger: event
  conditions: []
  actions:
  - target:
      entity_id: switch.4x4_grow_2
    action: switch.turn_on
  - delay: 00:15:00
  - target:
      entity_id: switch.4x4_grow_2
    action: switch.turn_off
  mode: single
- id: '1741048926981'
  alias: Vedge Shed Exhaust Fan Control
  description: ''
  triggers:
  - minutes: '0'
    trigger: time_pattern
  - minutes: /10
    trigger: time_pattern
  conditions: []
  actions:
  - choose:
    - conditions:
      - condition: numeric_state
        entity_id: sensor.your_outdoor_temperature_sensor
        above: 85
      sequence:
      - target:
          entity_id: switch.clone_rack
        action: switch.turn_on
        data: {}
    - conditions:
      - condition: numeric_state
        entity_id: sensor.your_outdoor_temperature_sensor
        below: 85
      - condition: template
        value_template: '{{ now().minute == 0 }}'
      sequence:
      - target:
          entity_id: switch.clone_rack
        action: switch.turn_on
        data: {}
      - delay: 00:10:00
      - target:
          entity_id: switch.clone_rack
        action: switch.turn_off
        data: {}
    default: []
  mode: restart
- id: '1741118076732'
  alias: AC Daily Schedule
  description: ''
  triggers:
  - at: '22:30:00'
    id: bedtime
    trigger: time
  - at: 08:00:00
    id: morning
    trigger: time
  - at: '15:00:00'
    id: afternoon
    trigger: time
  actions:
  - choose:
    - conditions:
      - condition: trigger
        id: bedtime
      sequence:
      - data:
          temperature: 70
        action: climate.set_temperature
        target:
          device_id: ef6fbce0da986107413bbabd4daa9a56
    - conditions:
      - condition: trigger
        id: morning
      sequence:
      - data:
          temperature: 76
        action: climate.set_temperature
        target:
          device_id: ef6fbce0da986107413bbabd4daa9a56
    - conditions:
      - condition: trigger
        id: afternoon
      sequence:
      - data:
          temperature: 74
        action: climate.set_temperature
        target:
          device_id: ef6fbce0da986107413bbabd4daa9a56
  mode: single
- id: '1741141125194'
  alias: Reservoir Mixing Pump Circulation
  description: ''
  triggers:
  - trigger: time_pattern
    minutes: '15'
  conditions:
  - type: is_moist
    condition: device
    device_id: 6b07d0995a4dcc7f1adb698364b3172e
    entity_id: bdacb6c6b20b0f29ca09e705359975ce
    domain: binary_sensor
    enabled: false
  actions:
  - type: turn_on
    device_id: 6f7878375e96b788a8d5f4dae51eeb30
    entity_id: f5a21662d5fadad9b75f275df28af5c8
    domain: switch
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
  - type: turn_off
    device_id: 6f7878375e96b788a8d5f4dae51eeb30
    entity_id: f5a21662d5fadad9b75f275df28af5c8
    domain: switch
  mode: single
- id: '1744546839878'
  alias: Flower Room - Expert RH Control (Max 55% - Using IF Actions)
  description: Prioritizes RH <= 55%. Corrected invalid sequence structure by using
    IF/THEN/ELSE actions instead of sequential conditions.
  triggers:
  - minutes: /2
    trigger: time_pattern
  - entity_id: sensor.gw1100b_humidity_1
    above: 55
    trigger: numeric_state
  - entity_id: input_boolean.rh_lockout
    to:
    - 'on'
    - 'off'
    trigger: state
  actions:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ rh >= rh_limit }}'
      sequence:
      - data:
          message: RH EMERGENCY ({{ rh }}% >= {{ rh_limit }}%). Temp={{ temp }}°F.
            Engaging max dehumidification.
          level: warning
        action: system_log.write
      - target:
          entity_id: '{{ lockout_boolean }}'
        action: input_boolean.turn_on
      - action: script.flower_room_dehu_on
      - if:
        - condition: template
          value_template: '{{ temp > temp_threshold_for_dry_mode }}'
        then:
        - data:
            message: 'RH EMERGENCY: Calling AC DRY script.'
            level: info
          action: system_log.write
        - action: script.flower_room_ac_dry
        else:
        - data:
            message: 'RH EMERGENCY: Calling AC COOL ASSIST script.'
            level: info
          action: system_log.write
        - action: script.flower_room_ac_cool_assist
    - conditions:
      - condition: template
        value_template: '{{ is_lockout_active }}'
      sequence:
      - if:
        - condition: template
          value_template: '{{ rh < rh_lockout_exit_target }}'
        then:
        - data:
            message: RH Lockout Active, RH {{ rh }}% < {{ rh_lockout_exit_target }}%.
              Starting exit delay.
            level: debug
          action: system_log.write
        - delay: '{{ lockout_exit_delay }}'
        - condition: template
          value_template: '{{ states(rh_sensor) | float(0) < rh_lockout_exit_target
            }}'
        - data:
            message: Exiting RH Lockout.
            level: info
          action: system_log.write
        - target:
            entity_id: '{{ lockout_boolean }}'
          action: input_boolean.turn_off
        else:
        - data:
            message: RH Lockout Active. RH={{ rh }}%. Continuing dehumidification.
            level: debug
          action: system_log.write
        - action: script.flower_room_dehu_on
        - action: script.flower_room_ac_cool_assist
    - conditions:
      - condition: template
        value_template: '{{ not is_lockout_active }}'
      sequence:
      - data:
          message: Normal Operation. RH={{ rh }}%.
          level: debug
        action: system_log.write
      - action: script.flower_room_dehu_off
      - choose:
        - conditions:
          - condition: template
            value_template: '{{ temp < temp_low_comfort }}'
          sequence:
          - action: script.flower_room_ac_heat_comfort
        - conditions:
          - condition: template
            value_template: '{{ temp > temp_high_comfort }}'
          sequence:
          - action: script.flower_room_ac_cool_comfort
        default:
          sequence:
          - action: script.flower_room_ac_fan_only
  mode: single
  variables:
    rh_sensor: sensor.gw1100b_humidity_1
    temp_sensor: sensor.gw1100b_temperature_1
    lockout_boolean: input_boolean.rh_lockout
    rh_limit: 55
    rh_lockout_exit_target: 50
    temp_threshold_for_dry_mode: 70
    temp_low_comfort: 62
    temp_high_comfort: 78
    lockout_exit_delay: 00:10:00
    rh: '{{ states(rh_sensor) | float(0) }}'
    temp: '{{ states(temp_sensor) | float(0) }}'
    is_lockout_active: '{{ is_state(lockout_boolean, ''on'') }}'
- id: '1744769677790'
  alias: Home Assistant Auto-update on a schedule base
  description: ''
  use_blueprint:
    path: edwardtfn/auto_update_scheduled.yaml
    input:
      schedule_entity: schedule.updates
      verbose_logging_bool: true
- *id001
- *id001
- id: '1758839619209'
  alias: Greg smoking
  description: ''
  triggers:
  - type: turned_off
    device_id: 754d691bd20cd1418a7b695ee9520581
    entity_id: f5930fa5112971f97a86b15d5031990f
    domain: switch
    trigger: device
  conditions: []
  actions:
  - type: turn_on
    device_id: 754d691bd20cd1418a7b695ee9520581
    entity_id: f5930fa5112971f97a86b15d5031990f
    domain: switch
  mode: single
- id: wyatt_tv_kill_switch
  alias: Wyatt – TV Kill Switch
  description: ''
  triggers:
  - device_id: c9e1ec24bf364d69ed31013617676311
    domain: remote
    entity_id: 910e991b15c2333f825a4da1b0c45d0d
    type: turned_on
    trigger: device
  - entity_id: input_boolean.wyatt_tv_kill_switch
    to: 'on'
    trigger: state
  conditions:
  - condition: state
    entity_id: input_boolean.wyatt_tv_kill_switch
    state: 'on'
  actions:
  - delay: 00:00:30
  - choose:
    - conditions:
      - condition: state
        entity_id: 910e991b15c2333f825a4da1b0c45d0d
        state: 'on'
      sequence:
      - target:
          device_id: c9e1ec24bf364d69ed31013617676311
        action: remote.turn_off
  mode: restart
- id: wyatt_tv_kill_switch
  alias: Wyatt – TV Kill Switch
  description: ''
  triggers:
  - device_id: c9e1ec24bf364d69ed31013617676311
    domain: remote
    entity_id: 910e991b15c2333f825a4da1b0c45d0d
    type: turned_on
    trigger: device
  - entity_id: input_boolean.wyatt_tv_kill_switch
    to: 'on'
    trigger: state
  conditions:
  - condition: state
    entity_id: input_boolean.wyatt_tv_kill_switch
    state: 'on'
  actions:
  - delay: 00:00:30
  - choose:
    - conditions:
      - condition: state
        entity_id: 910e991b15c2333f825a4da1b0c45d0d
        state: 'on'
      sequence:
      - target:
          device_id: c9e1ec24bf364d69ed31013617676311
        action: remote.turn_off
  mode: restart
- id: wyatt_tv_kill_switch
  alias: Wyatt – TV Kill Switch
  description: ''
  triggers:
  - device_id: c9e1ec24bf364d69ed31013617676311
    domain: remote
    entity_id: 910e991b15c2333f825a4da1b0c45d0d
    type: turned_on
    trigger: device
  - entity_id: input_boolean.wyatt_tv_kill_switch
    to: 'on'
    trigger: state
  conditions:
  - condition: state
    entity_id: input_boolean.wyatt_tv_kill_switch
    state: 'on'
  actions:
  - delay: 00:00:30
  - choose:
    - conditions:
      - condition: state
        entity_id: 910e991b15c2333f825a4da1b0c45d0d
        state: 'on'
      sequence:
      - target:
          device_id: c9e1ec24bf364d69ed31013617676311
        action: remote.turn_off
  mode: restart
- id: wyatt_tv_kill_switch
  alias: Wyatt – TV Kill Switch 2
  triggers:
  - device_id: c9e1ec24bf364d69ed31013617676311
    domain: remote
    entity_id: 910e991b15c2333f825a4da1b0c45d0d
    type: turned_on
    trigger: device
  - entity_id: input_boolean.wyatt_tv_kill_switch
    to: 'on'
    trigger: state
  conditions:
  - condition: state
    entity_id: input_boolean.wyatt_tv_kill_switch
    state: 'on'
  actions:
  - delay: 00:00:30
  - choose:
    - conditions:
      - condition: state
        entity_id: 910e991b15c2333f825a4da1b0c45d0d
        state: 'on'
      sequence:
      - target:
          device_id: c9e1ec24bf364d69ed31013617676311
        action: remote.turn_off
  mode: restart
- id: wyatt_tv_kill_switch
  alias: 'Wyatt – TV Kill '
  description: ''
  triggers:
  - device_id: c9e1ec24bf364d69ed31013617676311
    domain: remote
    entity_id: 910e991b15c2333f825a4da1b0c45d0d
    type: turned_on
    trigger: device
  - entity_id: input_boolean.wyatt_tv_kill_switch
    to: 'on'
    trigger: state
  conditions:
  - condition: state
    entity_id: input_boolean.wyatt_tv_kill_switch
    state: 'on'
  actions:
  - delay: 00:00:30
  - choose:
    - conditions:
      - condition: state
        entity_id: 910e991b15c2333f825a4da1b0c45d0d
        state: 'on'
      sequence:
      - target:
          device_id: c9e1ec24bf364d69ed31013617676311
        action: remote.turn_off
  mode: restart
- id: wyatt_tv_kill_switch_qn85cd
  alias: Wyatt – TV Kill Switch (Samsung QN85CD)
  description: ''
  triggers:
  - entity_id: media_player.samsung_qn85cd_85
    to: 'on'
    trigger: state
  - entity_id: input_boolean.wyatt_tv_kill_switch
    to: 'on'
    trigger: state
  conditions:
  - condition: state
    entity_id: input_boolean.wyatt_tv_kill_switch
    state: 'on'
  actions:
  - choose:
    - conditions:
      - condition: state
        entity_id: media_player.samsung_qn85cd_85
        state: 'on'
      sequence:
      - delay: 00:00:30
      - condition: state
        entity_id: media_player.samsung_qn85cd_85
        state: 'on'
      - target:
          entity_id: media_player.samsung_qn85cd_85
        action: media_player.turn_off
    default: []
  mode: restart
- id: wyatt_tv_kill_switch_qn85cd
  alias: Wyatt – TV Kill Switch (Samsung QN85CD)
  triggers:
  - entity_id: media_player.samsung_qn85cd_85
    to: 'on'
    trigger: state
  - entity_id: input_boolean.wyatt_tv_kill_switch
    to: 'on'
    trigger: state
  conditions:
  - condition: state
    entity_id: input_boolean.wyatt_tv_kill_switch
    state: 'on'
  actions:
  - choose:
    - conditions:
      - condition: state
        entity_id: media_player.samsung_qn85cd_85
        state: 'on'
      sequence:
      - delay: 00:00:30
      - condition: state
        entity_id: media_player.samsung_qn85cd_85
        state: 'on'
      - target:
          entity_id: media_player.samsung_qn85cd_85
        action: media_player.turn_off
    default: []
  mode: restart
- id: wyatt_tv_kill_switch_qn85cd
  alias: Wyatt – TV Kill Switch (Samsung QN85CD)
  description: ''
  triggers:
  - entity_id: media_player.samsung_qn85cd_85
    to: 'on'
    trigger: state
  - entity_id: input_boolean.wyatt_tv_kill_switch
    to: 'on'
    trigger: state
  conditions:
  - condition: state
    entity_id: input_boolean.wyatt_tv_kill_switch
    state: 'on'
  actions:
  - choose:
    - conditions:
      - condition: state
        entity_id: media_player.samsung_qn85cd_85
        state: 'on'
      sequence:
      - delay: 00:00:30
      - condition: state
        entity_id: media_player.samsung_qn85cd_85
        state: 'on'
      - target:
          entity_id: media_player.samsung_qn85cd_85
        action: media_player.turn_off
    default: []
  mode: restart
- id: wyatt_tv_kill_switch_qn85cd
  alias: Wyatt – TV Kill Switch (Samsung QN85CD)
  triggers:
  - entity_id: media_player.samsung_qn85cd_85
    to: 'on'
    trigger: state
  - entity_id: input_boolean.wyatt_tv_kill_switch
    to: 'on'
    trigger: state
  conditions:
  - condition: state
    entity_id: input_boolean.wyatt_tv_kill_switch
    state: 'on'
  actions:
  - choose:
    - conditions:
      - condition: state
        entity_id: media_player.samsung_qn85cd_85
        state: 'on'
      sequence:
      - delay: 00:00:30
      - condition: state
        entity_id: media_player.samsung_qn85cd_85
        state: 'on'
      - target:
          entity_id: media_player.samsung_qn85cd_85
        action: media_player.turn_off
  mode: restart
- id: '1761500887524'
  alias: Ikea Smoke Exhaust
  description: ''
  triggers:
  - device_id: a97cbc4f9f1b04ed715879a1d60963ff
    domain: zha
    type: remote_button_short_press
    subtype: turn_on
    trigger: device
  conditions: []
  actions:
  - type: toggle
    device_id: 622264283bdf820bf1de8731f1364f01
    entity_id: 3f558b47c6b236d0d273c3df2b9bcdc3
    domain: switch
  mode: single
- id: '1762139135950'
  alias: Smoking Fan Auto
  description: ''
  triggers:
  - trigger: state
    entity_id:
    - binary_sensor.esp32c3_smoke_sensor_smoke_detected
    from: 'off'
    to: 'on'
  conditions: []
  actions:
  - type: turn_on
    device_id: 622264283bdf820bf1de8731f1364f01
    entity_id: 3f558b47c6b236d0d273c3df2b9bcdc3
    domain: switch
  - wait_for_trigger:
    - trigger: state
      entity_id:
      - binary_sensor.esp32c3_smoke_sensor_smoke_detected
      from: 'on'
      to: 'off'
      for:
        hours: 0
        minutes: 0
        seconds: 10
  - type: turn_off
    device_id: 622264283bdf820bf1de8731f1364f01
    entity_id: 3f558b47c6b236d0d273c3df2b9bcdc3
    domain: switch
  mode: single
- id: game_kill_switch_on
  alias: Game Kill Switch ON
  description: Throttle PS5 and Meta Quest to 1 Mbps
  triggers:
  - trigger: state
    entity_id: input_boolean.game_kill_switch
    to: 'on'
  conditions: []
  actions:
  - action: rest_command.game_kill_switch_on
  mode: single
- id: game_kill_switch_off
  alias: Game Kill Switch OFF
  description: Remove rate limits from PS5 and Meta Quest
  triggers:
  - trigger: state
    entity_id: input_boolean.game_kill_switch
    to: 'off'
  conditions: []
  actions:
  - action: rest_command.game_kill_switch_off
  mode: single


# ── Solar Pool Pump - Full Control ─────────────────────────────────────────
# Takes precedence over old "Pool Control" automation (disabled below).
# Logic:
#   1. Solar Start: export > 3.5kW → start pump (any time sunrise→5pm, battery > 20%)
#   2. Solar Stop: grid importing > 300W for 4 min → stop ONLY if daily runtime >= 2h
#      (keeps running on grid until minimum is met, then stops to avoid waste)
#   3. Minimum Guarantee: at 11am, if runtime < 2h and pump is off → force start
#      Runs until either: solar dropout (and >= 2h done), or 8pm hard stop
#   4. End of Day: 8pm hard stop regardless
#   5. Pool Light: replaces light logic from old Pool Control

- id: 'solar_pool_pump_start'
  alias: Solar Pool Pump - Solar Start
  description: >
    Starts pool pump when solar is exporting more than pump draw (3.5kW buffer).
    Runs any time from sunrise to 5pm. Minimum 20% battery SOC.
  triggers:
    - trigger: numeric_state
      entity_id: sensor.grid_boss_4434850618_grid_power
      below: -3500
      for:
        minutes: 3
  conditions:
    - condition: state
      entity_id: switch.pool_pump_socket_1
      state: 'off'
    - condition: sun
      after: sunrise
    - condition: time
      before: '17:00:00'
    - condition: numeric_state
      entity_id: sensor.eg4_battery_soc_voltage
      above: 20
  actions:
    - action: switch.turn_on
      target:
        entity_id: switch.pool_pump_socket_1
    - action: notify.mobile_app_chad_s_pixel_7_ii
      continue_on_error: true
      data:
        title: "☀️ Pool Pump - Solar Start"
        message: >
          Solar exporting {{ states('sensor.grid_boss_4434850618_grid_power') | float | abs | round(0) }}W.
          Pool pump started on solar power.
  mode: single

- id: 'solar_pool_pump_stop'
  alias: Solar Pool Pump - Solar Dropout Stop
  description: >
    Stops pump when solar drops and grid starts importing — but only after daily
    minimum runtime (2h) is satisfied. 20-min motor protection guard.
  triggers:
    - trigger: numeric_state
      entity_id: sensor.grid_boss_4434850618_grid_power
      above: 300
      for:
        minutes: 4
  conditions:
    - condition: state
      entity_id: switch.pool_pump_socket_1
      state: 'on'
    - condition: numeric_state
      entity_id: sensor.pool_pump_daily_runtime
      above: 2
    - condition: template
      value_template: >
        {{ (now() - states.switch.pool_pump_socket_1.last_changed).total_seconds() > 1200 }}
  actions:
    - action: switch.turn_off
      target:
        entity_id: switch.pool_pump_socket_1
    - action: notify.mobile_app_chad_s_pixel_7_ii
      continue_on_error: true
      data:
        title: "🌥️ Pool Pump - Solar Dropout"
        message: >
          Grid importing {{ states('sensor.grid_boss_4434850618_grid_power') | float | round(0) }}W,
          daily runtime {{ states('sensor.pool_pump_daily_runtime') | float | round(1) }}h.
          Pump stopped to avoid running on grid.
  mode: single

- id: 'solar_pool_pump_minimum_guarantee'
  alias: Solar Pool Pump - Minimum Runtime Guarantee
  description: >
    At 11am, if pool hasn't run 2 hours yet, force it on regardless of solar.
    Ensures pool chemistry / filtration minimum even on cloudy days.
  triggers:
    - trigger: time
      at: '11:00:00'
  conditions:
    - condition: numeric_state
      entity_id: sensor.pool_pump_daily_runtime
      below: 2
    - condition: state
      entity_id: switch.pool_pump_socket_1
      state: 'off'
  actions:
    - action: switch.turn_on
      target:
        entity_id: switch.pool_pump_socket_1
    - action: notify.mobile_app_chad_s_pixel_7_ii
      continue_on_error: true
      data:
        title: "🌀 Pool Pump - Minimum Runtime"
        message: >
          Only {{ states('sensor.pool_pump_daily_runtime') | float | round(1) }}h runtime today.
          Running pump to hit 2h minimum.
  mode: single

- id: 'solar_pool_pump_end_of_day'
  alias: Solar Pool Pump - End of Day Stop
  description: Hard stop at 8pm regardless of solar or runtime.
  triggers:
    - trigger: time
      at: '20:00:00'
  conditions:
    - condition: state
      entity_id: switch.pool_pump_socket_1
      state: 'on'
  actions:
    - action: switch.turn_off
      target:
        entity_id: switch.pool_pump_socket_1
  mode: single

- id: 'pool_light_pump_sync'
  alias: Pool Light - Follows Pump at Night
  description: >
    Turns pool light on when pump is on after sunset, off when pump turns off.
    Replaces light logic from the now-disabled Pool Control automation.
  triggers:
    - trigger: state
      entity_id: switch.pool_pump_socket_1
      to: 'on'
    - trigger: state
      entity_id: switch.pool_pump_socket_1
      to: 'off'
  actions:
    - choose:
        - conditions:
            - condition: template
              value_template: "{{ trigger.to_state.state == 'on' }}"
            - condition: sun
              after: sunset
          sequence:
            - action: switch.turn_on
              target:
                entity_id: switch.sonoff_100136ea65
        - conditions:
            - condition: template
              value_template: "{{ trigger.to_state.state == 'off' }}"
          sequence:
            - action: switch.turn_off
              target:
                entity_id: switch.sonoff_100136ea65
  mode: single
