From aec3e1eb2fe5d2d3078d62ece958f47fe38b9502 Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Sun, 20 Jul 2025 14:49:11 -0400 Subject: [PATCH] Refactor automation scripts to enhance garbage day announcements and thermostat control. Removed deprecated responsibilities automation and updated related references in speech engine and templates. Added new automation for setting thermostats to eco mode when away. --- README.md | 4 +- config/automation/Speech/announcements.yaml | 2 +- config/automation/Speech/home_stats.yaml | 2 +- config/automation/Speech/nest.yaml | 23 ------ .../automation/Speech/responsibilities.yaml | 22 ------ config/automation/away.yaml | 22 ++++++ .../homeassistant/motion_light.yaml | 49 ------------ .../homeassistant/notify_leaving_zone.yaml | 41 ---------- .../confirmable_notification.yaml | 74 ------------------- config/input_boolean/hidden_booleans.yaml | 4 - config/packages/climate.yaml | 49 +++++++++++- config/script/speech_engine.yaml | 5 +- config/templates/speech/briefing.yaml | 6 +- 13 files changed, 76 insertions(+), 227 deletions(-) delete mode 100755 config/automation/Speech/nest.yaml delete mode 100755 config/automation/Speech/responsibilities.yaml delete mode 100755 config/blueprints/automation/homeassistant/motion_light.yaml delete mode 100755 config/blueprints/automation/homeassistant/notify_leaving_zone.yaml delete mode 100755 config/blueprints/script/homeassistant/confirmable_notification.yaml diff --git a/README.md b/README.md index cb41c646..cc0aa94b 100755 --- a/README.md +++ b/README.md @@ -259,10 +259,8 @@ Defining Guest Mode - /config/input_boolean/home_modes.yaml#L1-L4
Using Guest mode as a condition - /config/script/speech_engine.yaml#L26-L28

-Track garbage days and chore days for the kids. Voice reminders and Alexa intergration/request for info.'

+

Track garbage days. Voice reminders and Alexa intergration/request for info.'

-Defining responsibilities trigger - /config/input_boolean/hidden_booleans.yaml#L5-L7
- Responsibility Speech Code - /config/script/speech_engine.yaml#L56-L68

