- id: holiday_lights_prevent_too_dim alias: Random Holiday Lights Prevent Too Dim trigger: - platform: state entity_id: - light.kids_long_w from: 'off' to: 'on' condition: - condition: state entity_id: group.family state: not_home - condition: time before: input_datetime.holiday_lights_bedtime action: - service: light.turn_on target: entity_id: light.kids_long_w data: brightness: 150 - id: '1643034412279' alias: Welcome Lights description: '' trigger: - platform: state entity_id: group.family from: away to: home condition: - condition: state entity_id: sun.sun state: below_horizon action: - service: homeassistant.turn_on target: entity_id: group.welcome_lights - service: notify.parents data: message: Welcome lights turned on at {{now().strftime("%H:%M")}} - id: debug_matt_location alias: Debug matt location trigger: - platform: state entity_id: device_tracker.matt_pixel_8_pro not_from: null action: - service: notify.mobile_app_matt_pixel_8_pro data: message: Matt is at {{states('device_tracker.matt_pixel_8_pro')}} at {{now().strftime("%H:%M")}} - id: open_garage_matt alias: Open garage when Matt drives home trigger: - platform: state entity_id: device_tracker.matt_pixel_8_pro from: not_home to: - home - HomeStreet1 - HomeStreet2 condition: - condition: state alias: Garage closed entity_id: cover.garage_door state: closed - condition: template alias: Phone connected to car value_template: '{{state_attr(''sensor.matt_pixel_8_pro_bluetooth_connection'', ''connected_paired_devices'') | contains(''B8:9F:09:62:F7:7F (BMW 93379)'') or state_attr(''sensor.matt_pixel_8_pro_bluetooth_connection'', ''connected_paired_devices'') | contains(''00:02:5B:BE:23:C0 (CAR6509)'') or state_attr(''sensor.matt_pixel_8_pro_bluetooth_connection'', ''connected_paired_devices'') | contains(''00:0A:30:92:D6:C7 (Mazda)'')}}' action: - service: cover.stop_cover target: entity_id: cover.garage_door - service: notify.mobile_app_matt_pixel_8_pro data: message: Matt arrived home, opening garage at {{now().strftime("%H:%M")}} - id: open_garage_sara alias: Open garage when Sara drives home trigger: - platform: state entity_id: - device_tracker.saras_iphone_app from: not_home to: - home - HomeStreet1 - HomeStreet2 condition: - condition: state alias: Garage closed entity_id: cover.garage_door state: closed - condition: template alias: Phone connected to car value_template: '{{states(''sensor.saras_iphone14_ssid'') == ''DIRECT-BMW 93379''}}' action: - service: cover.stop_cover target: entity_id: cover.garage_door - service: notify.mobile_app_matt_pixel_8_pro data: message: Sara arrived home, opening garage at {{now().strftime("%H:%M")}} - service: notify.mobile_app_saras_iphone_2 data: message: Sara arrived home, opening garage at {{now().strftime("%H:%M")}} - id: garage_left_open_warn alias: Send a warning if the garage left open trigger: - platform: template value_template: '{{ not(is_state(''cover.garage_door'', ''closed''))}}' for: 00:05:00 action: - service: notify.parents data: message: Garage left open! At {{now().strftime("%H:%M")}} - id: garage_monitoring alias: Debug garage open & close trigger: - platform: state entity_id: cover.garage_door action: - service: notify.mobile_app_matt_pixel_8_pro data: message: Garage is {{states.cover.garage_door.state}} at {{now().strftime("%H:%M")}} - id: sensor_lights alias: Sensor Lights description: Sensor lights combining both sensors and lights trigger: - platform: state entity_id: binary_sensor.lumi_lumi_motion_ac02_iaszone to: 'on' - platform: state entity_id: binary_sensor.front_yard_motion3_motion to: 'on' condition: - condition: numeric_state entity_id: sun.sun attribute: elevation below: 0 action: - alias: Turn on the light service: light.turn_on target: entity_id: - light.front_yard_sensor_light - light.mailbox - light.bin_light data: {} - alias: Set bin light colour service: light.turn_on target: entity_id: light.bin_light data: brightness: 255 hs_color: "{% if is_state('sensor.brisbane_bin_day_recycle', 'on') %}\n [60,60]\n\ {% elif is_state('sensor.brisbane_bin_day', 'on') %}\n [128,33]\n{% else\ \ %}\n [0,0]\n{% endif %}" - alias: Wait until there is no motion from either device wait_template: '{{ not(is_state(''binary_sensor.lumi_lumi_motion_ac02_iaszone'', ''on'')) and not(is_state(''binary_sensor.front_yard_motion3_motion'', ''on'')) }}' - alias: Wait a while longer delay: hours: 0 minutes: 2 seconds: 0 milliseconds: 0 - alias: Turn off the light service: light.turn_off target: entity_id: - light.front_yard_sensor_light - light.mailbox - light.bin_light data: {} mode: restart - id: '1720934399141' alias: Light Back On - Emily Sign description: '' trigger: - platform: state entity_id: - light.emily_sign to: 'off' for: hours: 0 minutes: 0 seconds: 2 condition: [] action: - service: light.turn_on metadata: {} data: {} target: entity_id: light.emily_sign mode: single - id: '1720934399142' alias: Light Back On - Emily Makeup description: '' trigger: - platform: state entity_id: - light.emily_makeup to: 'off' for: hours: 0 minutes: 0 seconds: 2 condition: [] action: - service: light.turn_on metadata: {} data: {} target: entity_id: light.emily_makeup mode: single - id: '1745786335394' alias: EmilyButton1-ReadingTime description: '' triggers: - device_id: 2d52c62b1bbcd0ec31a5901f9fcfa4ee domain: zha type: remote_button_short_press subtype: button_1 trigger: device conditions: [] actions: - action: script.emily_reading_time metadata: {} data: {} mode: single - id: '1745786392915' alias: EmilyButton2-SleepTime description: '' triggers: - device_id: 2d52c62b1bbcd0ec31a5901f9fcfa4ee domain: zha type: remote_button_short_press subtype: button_2 trigger: device conditions: [] actions: - action: script.turn_on metadata: {} data: {} target: entity_id: script.emily_sleep_time mode: single - id: '1745786735917' alias: EmilyButton3-RgbLights description: '' triggers: - device_id: 2d52c62b1bbcd0ec31a5901f9fcfa4ee domain: zha type: remote_button_short_press subtype: button_3 trigger: device conditions: [] actions: - action: light.toggle metadata: {} data: {} target: entity_id: light.emily_rgb_strip mode: single - id: '1745786785985' alias: EmilyButton4-Kitchen description: '' triggers: - device_id: 2d52c62b1bbcd0ec31a5901f9fcfa4ee domain: zha type: remote_button_short_press subtype: button_4 trigger: device conditions: [] actions: - action: light.toggle metadata: {} data: {} target: entity_id: light.kitchen mode: single - id: '1745787427449' alias: TobyButton1-Reading description: '' triggers: - device_id: 5582c9a1d80e85a86f9d66ca5f750b98 domain: zha type: remote_button_short_press subtype: button_1 trigger: device conditions: [] actions: - action: script.toby_reading_time metadata: {} data: {} mode: single - id: '1745787483164' alias: TobyButton2-Sleep description: '' triggers: - device_id: 5582c9a1d80e85a86f9d66ca5f750b98 domain: zha type: remote_button_short_press subtype: button_2 trigger: device conditions: [] actions: - action: script.turn_on metadata: {} data: {} target: entity_id: script.toby_sleep_time mode: single - id: '1745787544962' alias: TobyButton3-FrogLight description: '' triggers: - device_id: 5582c9a1d80e85a86f9d66ca5f750b98 domain: zha type: remote_button_short_press subtype: button_3 trigger: device conditions: [] actions: - action: light.toggle metadata: {} data: {} target: entity_id: light.tobyfroglight mode: single - id: '1745787601152' alias: TobyButton4-Hallway description: '' triggers: - device_id: 5582c9a1d80e85a86f9d66ca5f750b98 domain: zha type: remote_button_short_press subtype: button_4 trigger: device conditions: [] actions: - action: light.toggle metadata: {} data: {} target: entity_id: group.hallway_lights mode: single - id: '1745847668003' alias: EntryLongPress-LeavingHome description: '' triggers: - trigger: state entity_id: - event.lights_entry_button_1 conditions: - condition: state entity_id: event.lights_entry_button_1 attribute: event_type state: Long Press actions: - action: script.turn_on target: entity_id: script.leaving_home mode: single - id: EmilyLongPress-AllOff alias: EmilyLongPress-AllOff description: '' triggers: - trigger: state entity_id: - event.lights_emily_button_1 conditions: - condition: state entity_id: event.lights_emily_button_1 attribute: event_type state: Long Press actions: - action: script.turn_on target: entity_id: script.emily_all_off mode: single - id: TobyLongPress-AllOff alias: TobyLongPress-AllOff description: '' triggers: - trigger: state entity_id: - event.lights_toby_button_1 conditions: - condition: state entity_id: event.lights_toby_button_1 attribute: event_type state: Long Press actions: - action: script.turn_on target: entity_id: script.toby_all_off mode: single - id: fc_ok alias: FC OK initial_state: true trigger: platform: numeric_state entity_id: sensor.e_fc above: 0.6 below: 5.0 for: minutes: 1 condition: [] action: - service: frontend.set_theme data: name: default - id: fc_high alias: FC too high initial_state: true trigger: platform: numeric_state entity_id: sensor.e_fc above: 5.01 for: minutes: 1 condition: [] action: - service: frontend.set_theme data: name: danger - id: fc_low alias: FC too low initial_state: true trigger: platform: numeric_state entity_id: sensor.e_fc below: 0.59 for: minutes: 1 condition: [] action: - service: frontend.set_theme data: name: algae - id: fc_target alias: FC set target initial_state: true trigger: - platform: state entity_id: input_number.fc_target condition: [] action: - service: automation.trigger entity_id: automation.bleach_set - id: holiday_lights_reset alias: Random Holiday Reset Next Time At Dusk trigger: - platform: numeric_state entity_id: sun.sun attribute: elevation below: 1.0 action: - choose: - conditions: - condition: state entity_id: group.family state: not_home sequence: - alias: Turn on lounge service: homeassistant.turn_on target: entity_id: light.lounge - service: input_datetime.set_datetime data_template: entity_id: input_datetime.holiday_lights_starttime time: '{{ now().strftime(''%H:%M:00'') }}' - service: input_datetime.set_datetime data_template: entity_id: input_datetime.holiday_lights_next_change time: '{{ (now() + timedelta(minutes=(range(30,45) | random | int))).strftime(''%H:%M:00'') }}' - id: holiday_lights_toggle alias: Random Holiday Lights Toggle trigger: - platform: state entity_id: - group.family to: not_home - platform: time at: input_datetime.holiday_lights_next_change condition: - condition: state entity_id: group.family state: not_home - condition: time after: input_datetime.holiday_lights_starttime - condition: time before: input_datetime.holiday_lights_bedtime action: - alias: Loop to change lights, but ensure at least one on repeat: sequence: - alias: Flag lights as running service: homeassistant.turn_on target: entity_id: input_boolean.holiday_lights_running - alias: Toggle light service: homeassistant.toggle data_template: entity_id: '{{states(''input_text.holiday_lights_next_to_switch'')}}' - alias: Set next light to change service: input_text.set_value data_template: entity_id: input_text.holiday_lights_next_to_switch value: '{{ state_attr(''group.holiday_lights'',''entity_id'') | random }}' - alias: Delay to wait for light group state delay: 00:00:05 until: - alias: Check if there is at least one light on condition: state entity_id: group.holiday_lights state: 'on' - alias: Set next light change time service: input_datetime.set_datetime data_template: entity_id: input_datetime.holiday_lights_next_change time: '{{ (now() + timedelta(minutes=(range(15,45) | random | int))).strftime(''%H:%M:00'') }}' - id: holiday_lights_off_at_bedtime alias: Random Holiday Lights Off At Bedtime trigger: - platform: time at: input_datetime.holiday_lights_bedtime condition: - condition: state entity_id: group.family state: not_home action: - delay: 00:{{ range(2,30) | random | int }}:00 - service: homeassistant.turn_off entity_id: group.holiday_lights - alias: Flag lights as stopped service: homeassistant.turn_off target: entity_id: input_boolean.holiday_lights_running - id: holiday_lights_stop_when_home alias: Random Holiday Lights Stop When Home trigger: - platform: state entity_id: - group.family to: home condition: - condition: state entity_id: input_boolean.holiday_lights_running state: 'on' action: - alias: Flag lights as stopped service: homeassistant.turn_off target: entity_id: input_boolean.holiday_lights_running - id: muriatic_tank_level_update alias: Acid tank level update initial_state: true trigger: - platform: time_pattern minutes: 1 condition: [] action: - service: input_number.set_value data_template: entity_id: input_number.muriatic_tank value: ' {{ ( states(''input_number.muriatic_tank'')|float - ( states(''sensor.muriatic_on_last_hour'')|float * states(''input_number.muriatic_speed'')|int * 60 / 1000 ) ) | round(2) }} ' - id: muriatic_tank_low alias: Acid tank low initial_state: true trigger: platform: template value_template: '{% if states(''input_number.notify_muriatic_tank'')|int> 0 and states(''sensor.muriatic_tank'')|float < states(''input_number.notify_muriatic_tank'')|float %}true{% endif %}' condition: [] action: - data_template: message: '@{{now().strftime(''%H:%M'')}}[{{now().day}}/{{now().month}}]' title: Muriatic tank low ({{states('input_number.muriatic_tank')|float}} liters )!!! service: notify.admins - id: muriatic_high alias: Acid injection too high cutoff & notification initial_state: true trigger: platform: template value_template: '{% if states(''input_number.notify_muriatic_high'')|float> 0 and states(''sensor.muriatic_on_last_24h'')|float > (states(''input_number.notify_muriatic_high'')|float*100 ) / (states(''input_number.muriatic_speed'')|float *6) %}true{% endif %}' condition: [] action: - service: input_boolean.turn_on entity_id: input_boolean.lock_muriatic - service: notify.admins data_template: message: '{{now().strftime(''%H:%M'')}}[{{now().day}}/{{now().month}}]' title: Muriatic inject blocked ({{states('sensor.muriatic_injected_last_24h')}} injected > {{states('input_number.notify_muriatic_high')}} in 24 hours)!!! - id: muriatic_set alias: Calculate acid to inject today initial_state: true trigger: - platform: state entity_id: - sensor.ph_mean from: unavailable for: 00:15:00 condition: [] action: - service: input_number.set_value data_template: entity_id: input_number.muriatic_inject value: ' {{ ( states(''input_number.pool_capacity'')|float * ( 10 ** (8 - states(''input_number.ph_target'')|float ) - 10 ** (8 - states(''sensor.ph_mean'')|float ) ) * (126.19 / states(''input_number.muriatic_concentration'')|float ),0 )|max |round(0)|int }} ' - service: automation.trigger target: entity_id: automation.run_acid_injection_pump data: skip_condition: false - id: muriatic_inject alias: Run acid injection pump initial_state: true trigger: [] condition: [] action: - condition: state entity_id: input_boolean.lock_muriatic state: 'off' - condition: numeric_state entity_id: input_number.muriatic_inject above: 5.0 below: 2500.0 - condition: state entity_id: binary_sensor.pool_pump_running state: 'on' - service: notify.admins data_template: message: '{{now().strftime(''%H:%M'')}}[{{now().day}}/{{now().month}}]' title: 'Muriatic injection: ({{states(''input_number.muriatic_inject'')}} ml)!!!' - alias: Start acid injection timer service: timer.start target: entity_id: timer.muriatic_injection data: duration: '{{ [0 , 60 * states(''input_number.muriatic_inject'')|float/ states(''input_number.muriatic_speed'')|float ]|max|int }}' - alias: Loop to repeatedly turn the pump on until enough time has elapsed repeat: while: "{{ is_state('timer.muriatic_injection', 'active')\n and is_state('binary_sensor.pool_pump_running',\ \ 'on')\n and is_state('input_boolean.lock_muriatic', 'off')\n and not\ \ is_state('switch.pool_acid_pump', 'unavailable') }}" sequence: - service: switch.turn_on entity_id: switch.pool_acid_pump - delay: 5 - choose: - conditions: '{{ not is_state(''switch.pool_acid_pump'', ''on'') }}' sequence: - service: notify.admins data_template: message: '{{now().strftime(''%H:%M'')}}[{{now().day}}/{{now().month}}]' title: Acid pump didn't turn on, aborting injection. - service: input_boolean.turn_on entity_id: input_boolean.lock_muriatic - wait_template: '{{ is_state(''switch.pool_acid_pump'', ''off'') }}' timeout: 60 - choose: - conditions: '{{ not wait.completed }}' sequence: - service: notify.admins data_template: message: '{{now().strftime(''%H:%M'')}}[{{now().day}}/{{now().month}}]' title: Acid pump didn't turn off, aborting loop but PUMP MAY BE RUNNING!!! - service: switch.turn_off entity_id: switch.pool_acid_pump - service: input_boolean.turn_on entity_id: input_boolean.lock_muriatic - service: notify.admins data_template: message: '{{now().strftime(''%H:%M'')}}[{{now().day}}/{{now().month}}]' title: Muriatic injection end. - id: holiday_light_notifications alias: Holiday light notifications trigger: - platform: state entity_id: - input_boolean.holiday_lights_running to: null action: - service: notify.admins data: message: Holiday lights {% if is_state('input_boolean.holiday_lights_running', 'on') %}started{% else %}stopped{% endif %} - alias: Pool settings factory started id: '1559149839000' initial_state: true trigger: platform: homeassistant event: start condition: condition: state entity_id: input_boolean.factory_started state: 'off' action: - service: input_boolean.turn_on data: entity_id: input_boolean.factory_started - service: input_number.set_value data_template: entity_id: input_number.pool_capacity value: 50 - service: input_number.set_value data_template: entity_id: input_number.fc_target value: 1.5 - service: input_number.set_value data_template: entity_id: input_number.e_fc_adjust value: 0 - service: input_number.set_value data_template: entity_id: input_number.ph_target value: 7.2 - service: input_number.set_value data_template: entity_id: input_number.muriatic_tank value: 10 - service: input_number.set_value data_template: entity_id: input_number.muriatic_concentration value: 20 - service: input_number.set_value data_template: entity_id: input_number.muriatic_speed value: 25 - id: visitors_passthrough alias: Apply visitor person state based on button trigger: - platform: state entity_id: - input_boolean.visitors_at_home - platform: homeassistant event: start action: - service: device_tracker.see data: dev_id: visitors location_name: "{% if is_state('input_boolean.visitors_at_home', 'on') -%}\n\ \ home\n{%- else -%}\n not_home\n{%- endif %}"