diff --git a/config/automation/Speech/announcements.yaml b/config/automation/Speech/announcements.yaml index 2ea66270..19ba173a 100755 --- a/config/automation/Speech/announcements.yaml +++ b/config/automation/Speech/announcements.yaml @@ -50,7 +50,7 @@ {%- endmacro -%} {{greeting_sentence(person)}} - call_responsibilities: 1 + call_garbage_day: 1 call_no_announcement: 1 call_garage_check: 1 call_window_check: 1 diff --git a/config/automation/Speech/home_stats.yaml b/config/automation/Speech/home_stats.yaml index 8c8b8195..d3f78f19 100755 --- a/config/automation/Speech/home_stats.yaml +++ b/config/automation/Speech/home_stats.yaml @@ -26,7 +26,7 @@ - service: script.speech_engine data: call_inside_weather: 1 - call_responsibilities: 1 + call_garbage_day: 1 call_outside_weather: 1 call_garage_check: 1 call_window_check: 1 diff --git a/config/automation/Speech/nest.yaml b/config/automation/Speech/nest.yaml deleted file mode 100755 index b9394a05..00000000 --- a/config/automation/Speech/nest.yaml +++ /dev/null @@ -1,23 +0,0 @@ -###################################################################### -## Announce when one of the nests kick in -## Announce over all Chromecast Audios -###################################################################### -- alias: 'Nest Status' - id: 7812fdaf-a3f8-498b-8f07-28e977e528fe - trigger: - - - platform: state - entity_id: - - climate.downstairs - - climate.upstairs - from: 'off' - - action: - - service: script.speech_engine - data: - NestStatus: "The {{ trigger.entity_id.split('.')[1].split('_')[0]}} {{ trigger.entity_id.split('.')[1].split('_')[1]}} has now been turned on for {{(trigger.to_state.state)}}." - call_window_check: 1 - - - - diff --git a/config/automation/Speech/responsibilities.yaml b/config/automation/Speech/responsibilities.yaml deleted file mode 100755 index 86835f6d..00000000 --- a/config/automation/Speech/responsibilities.yaml +++ /dev/null @@ -1,22 +0,0 @@ -#------------------------------------------- -# Responsibilities Announcement -# Description: Triggers a speech announcement for daily responsibilities -# -# Features: -# - Announces garbage day and recycling reminders -# - Triggered by an input_boolean entity -# -# Integration: Uses speech_engine script for announcements -# Follow me on https://www.vcloudinfo.com/click-here -#------------------------------------------- -- alias: 'responsibilities' - id: f39bd8db-a348-4024-a6a6-a3e3c836646c - trigger: - - platform: state - entity_id: input_boolean.responsibilities - to: 'on' - - action: - - service: script.speech_engine - data: - call_responsibilities: 1 diff --git a/config/automation/away.yaml b/config/automation/away.yaml index 5382fe34..5369dcda 100755 --- a/config/automation/away.yaml +++ b/config/automation/away.yaml @@ -41,3 +41,25 @@ entity_id: switch.back_landscaping +# Set thermostats to eco mode when everyone is away +- alias: 'Set Thermostats to Eco When Away' + id: 1e2d3c4b-eco-thermostat-away + mode: single + trigger: + - platform: state + entity_id: group.family + to: 'not_home' + condition: + - condition: state + entity_id: group.family + state: 'not_home' + - condition: state + entity_id: input_boolean.guest_mode + state: 'off' + action: + - service: climate.set_preset_mode + data: + entity_id: + - climate.downstairs + - climate.upstairs + preset_mode: 'eco' diff --git a/config/blueprints/automation/homeassistant/motion_light.yaml b/config/blueprints/automation/homeassistant/motion_light.yaml deleted file mode 100755 index c10d3691..00000000 --- a/config/blueprints/automation/homeassistant/motion_light.yaml +++ /dev/null @@ -1,49 +0,0 @@ -blueprint: - name: Motion-activated Light - domain: automation - source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml - input: - motion_entity: - name: Motion Sensor - selector: - entity: - domain: binary_sensor - device_class: motion - light_target: - name: Light - selector: - target: - entity: - domain: light - no_motion_wait: - name: Wait time - description: Time to wait until the light should be turned off. - default: 120 - selector: - number: - min: 0 - max: 3600 - unit_of_measurement: seconds - -# If motion is detected within the delay, -# we restart the script. -mode: restart -max_exceeded: silent - -trigger: - platform: state - entity_id: !input motion_entity - from: "off" - to: "on" - -action: - - service: light.turn_on - target: !input light_target - - wait_for_trigger: - platform: state - entity_id: !input motion_entity - from: "on" - to: "off" - - delay: !input no_motion_wait - - service: light.turn_off - target: !input light_target diff --git a/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml b/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml deleted file mode 100755 index 9b79396f..00000000 --- a/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml +++ /dev/null @@ -1,41 +0,0 @@ -blueprint: - name: Send notification when a person leaves a zone - domain: automation - source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/notify_leaving_zone.yaml - input: - person_entity: - name: Person - selector: - entity: - domain: person - zone_entity: - name: Zone - selector: - entity: - domain: zone - notify_device: - name: Device to notify - description: Device needs to run the official Home Assistant app to receive notifications. - selector: - device: - integration: mobile_app - -trigger: - platform: state - entity_id: !input person_entity - -variables: - zone_entity: !input zone_entity - zone_state: "{{ states[zone_entity].name }}" - person_entity: !input person_entity - person_name: "{{ states[person_entity].name }}" - -condition: - condition: template - value_template: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}" - -action: - domain: mobile_app - type: notify - device_id: !input notify_device - message: "{{ person_name }} has left {{ zone_state }}" diff --git a/config/blueprints/script/homeassistant/confirmable_notification.yaml b/config/blueprints/script/homeassistant/confirmable_notification.yaml deleted file mode 100755 index ae170eab..00000000 --- a/config/blueprints/script/homeassistant/confirmable_notification.yaml +++ /dev/null @@ -1,74 +0,0 @@ -blueprint: - name: Confirmable Notification - description: >- - A script that sends an actionable notification with a confirmation before - running the specified action. - domain: script - source_url: https://github.com/home-assistant/core/blob/master/homeassistant/components/script/blueprints/confirmable_notification.yaml - input: - notify_device: - name: Device to notify - description: Device needs to run the official Home Assistant app to receive notifications. - selector: - device: - integration: mobile_app - title: - name: "Title" - description: "The title of the button shown in the notification." - default: "" - selector: - text: - message: - name: "Message" - description: "The message body" - selector: - text: - confirm_text: - name: "Confirmation Text" - description: "Text to show on the confirmation button" - default: "Confirm" - selector: - text: - confirm_action: - name: "Confirmation Action" - description: "Action to run when notification is confirmed" - default: [] - selector: - action: - dismiss_text: - name: "Dismiss Text" - description: "Text to show on the dismiss button" - default: "Dismiss" - selector: - text: - dismiss_action: - name: "Dismiss Action" - description: "Action to run when notification is dismissed" - default: [] - selector: - action: - -mode: restart - -sequence: - - alias: "Send notification" - domain: mobile_app - type: notify - device_id: !input notify_device - title: !input title - message: !input message - data: - actions: - - action: "CONFIRM" - title: !input confirm_text - - action: "DISMISS" - title: !input dismiss_text - - alias: "Awaiting response" - wait_for_trigger: - - platform: event - event_type: mobile_app_notification_action - - choose: - - conditions: "{{ wait.trigger.event.data.action == 'CONFIRM' }}" - sequence: !input confirm_action - - conditions: "{{ wait.trigger.event.data.action == 'DISMISS' }}" - sequence: !input dismiss_action diff --git a/config/input_boolean/hidden_booleans.yaml b/config/input_boolean/hidden_booleans.yaml index 2532f064..1d561dec 100755 --- a/config/input_boolean/hidden_booleans.yaml +++ b/config/input_boolean/hidden_booleans.yaml @@ -1,7 +1,3 @@ home_stats: name: Home Stats initial: off - -responsibilities: - name: responsibilities - initial: off diff --git a/config/packages/climate.yaml b/config/packages/climate.yaml index bbd7187c..65dd34a2 100644 --- a/config/packages/climate.yaml +++ b/config/packages/climate.yaml @@ -1,6 +1,8 @@ -# -------------------------------------------------- -# AC Filter‑change runtime tracker -# -------------------------------------------------- +###################################################################### +## AC related automations +## For more info visit https://www.vcloudinfo.com/click-here +## Contact: @CCOSTAN +###################################################################### input_datetime: downstairs_last_filter_change: @@ -118,6 +120,19 @@ automation: who: "Carlo" group: "maintenance" + - alias: 'AC Status off Announcement' + id: 7812fdaf-a3f8-498b-8f07-28e977e528fe + trigger: + - platform: state + entity_id: + - climate.downstairs + - climate.upstairs + from: 'off' + action: + - service: script.speech_engine + data: + NestStatus: "The {{ trigger.entity_id.split('.')[1].split('_')[0]}} {{ trigger.entity_id.split('.')[1].split('_')[1]}} has now been turned on for {{(trigger.to_state.state)}}." + call_window_check: 1 - alias: Prevent Upstairs Nest Below 76 id: 7812fdaf-a3f8-498b-8f07-28e977e528ff @@ -132,3 +147,31 @@ automation: data: entity_id: climate.upstairs temperature: 77 + + - alias: Set Downstairs Nest to 76 When Both in Bed + id: set_downstairs_nest_76_both_in_bed + trigger: + - platform: state + entity_id: + - binary_sensor.sleepnumber_carlo_carlo_is_in_bed + - binary_sensor.sleepnumber_carlo_stacey_is_in_bed + to: 'on' + - platform: numeric_state + entity_id: climate.downstairs + attribute: temperature + above: 76 + condition: + - condition: and + conditions: + - condition: state + entity_id: binary_sensor.sleepnumber_carlo_carlo_is_in_bed + state: 'on' + - condition: state + entity_id: binary_sensor.sleepnumber_carlo_stacey_is_in_bed + state: 'on' + action: + - service: climate.set_temperature + data: + entity_id: climate.downstairs + temperature: 76 + diff --git a/config/script/speech_engine.yaml b/config/script/speech_engine.yaml index 2285cfdf..78d4c324 100755 --- a/config/script/speech_engine.yaml +++ b/config/script/speech_engine.yaml @@ -7,7 +7,7 @@ # call_dark_outside: # call_window_check: # call_garage_check: - # call_responsibilities + # call_garbage_day # call_light_check # call_inside_weather # call_outside_weather @@ -50,9 +50,8 @@ speech_engine: # Include the speech message from the "speech/briefing.yaml" template file speech_message: !include ../templates/speech/briefing.yaml - # Turn off the "input_boolean.home_stats" and "input_boolean.responsibilities" input booleans + # Turn off the "input_boolean.home_stats" - service: input_boolean.turn_off data: entity_id: - input_boolean.home_stats - - input_boolean.responsibilities diff --git a/config/templates/speech/briefing.yaml b/config/templates/speech/briefing.yaml index f49142de..6fa029ea 100755 --- a/config/templates/speech/briefing.yaml +++ b/config/templates/speech/briefing.yaml @@ -21,7 +21,7 @@ The sun has set. I will turn on the outside lights. {%- endmacro -%} - {%- macro responsibilities() -%} + {%- macro garbage_day() -%} {% set day_of_week = now().strftime('%a') %} {% if day_of_week in ['Wed', 'Sun'] %} Today is garbage day. @@ -346,8 +346,8 @@ {{ light_check() }} {% endif %} - {% if call_responsibilities == 1 %} - {{ responsibilities() }} + {% if call_garbage_day == 1 %} + {{ garbage_day() }} {% endif %} {% if now().strftime('%H')|int(0) > 21 %}