AutomationDataset/markaggar/markaggar_automations.yaml

1834 lines
65 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- id: driveway_video_ai_analysis
alias: Driveway Video AI Analysis
description: Analyze driveway video to detect dog walking activity
triggers:
- entity_id: input_boolean.driveway_video_ready
to: 'on'
trigger: state
conditions:
- condition: state
entity_id: input_boolean.ai_detection_enabled
state: 'on'
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
actions:
- data:
task_name: driveway_video_dog_walk_detection
instructions: "If one or more people and a dog are observed moving from the\
\ street towards the house (e.g., entering the driveway, walking towards the\
\ front door from the road, or otherwise returning home from a walk), classify\
\ this activity as 'ending_dog_walk'. If one or more people and a dog are\
\ observed moving from the house towards the street (e.g., leaving the front\
\ door, walking down the driveway onto the road, or otherwise departing for\
\ a walk), classify this activity as 'starting_dog_walk'. Respond with \"\
starting_dog_walk\" or \"ending_dog_walk\" based on the instructions above.\n\
\ or \n - \"dog_and_people\" - if a dog is seen with a person or\
\ people but not\n appearing to be starting or ending a walk\n -\
\ \"person_only\" - if only a person is seen\n - \"dog_person_separate\"\
\ - if a dog and person are seen in the video but\n not in the same frame.\n\
\ - \"dog_only\" if only a dog is seen \n - \"empty\" if no relevant\
\ activity is detected\n Focus on clear dog walking activity and direction\
\ of travel. In a\n separate paragraph, explain your reasoning.\n"
attachments:
- media_content_id: media-source://media_source/local/ai_image_notifications/driveway_dogwalk_capture.mp4
media_content_type: video/mp4
entity_id: ai_task.google_ai_task
response_variable: driveway_video_response
action: ai_task.generate_data
- target:
entity_id: input_text.driveway_analysis_result
data:
value: '{{ (driveway_video_response.data | lower).split(''
'')[0].strip() }}'
action: input_text.set_value
- target:
entity_id: input_boolean.driveway_video_ready
action: input_boolean.turn_off
data: {}
mode: single
- id: driveway_image_capture
alias: Driveway Video Capture
description: Capture video when both person and pet motion detected in driveway
within 30 seconds, OR when person detected during active walk
triggers:
- entity_id: binary_sensor.driveway_person
to: 'on'
id: person_motion
trigger: state
- entity_id: binary_sensor.driveway_pet
to: 'on'
id: pet_motion
trigger: state
conditions:
- condition: time
after: 06:00:00
before: '22:00:00'
- condition: template
value_template: '{{ states(''input_text.driveway_camera_entity'') not in [''unknown'',
''''] }}
'
actions:
- choose:
- conditions:
- condition: trigger
id: person_motion
- condition: state
state: 'off'
entity_id: binary_sensor.driveway_pet
sequence:
- wait_for_trigger:
- entity_id: binary_sensor.driveway_pet
to: 'on'
trigger: state
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
continue_on_timeout: false
- conditions:
- condition: trigger
id: pet_motion
- condition: state
state: 'off'
entity_id: binary_sensor.driveway_person
sequence:
- wait_for_trigger:
- entity_id: binary_sensor.driveway_person
to: 'on'
trigger: state
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
continue_on_timeout: false
- target:
entity_id: input_datetime.last_walk_detection
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
action: input_datetime.set_datetime
- target:
entity_id: input_boolean.driveway_video_ready
action: input_boolean.turn_off
data: {}
- action: shell_command.ensure_backup_directories
continue_on_error: true
- action: shell_command.backup_driveway_walk_video
continue_on_error: true
- delay: 00:00:02
- target:
entity_id: '{{ states(''input_text.driveway_camera_entity'') }}'
data:
duration: 30
filename: /config/www/local/ai_image_notifications/driveway_dogwalk_capture.mp4
lookback: 15
action: camera.record
- delay: 00:00:32
- target:
entity_id: input_boolean.driveway_video_ready
action: input_boolean.turn_on
data: {}
mode: single
- id: evening_dog_walk_reminder
alias: Evening Dog Walk Reminder
description: Remind to walk dog in the evening (8:30pm-10pm)
trigger:
- platform: time
at: '20:30:00'
- platform: time
at: '21:00:00'
- platform: time
at: '21:30:00'
condition:
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: state
entity_id: input_boolean.walk_in_progress
state: 'off'
- condition: template
value_template: '{% set evening_walk = states(''input_datetime.evening_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ evening_walk == ''unknown''
or evening_walk[:10] != today }}
'
action:
- event: UNotify
event_data_template:
message_speak: Time for your evening dog walk! Don't forget the leash!
message_display: Evening Dog Walk Time 🐕
message: Time for your evening dog walk! It's {{ now().strftime('%H:%M') }}
- grab the leash and have a great walk! 🐕
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: evening_dog_walk
- id: evening_walk_auto_complete
alias: Evening Walk Auto Complete
description: Automatically mark evening walk as complete when detected (3pm-10pm)
trigger:
- platform: state
entity_id: sensor.driveway_analysis
to: ending_dog_walk
condition:
- condition: time
after: '15:00:00'
before: '22:00:00'
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: template
value_template: '{% set evening_walk = states(''input_datetime.evening_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ evening_walk == ''unknown''
or evening_walk[:10] != today }}
'
action:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.walk_in_progress
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.evening_walk_done
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: evening_dog_walk
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: walk_started
- event: UNotify
event_data_template:
message_speak: Excellent job taking the dog for an evening walk! You're amazing!
message_display: Evening Walk Complete! 🎉
message: "Great job taking the dog for their evening walk! You''re amazing!\
\ {% set start_time = states('input_datetime.current_walk_started') %} {%\
\ if start_time != 'unknown' %}\n {% set duration = ((as_timestamp(now())\
\ - as_timestamp(start_time)) / 60) | round(0) %}\n Walk duration: {{ duration\
\ }} minutes.\n{% endif %} \U0001F415❤\n"
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: evening_walk_complete
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: "Evening walk completed at {{ now().strftime('%H:%M') }}. {% set start_time\
\ = states('input_datetime.current_walk_started') %} {% if start_time != 'unknown'\
\ %}\n {% set duration = ((as_timestamp(now()) - as_timestamp(start_time))\
\ / 60) | round(0) %}\n Duration: {{ duration }} minutes.\n{% endif %}\n"
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: evening_walk_status
- id: trigger_family_room_analysis
alias: Trigger Family Room AI Analysis
description: Analyze family room tidiness when person motion detected
trigger:
- platform: state
entity_id: binary_sensor.family_room_person_motion
to: 'on'
- platform: state
entity_id: binary_sensor.family_room_person_motion
to: 'off'
for:
minutes: 2
- platform: state
entity_id: input_boolean.force_family_room_check
to: 'on'
condition:
- condition: state
entity_id: input_boolean.ai_detection_enabled
state: 'on'
- condition: state
entity_id: input_boolean.family_room_monitoring_enabled
state: 'on'
- condition: template
value_template: '{{ states(''input_text.family_room_camera_entity'') not in [''unknown'',
''''] }}
'
- condition: template
value_template: '{{ states(''input_text.ai_task_entity'') not in [''unknown'',
''unavailable'', ''''] }}
'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.force_family_room_check
state: 'on'
- condition: template
value_template: "{% set last_check = states('input_datetime.family_room_last_check')\
\ %} {% if last_check == 'unknown' %}\n true\n{% else %}\n {{ (as_timestamp(now())\
\ - as_timestamp(last_check)) > 300 }}\n{% endif %}\n"
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.family_room_last_check
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- service: camera.snapshot
target:
entity_id: '{{ states(''input_text.family_room_camera_entity'') }}'
data:
filename: /config/www/local/ai_image_notifications/family_room_snapshot.jpg
- service: camera.snapshot
target:
entity_id: '{{ states(''input_text.kitchen_camera_entity'') }}'
data:
filename: /config/www/local/ai_image_notifications/family_room_kitchen_view_snapshot.jpg
- service: ai_task.generate_data
data:
task_name: family_room_tidiness_analysis
instructions: 'Analyze these family room/living room images. Focus ONLY on practical
safety and cleanliness. Rate tidiness 0-100. If below {{ states(''input_number.family_room_cleanliness_threshold'')
}}, respond "needs_tidying" and list issues. If above, respond "tidy". Analysis
of the family_room_kitchen_view_snapshot.jpg should exclude anything that
is the kitchen. The family room is to the top left of the image, near the
couch. If you see dirty dishes on the desk area between the kitchen and the
family room, call that out too, but ignore the general clutter. ONLY flag
these issues: - Food/drinks left out (especially if sticky/messy) - Dishes
with food residue - Items on the floor (tripping hazard) - Spills that need
cleaning IGNORE: blankets on chairs, remotes on tables, books/papers, decorative
items, stuffed animals on furniture, charging cables
'
attachments:
- media_content_id: media-source://media_source/local/ai_image_notifications/family_room_snapshot.jpg
media_content_type: image/jpeg
- media_content_id: media-source://media_source/local/ai_image_notifications/family_room_kitchen_view_snapshot.jpg
media_content_type: image/jpeg
entity_id: ai_task.google_ai_task
response_variable: family_room_ai_response
- service: variable.update_sensor
data:
value: "{% set response = family_room_ai_response.data | lower %} {% if 'needs_tidying'\
\ in response %}\n needs_tidying\n{% elif 'tidy' in response %}\n tidy \
\ \n{% else %}\n unknown\n{% endif %}\n"
attributes:
timestamp: '{{ now() }}'
tasks: "{% set response = family_room_ai_response.data %} {% set ns = namespace(filtered=[])\
\ %} {% for line in response.split('\\n') %}\n {% if not ('needs_tidying'\
\ in line.lower() or 'tidy' in line.lower()) %}\n {% set ns.filtered\
\ = ns.filtered + [line] %}\n {% endif %}\n{% endfor %} {{ ns.filtered\
\ | join('\\n') | trim }}\n"
replace_attributes: true
target:
entity_id: sensor.family_room_tidy_status
- service: input_boolean.turn_off
target:
entity_id: input_boolean.force_family_room_check
- id: family_room_tidying_notification
alias: Family Room Tidying Notification
description: Send notifications when family room needs tidying
trigger:
- platform: state
entity_id: sensor.family_room_analysis
to: needs_tidying
condition:
- condition: state
entity_id: input_boolean.family_room_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: template
value_template: "{% set last_notification = states('input_datetime.last_family_room_notification')\
\ %} {% if last_notification == 'unknown' %}\n true\n{% else %}\n {{ (as_timestamp(now())\
\ - as_timestamp(last_notification)) / 60 > states('input_number.notification_cooldown')\
\ | int }}\n{% endif %}\n"
action:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.last_family_room_notification
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message_speak: Hey Liam, the family room could use some tidying when you have
a chance
message_display: Family Room Needs Tidying 🛋️
message: When you get a chance, {{ state_attr('sensor.family_room_analysis',
'specific_tasks') | default('please tidy up the family room') | lower }}.
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: family_room_tidy
- id: family_room_tidied_acknowledgment
alias: Family Room Tidied Acknowledgment
description: Acknowledge when family room has been tidied
trigger:
- platform: state
entity_id: sensor.family_room_analysis
from: needs_tidying
to: tidy
condition:
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
action:
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: family_room_tidy
- event: UNotify
event_data_template:
message_speak: Fantastic job tidying the family room! You're doing amazing!
message_display: Family Room Tidy! ✨
message: Thanks for tidying up the family room! It looks great - you're amazing!
🌟
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: family_room_tidied
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Family room tidied at {{ now().strftime('%H:%M') }} - excellent work!
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: family_room_status
- id: family_room_tidy_notification
alias: Family Room Tidy Notification
description: Send notifications when family room is analyzed as tidy
trigger:
- platform: state
entity_id: sensor.family_room_analysis
to: tidy
condition:
- condition: state
entity_id: input_boolean.family_room_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: template
value_template: '{% set from_state = trigger.from_state.state if trigger.from_state
else ''unknown'' %} {{ from_state in [''unknown'', ''unavailable'', none] }}
'
action:
- service: notify.parents
data:
title: Family Room Looking Good! ✨
message: The family room is nice and tidy. Great job keeping it organized!
data:
tag: family_room_good
- id: trigger_kitchen_analysis
alias: Trigger Kitchen AI Analysis
description: Analyze kitchen cleanliness when person motion detected
trigger:
- platform: state
entity_id: binary_sensor.kitchen_person_motion
to: 'on'
- platform: state
entity_id: binary_sensor.kitchen_person_motion
to: 'off'
for:
minutes: 2
- platform: state
entity_id: input_boolean.force_kitchen_check
to: 'on'
condition:
- condition: state
entity_id: input_boolean.ai_detection_enabled
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_monitoring_enabled
state: 'on'
- condition: template
value_template: '{{ states(''input_text.kitchen_camera_entity'') not in [''unknown'',
''''] }}
'
- condition: template
value_template: '{{ states(''input_text.ai_task_entity'') not in [''unknown'',
''unavailable'', ''''] }}
'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.force_kitchen_check
state: 'on'
- condition: template
value_template: "{% set last_check = states('input_datetime.kitchen_last_check')\
\ %} {% if last_check == 'unknown' %}\n true\n{% else %}\n {{ (as_timestamp(now())\
\ - as_timestamp(last_check)) > 300 }}\n{% endif %}\n"
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.kitchen_last_check
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- service: camera.snapshot
target:
entity_id: '{{ states(''input_text.kitchen_camera_entity'') }}'
data:
filename: /config/www/local/ai_image_notifications/kitchen_snapshot.jpg
- service: ai_task.generate_data
data:
task_name: kitchen_cleanliness_analysis
instructions: 'Analyze this kitchen image for food safety and basic cleanliness.
Focus on: 1. Food items left out on counters (especially perishable items)
2. Dirty dishes in sink or on counters 3. Spills or messes that could attract
pests 4. General tidiness that affects food preparation safety Categorize
as: - "clean" if kitchen is suitable for food preparation - "needs_attention"
if there are minor issues (few dishes, small spills) - "needs_cleaning" if
there are food safety concerns (food left out, many dirty dishes, significant
mess) Be family-friendly and focus on health/safety rather than perfection.
Respond with just the category, then provide 2-3 specific helpful suggestions.
'
attachments:
- media_content_id: media-source://media_source/local/ai_image_notifications/kitchen_snapshot.jpg
media_content_type: image/jpeg
entity_id: ai_task.google_ai_task
response_variable: kitchen_ai_response
- service: variable.update_sensor
data:
value: "{% if 'needs_cleaning' in kitchen_ai_response.data | lower %}\n needs_cleaning\n\
{% elif 'needs_attention' in kitchen_ai_response.data | lower %}\n needs_attention\n\
{% elif 'clean' in kitchen_ai_response.data | lower %}\n clean\n{% else %}\n\
\ unknown\n{% endif %}\n"
attributes:
timestamp: '{{ now() }}'
tasks: "{% set response = kitchen_ai_response.data %} {% set ns = namespace(filtered=[])\
\ %} {% for line in response.split('\\n') %}\n {% if not ('needs_cleaning'\
\ in line.lower() or 'needs_attention' in line.lower() or 'clean' in line.lower())\
\ %}\n {% set ns.filtered = ns.filtered + [line] %}\n {% endif %}\n\
{% endfor %} {{ ns.filtered | join('\\n') | trim }}\n"
replace_attributes: true
target:
entity_id: sensor.kitchen_clean_status
- service: input_boolean.turn_off
target:
entity_id: input_boolean.force_kitchen_check
- id: kitchen_cleaned_acknowledgment
alias: Kitchen Cleaned Acknowledgment
description: Acknowledge when kitchen has been cleaned
trigger:
- platform: state
entity_id: sensor.kitchen_analysis
from: needs_cleaning
to: clean
condition:
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
action:
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: kitchen_cleanup
- event: UNotify
event_data_template:
message_speak: Awesome job cleaning the kitchen! You're doing great!
message_display: Kitchen Clean! ✨
message: Great job cleaning up the kitchen! It looks fantastic - you're awesome!
🌟
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: kitchen_cleaned
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Kitchen cleaned at {{ now().strftime('%H:%M') }} - great work!
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: kitchen_status
- id: kitchen_cleanup_notification
alias: Kitchen Cleanup Notification
description: Send notifications when kitchen needs cleaning
trigger:
- platform: state
entity_id: sensor.kitchen_analysis
to: needs_cleaning
condition:
- condition: state
entity_id: input_boolean.kitchen_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: template
value_template: "{% set last_notification = states('input_datetime.last_kitchen_notification')\
\ %} {% if last_notification == 'unknown' %}\n true\n{% else %}\n {{ (as_timestamp(now())\
\ - as_timestamp(last_notification)) / 60 > states('input_number.notification_cooldown')\
\ | int }}\n{% endif %}\n"
action:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.last_kitchen_notification
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message_speak: '{% if states(''input_text.notification_target'') == ''liam''
%} Hey Liam, the kitchen needs some attention when you have a moment {% else
%} no {% endif %}
'
message_display: '{% if states(''input_text.notification_target'') == ''liam''
%} Kitchen Needs Cleaning 🍽️ {% else %} no {% endif %}
'
message: Hey, when you're done in the kitchen, {{ state_attr('sensor.kitchen_analysis',
'specific_tasks') | default('please tidy up a bit') | lower }}.
priority: normal
channel: General
aiprompt: 'no'
message_target: '{{ states(''input_text.notification_target'') }}'
tag: kitchen_cleanup
- id: morning_dog_walk_reminder
alias: Morning Dog Walk Reminder
description: Remind to walk dog in the morning/afternoon (12pm-3pm)
trigger:
- platform: time
at: '12:00:00'
- platform: time
at: '12:30:00'
- platform: time
at: '13:00:00'
condition:
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: state
entity_id: input_boolean.walk_in_progress
state: 'off'
- condition: template
value_template: '{% set morning_walk = states(''input_datetime.morning_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ morning_walk == ''unknown''
or morning_walk[:10] != today }}
'
action:
- event: UNotify
event_data_template:
message_speak: Time for your morning dog walk! Don't forget the leash!
message_display: Morning Dog Walk Time 🐕
message: Time for your morning dog walk! It's {{ now().strftime('%H:%M') }}
- grab the leash and have a great walk! 🐕
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: morning_dog_walk
- id: morning_walk_auto_complete
alias: Morning Walk Auto Complete
description: Automatically mark morning walk as complete when detected (6am-3pm)
trigger:
- platform: state
entity_id: sensor.driveway_analysis
to: ending_dog_walk
condition:
- condition: time
after: 06:00:00
before: '15:00:00'
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: template
value_template: '{% set morning_walk = states(''input_datetime.morning_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ morning_walk == ''unknown''
or morning_walk[:10] != today }}
'
action:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.walk_in_progress
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.morning_walk_done
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: morning_dog_walk
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: walk_started
- event: UNotify
event_data_template:
message_speak: Awesome job taking the dog for a morning walk! You're the best!
message_display: Morning Walk Complete! 🎉
message: "Great job taking the dog for their morning walk! You''re awesome!\
\ {% set start_time = states('input_datetime.current_walk_started') %} {%\
\ if start_time != 'unknown' %}\n {% set duration = ((as_timestamp(now())\
\ - as_timestamp(start_time)) / 60) | round(0) %}\n Walk duration: {{ duration\
\ }} minutes.\n{% endif %} \U0001F415❤\n"
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: morning_walk_complete
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: "Morning walk completed at {{ now().strftime('%H:%M') }}. {% set start_time\
\ = states('input_datetime.current_walk_started') %} {% if start_time != 'unknown'\
\ %}\n {% set duration = ((as_timestamp(now()) - as_timestamp(start_time))\
\ / 60) | round(0) %}\n Duration: {{ duration }} minutes.\n{% endif %}\n"
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: morning_walk_status
- id: unclear_walk_return_notification
alias: Unclear Walk Return Notification
description: Notify user when walk return analysis is unclear during active walk
trigger:
- platform: state
entity_id: sensor.driveway_analysis
to: unclear
condition:
- condition: state
entity_id: input_boolean.walk_in_progress
state: 'on'
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
action:
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Someone returned to the driveway during the walk, but I couldn't clearly
see if the dog was with them due to lighting or positioning. Did the walk
just finish?
priority: normal
channel: General
aiprompt: 'no'
message_target: parents
tag: unclear_walk_return
actions:
- action: confirm_walk_complete
title: Yes, Walk Complete ✅
- action: walk_still_ongoing
title: No, Still Walking 🚶‍♂️
- id: handle_unclear_walk_response
alias: Handle Unclear Walk Response
description: Process user's response to unclear walk return notification
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: confirm_walk_complete
id: walk_complete
- platform: event
event_type: mobile_app_notification_action
event_data:
action: walk_still_ongoing
id: still_walking
condition:
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
action:
- event: UNotify
event_data_template:
message: clear_notification
message_target: parents
tag: unclear_walk_return
- choose:
- conditions:
- condition: trigger
id: walk_complete
sequence:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.walk_in_progress
- choose:
- conditions:
- condition: time
after: 06:00:00
before: '15:00:00'
sequence:
- condition: template
value_template: '{% set morning_walk = states(''input_datetime.morning_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ morning_walk ==
''unknown'' or morning_walk[:10] != today }}
'
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.morning_walk_done
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: morning_dog_walk
- event: UNotify
event_data_template:
message_speak: Awesome job with the morning walk! You're the best!
message_display: Morning Walk Complete! 🐕❤️
message: Thanks for walking the dog! Morning walk marked as complete
- you're amazing!
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: walk_acknowledgment
- conditions:
- condition: time
after: '15:00:00'
before: '22:00:00'
sequence:
- condition: template
value_template: '{% set evening_walk = states(''input_datetime.evening_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ evening_walk ==
''unknown'' or evening_walk[:10] != today }}
'
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.evening_walk_done
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: evening_dog_walk
- event: UNotify
event_data_template:
message_speak: Excellent job with the evening walk! You're amazing!
message_display: Evening Walk Complete! 🐕❤️
message: Thanks for walking the dog! Evening walk marked as complete
- you're amazing!
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: walk_acknowledgment
- conditions:
- condition: trigger
id: still_walking
sequence:
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Got it! Walk marked as still in progress. I'll keep monitoring
for the return.
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: walk_acknowledgment
- id: walk_started_detection
alias: Walk Started Detection
description: Detect when someone starts a dog walk and clear reminders
trigger:
- platform: state
entity_id: sensor.driveway_analysis
to: starting_dog_walk
condition:
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.walk_in_progress
state: 'off'
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.walk_in_progress
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.current_walk_started
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: morning_dog_walk
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: evening_dog_walk
- event: UNotify
event_data_template:
message_speak: Great! You're taking the dog for a walk - have a wonderful time!
message_display: Walk Started! 🚶‍♂️🐕
message: Awesome! You're taking the dog for a walk - have a great time together!
🐕❤️
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: walk_started
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Dog walk started at {{ now().strftime('%H:%M') }}.
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: walk_started_status
- id: driveway_video_ai_analysis
alias: Driveway Video AI Analysis
description: Analyze driveway video to detect dog walking activity
triggers:
- entity_id: input_boolean.driveway_video_ready
to: 'on'
trigger: state
conditions:
- condition: state
entity_id: input_boolean.ai_detection_enabled
state: 'on'
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
actions:
- data:
task_name: driveway_video_dog_walk_detection
instructions: "If one or more people and a dog are observed moving from the\
\ street towards the house (e.g., entering the driveway, walking towards the\
\ front door from the road, or otherwise returning home from a walk), classify\
\ this activity as 'ending_dog_walk'.\nIf one or more people and a dog are\
\ observed moving from the house towards the street (e.g., leaving the front\
\ door, walking down the driveway onto the road, or otherwise departing for\
\ a walk), classify this activity as 'starting_dog_walk'.\nRespond with \"\
starting_dog_walk\" or \"ending_dog_walk\" based on the instructions above.\n\
\n or \n\n - \"dog_and_people\" - if a dog is seen with a person\
\ or people but not\n appearing to be starting or ending a walk\n\n \
\ - \"person_only\" - if only a person is seen\n\n - \"dog_person_separate\"\
\ - if a dog and person are seen in the video but\n not in the same frame.\n\
\n - \"dog_only\" if only a dog is seen \n\n - \"empty\" if no relevant\
\ activity is detected\n\n Focus on clear dog walking activity and direction\
\ of travel. In a\n separate paragraph, explain your reasoning.\n"
attachments:
- media_content_id: media-source://media_source/local/ai_image_notifications/driveway_dogwalk_capture.mp4
media_content_type: video/mp4
entity_id: ai_task.google_ai_task
response_variable: driveway_video_response
action: ai_task.generate_data
- target:
entity_id: input_text.driveway_analysis_result
data:
value: '{{ (driveway_video_response.data | lower).split(''
'')[0].strip() }}'
action: input_text.set_value
- target:
entity_id: input_boolean.driveway_video_ready
action: input_boolean.turn_off
data: {}
mode: single
- id: driveway_image_capture
alias: Driveway Video Capture
description: Capture video when both person and pet motion detected in driveway
within 30 seconds, OR when person detected during active walk
triggers:
- entity_id: binary_sensor.driveway_person
to: 'on'
id: person_motion
trigger: state
- entity_id: binary_sensor.driveway_pet
to: 'on'
id: pet_motion
trigger: state
conditions:
- condition: time
after: 06:00:00
before: '22:00:00'
- condition: template
value_template: '{{ states(''input_text.driveway_camera_entity'') not in [''unknown'',
''''] }}
'
actions:
- choose:
- conditions:
- condition: trigger
id: person_motion
- condition: state
state: 'off'
entity_id: binary_sensor.driveway_pet
sequence:
- wait_for_trigger:
- entity_id: binary_sensor.driveway_pet
to: 'on'
trigger: state
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
continue_on_timeout: false
- conditions:
- condition: trigger
id: pet_motion
- condition: state
state: 'off'
entity_id: binary_sensor.driveway_person
sequence:
- wait_for_trigger:
- entity_id: binary_sensor.driveway_person
to: 'on'
trigger: state
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
continue_on_timeout: false
- target:
entity_id: input_datetime.last_walk_detection
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
action: input_datetime.set_datetime
- target:
entity_id: input_boolean.driveway_video_ready
action: input_boolean.turn_off
data: {}
- action: shell_command.ensure_backup_directories
continue_on_error: true
- action: shell_command.backup_driveway_walk_video
continue_on_error: true
- delay: 00:00:02
- target:
entity_id: '{{ states(''input_text.driveway_camera_entity'') }}'
data:
duration: 30
filename: /config/www/local/ai_image_notifications/driveway_dogwalk_capture.mp4
lookback: 15
action: camera.record
- delay: 00:00:32
- target:
entity_id: input_boolean.driveway_video_ready
action: input_boolean.turn_on
data: {}
mode: single
- id: evening_dog_walk_reminder
alias: Evening Dog Walk Reminder
description: Remind to walk dog in the evening (8:30pm-10pm)
trigger:
- platform: time
at: '20:30:00'
- platform: time
at: '21:00:00'
- platform: time
at: '21:30:00'
condition:
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: state
entity_id: input_boolean.walk_in_progress
state: 'off'
- condition: template
value_template: '{% set evening_walk = states(''input_datetime.evening_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ evening_walk == ''unknown''
or evening_walk[:10] != today }}
'
action:
- event: UNotify
event_data_template:
message_speak: Time for your evening dog walk! Don't forget the leash!
message_display: Evening Dog Walk Time 🐕
message: Time for your evening dog walk! It's {{ now().strftime('%H:%M') }}
- grab the leash and have a great walk! 🐕
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: evening_dog_walk
- id: evening_walk_auto_complete
alias: Evening Walk Auto Complete
description: Automatically mark evening walk as complete when detected (3pm-10pm)
trigger:
- platform: state
entity_id: sensor.driveway_analysis
to: ending_dog_walk
condition:
- condition: time
after: '15:00:00'
before: '22:00:00'
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: template
value_template: '{% set evening_walk = states(''input_datetime.evening_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ evening_walk == ''unknown''
or evening_walk[:10] != today }}
'
action:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.walk_in_progress
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.evening_walk_done
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: evening_dog_walk
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: walk_started
- event: UNotify
event_data_template:
message_speak: Excellent job taking the dog for an evening walk! You're amazing!
message_display: Evening Walk Complete! 🎉
message: "Great job taking the dog for their evening walk! You''re amazing!\
\ {% set start_time = states('input_datetime.current_walk_started') %} {%\
\ if start_time != 'unknown' %}\n {% set duration = ((as_timestamp(now())\
\ - as_timestamp(start_time)) / 60) | round(0) %}\n Walk duration: {{ duration\
\ }} minutes.\n{% endif %} \U0001F415❤\n"
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: evening_walk_complete
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: "Evening walk completed at {{ now().strftime('%H:%M') }}. {% set start_time\
\ = states('input_datetime.current_walk_started') %} {% if start_time != 'unknown'\
\ %}\n {% set duration = ((as_timestamp(now()) - as_timestamp(start_time))\
\ / 60) | round(0) %}\n Duration: {{ duration }} minutes.\n{% endif %}\n"
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: evening_walk_status
- id: trigger_family_room_analysis
alias: Trigger Family Room AI Analysis
description: Analyze family room tidiness when person motion detected
trigger:
- platform: state
entity_id: binary_sensor.family_room_person_motion
to: 'on'
- platform: state
entity_id: binary_sensor.family_room_person_motion
to: 'off'
for:
minutes: 2
- platform: state
entity_id: input_boolean.force_family_room_check
to: 'on'
condition:
- condition: state
entity_id: input_boolean.ai_detection_enabled
state: 'on'
- condition: state
entity_id: input_boolean.family_room_monitoring_enabled
state: 'on'
- condition: template
value_template: '{{ states(''input_text.family_room_camera_entity'') not in [''unknown'',
''''] }}
'
- condition: template
value_template: '{{ states(''input_text.ai_task_entity'') not in [''unknown'',
''unavailable'', ''''] }}
'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.force_family_room_check
state: 'on'
- condition: template
value_template: "{% set last_check = states('input_datetime.family_room_last_check')\
\ %} {% if last_check == 'unknown' %}\n true\n{% else %}\n {{ (as_timestamp(now())\
\ - as_timestamp(last_check)) > 300 }}\n{% endif %}\n"
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.family_room_last_check
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- service: camera.snapshot
target:
entity_id: '{{ states(''input_text.family_room_camera_entity'') }}'
data:
filename: /config/www/local/ai_image_notifications/family_room_snapshot.jpg
- service: camera.snapshot
target:
entity_id: '{{ states(''input_text.kitchen_camera_entity'') }}'
data:
filename: /config/www/local/ai_image_notifications/family_room_kitchen_view_snapshot.jpg
- service: ai_task.generate_data
data:
task_name: family_room_tidiness_analysis
instructions: 'Analyze these family room/living room images. Focus ONLY on practical
safety and cleanliness. Rate tidiness 0-100. If below {{ states(''input_number.family_room_cleanliness_threshold'')
}}, respond "needs_tidying" and list issues. If above, respond "tidy".
Analysis of the family_room_kitchen_view_snapshot.jpg should exclude anything
that is the kitchen. The family room is to the top left of the image, near
the couch. If you see dirty dishes on the desk area between the kitchen and
the family room, call that out too, but ignore the general clutter.
ONLY flag these issues: - Food/drinks left out (especially if sticky/messy)
- Dishes with food residue - Items on the floor (tripping hazard) - Spills
that need cleaning
IGNORE: blankets on chairs, remotes on tables, books/papers, decorative items,
stuffed animals on furniture, charging cables
'
attachments:
- media_content_id: media-source://media_source/local/ai_image_notifications/family_room_snapshot.jpg
media_content_type: image/jpeg
- media_content_id: media-source://media_source/local/ai_image_notifications/family_room_kitchen_view_snapshot.jpg
media_content_type: image/jpeg
entity_id: ai_task.google_ai_task
response_variable: family_room_ai_response
- service: variable.update_sensor
data:
value: "{% set response = family_room_ai_response.data | lower %} {% if 'needs_tidying'\
\ in response %}\n needs_tidying\n{% elif 'tidy' in response %}\n tidy \
\ \n{% else %}\n unknown\n{% endif %}\n"
attributes:
timestamp: '{{ now() }}'
tasks: "{% set response = family_room_ai_response.data %} {% set ns = namespace(filtered=[])\
\ %} {% for line in response.split('\\n') %}\n {% if not ('needs_tidying'\
\ in line.lower() or 'tidy' in line.lower()) %}\n {% set ns.filtered\
\ = ns.filtered + [line] %}\n {% endif %}\n{% endfor %} {{ ns.filtered\
\ | join('\\n') | trim }}\n"
replace_attributes: true
target:
entity_id: sensor.family_room_tidy_status
- service: input_boolean.turn_off
target:
entity_id: input_boolean.force_family_room_check
- id: family_room_tidying_notification
alias: Family Room Tidying Notification
description: Send notifications when family room needs tidying
trigger:
- platform: state
entity_id: sensor.family_room_analysis
to: needs_tidying
condition:
- condition: state
entity_id: input_boolean.family_room_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: template
value_template: "{% set last_notification = states('input_datetime.last_family_room_notification')\
\ %} {% if last_notification == 'unknown' %}\n true\n{% else %}\n {{ (as_timestamp(now())\
\ - as_timestamp(last_notification)) / 60 > states('input_number.notification_cooldown')\
\ | int }}\n{% endif %}\n"
action:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.last_family_room_notification
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message_speak: Hey Liam, the family room could use some tidying when you have
a chance
message_display: Family Room Needs Tidying 🛋️
message: When you get a chance, {{ state_attr('sensor.family_room_analysis',
'specific_tasks') | default('please tidy up the family room') | lower }}.
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: family_room_tidy
- id: family_room_tidied_acknowledgment
alias: Family Room Tidied Acknowledgment
description: Acknowledge when family room has been tidied
trigger:
- platform: state
entity_id: sensor.family_room_analysis
from: needs_tidying
to: tidy
condition:
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
action:
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: family_room_tidy
- event: UNotify
event_data_template:
message_speak: Fantastic job tidying the family room! You're doing amazing!
message_display: Family Room Tidy! ✨
message: Thanks for tidying up the family room! It looks great - you're amazing!
🌟
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: family_room_tidied
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Family room tidied at {{ now().strftime('%H:%M') }} - excellent work!
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: family_room_status
- id: family_room_tidy_notification
alias: Family Room Tidy Notification
description: Send notifications when family room is analyzed as tidy
trigger:
- platform: state
entity_id: sensor.family_room_analysis
to: tidy
condition:
- condition: state
entity_id: input_boolean.family_room_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: template
value_template: '{% set from_state = trigger.from_state.state if trigger.from_state
else ''unknown'' %} {{ from_state in [''unknown'', ''unavailable'', none] }}
'
action:
- service: notify.parents
data:
title: Family Room Looking Good! ✨
message: The family room is nice and tidy. Great job keeping it organized!
data:
tag: family_room_good
- id: trigger_kitchen_analysis
alias: Trigger Kitchen AI Analysis
description: Analyze kitchen cleanliness when person motion detected
trigger:
- platform: state
entity_id: binary_sensor.kitchen_person_motion
to: 'on'
- platform: state
entity_id: binary_sensor.kitchen_person_motion
to: 'off'
for:
minutes: 2
- platform: state
entity_id: input_boolean.force_kitchen_check
to: 'on'
condition:
- condition: state
entity_id: input_boolean.ai_detection_enabled
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_monitoring_enabled
state: 'on'
- condition: template
value_template: '{{ states(''input_text.kitchen_camera_entity'') not in [''unknown'',
''''] }}
'
- condition: template
value_template: '{{ states(''input_text.ai_task_entity'') not in [''unknown'',
''unavailable'', ''''] }}
'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.force_kitchen_check
state: 'on'
- condition: template
value_template: "{% set last_check = states('input_datetime.kitchen_last_check')\
\ %} {% if last_check == 'unknown' %}\n true\n{% else %}\n {{ (as_timestamp(now())\
\ - as_timestamp(last_check)) > 300 }}\n{% endif %}\n"
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.kitchen_last_check
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- service: camera.snapshot
target:
entity_id: '{{ states(''input_text.kitchen_camera_entity'') }}'
data:
filename: /config/www/local/ai_image_notifications/kitchen_snapshot.jpg
- service: ai_task.generate_data
data:
task_name: kitchen_cleanliness_analysis
instructions: 'Analyze this kitchen image for food safety and basic cleanliness.
Focus on: 1. Food items left out on counters (especially perishable items)
2. Dirty dishes in sink or on counters 3. Spills or messes that could attract
pests 4. General tidiness that affects food preparation safety
Categorize as: - "clean" if kitchen is suitable for food preparation - "needs_attention"
if there are minor issues (few dishes, small spills) - "needs_cleaning" if
there are food safety concerns (food left out, many dirty dishes, significant
mess)
Be family-friendly and focus on health/safety rather than perfection. Respond
with just the category, then provide 2-3 specific helpful suggestions.
'
attachments:
- media_content_id: media-source://media_source/local/ai_image_notifications/kitchen_snapshot.jpg
media_content_type: image/jpeg
entity_id: ai_task.google_ai_task
response_variable: kitchen_ai_response
- service: variable.update_sensor
data:
value: "{% if 'needs_cleaning' in kitchen_ai_response.data | lower %}\n needs_cleaning\n\
{% elif 'needs_attention' in kitchen_ai_response.data | lower %}\n needs_attention\n\
{% elif 'clean' in kitchen_ai_response.data | lower %}\n clean\n{% else %}\n\
\ unknown\n{% endif %}\n"
attributes:
timestamp: '{{ now() }}'
tasks: "{% set response = kitchen_ai_response.data %} {% set ns = namespace(filtered=[])\
\ %} {% for line in response.split('\\n') %}\n {% if not ('needs_cleaning'\
\ in line.lower() or 'needs_attention' in line.lower() or 'clean' in line.lower())\
\ %}\n {% set ns.filtered = ns.filtered + [line] %}\n {% endif %}\n\
{% endfor %} {{ ns.filtered | join('\\n') | trim }}\n"
replace_attributes: true
target:
entity_id: sensor.kitchen_clean_status
- service: input_boolean.turn_off
target:
entity_id: input_boolean.force_kitchen_check
- id: kitchen_cleaned_acknowledgment
alias: Kitchen Cleaned Acknowledgment
description: Acknowledge when kitchen has been cleaned
trigger:
- platform: state
entity_id: sensor.kitchen_analysis
from: needs_cleaning
to: clean
condition:
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
action:
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: kitchen_cleanup
- event: UNotify
event_data_template:
message_speak: Awesome job cleaning the kitchen! You're doing great!
message_display: Kitchen Clean! ✨
message: Great job cleaning up the kitchen! It looks fantastic - you're awesome!
🌟
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: kitchen_cleaned
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Kitchen cleaned at {{ now().strftime('%H:%M') }} - great work!
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: kitchen_status
- id: kitchen_cleanup_notification
alias: Kitchen Cleanup Notification
description: Send notifications when kitchen needs cleaning
trigger:
- platform: state
entity_id: sensor.kitchen_analysis
to: needs_cleaning
condition:
- condition: state
entity_id: input_boolean.kitchen_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: template
value_template: "{% set last_notification = states('input_datetime.last_kitchen_notification')\
\ %} {% if last_notification == 'unknown' %}\n true\n{% else %}\n {{ (as_timestamp(now())\
\ - as_timestamp(last_notification)) / 60 > states('input_number.notification_cooldown')\
\ | int }}\n{% endif %}\n"
action:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.last_kitchen_notification
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message_speak: '{% if states(''input_text.notification_target'') == ''liam''
%} Hey Liam, the kitchen needs some attention when you have a moment {% else
%} no {% endif %}
'
message_display: '{% if states(''input_text.notification_target'') == ''liam''
%} Kitchen Needs Cleaning 🍽️ {% else %} no {% endif %}
'
message: Hey, when you're done in the kitchen, {{ state_attr('sensor.kitchen_analysis',
'specific_tasks') | default('please tidy up a bit') | lower }}.
priority: normal
channel: General
aiprompt: 'no'
message_target: '{{ states(''input_text.notification_target'') }}'
tag: kitchen_cleanup
- id: morning_dog_walk_reminder
alias: Morning Dog Walk Reminder
description: Remind to walk dog in the morning/afternoon (12pm-3pm)
trigger:
- platform: time
at: '12:00:00'
- platform: time
at: '12:30:00'
- platform: time
at: '13:00:00'
condition:
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.notifications_enabled
state: 'on'
- condition: state
entity_id: input_boolean.walk_in_progress
state: 'off'
- condition: template
value_template: '{% set morning_walk = states(''input_datetime.morning_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ morning_walk == ''unknown''
or morning_walk[:10] != today }}
'
action:
- event: UNotify
event_data_template:
message_speak: Time for your morning dog walk! Don't forget the leash!
message_display: Morning Dog Walk Time 🐕
message: Time for your morning dog walk! It's {{ now().strftime('%H:%M') }}
- grab the leash and have a great walk! 🐕
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: morning_dog_walk
- id: morning_walk_auto_complete
alias: Morning Walk Auto Complete
description: Automatically mark morning walk as complete when detected (6am-3pm)
trigger:
- platform: state
entity_id: sensor.driveway_analysis
to: ending_dog_walk
condition:
- condition: time
after: 06:00:00
before: '15:00:00'
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: template
value_template: '{% set morning_walk = states(''input_datetime.morning_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ morning_walk == ''unknown''
or morning_walk[:10] != today }}
'
action:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.walk_in_progress
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.morning_walk_done
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: morning_dog_walk
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: walk_started
- event: UNotify
event_data_template:
message_speak: Awesome job taking the dog for a morning walk! You're the best!
message_display: Morning Walk Complete! 🎉
message: "Great job taking the dog for their morning walk! You''re awesome!\
\ {% set start_time = states('input_datetime.current_walk_started') %} {%\
\ if start_time != 'unknown' %}\n {% set duration = ((as_timestamp(now())\
\ - as_timestamp(start_time)) / 60) | round(0) %}\n Walk duration: {{ duration\
\ }} minutes.\n{% endif %} \U0001F415❤\n"
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: morning_walk_complete
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: "Morning walk completed at {{ now().strftime('%H:%M') }}. {% set start_time\
\ = states('input_datetime.current_walk_started') %} {% if start_time != 'unknown'\
\ %}\n {% set duration = ((as_timestamp(now()) - as_timestamp(start_time))\
\ / 60) | round(0) %}\n Duration: {{ duration }} minutes.\n{% endif %}\n"
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: morning_walk_status
- id: unclear_walk_return_notification
alias: Unclear Walk Return Notification
description: Notify user when walk return analysis is unclear during active walk
trigger:
- platform: state
entity_id: sensor.driveway_analysis
to: unclear
condition:
- condition: state
entity_id: input_boolean.walk_in_progress
state: 'on'
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
action:
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Someone returned to the driveway during the walk, but I couldn't clearly
see if the dog was with them due to lighting or positioning. Did the walk
just finish?
priority: normal
channel: General
aiprompt: 'no'
message_target: parents
tag: unclear_walk_return
actions:
- action: confirm_walk_complete
title: Yes, Walk Complete ✅
- action: walk_still_ongoing
title: No, Still Walking 🚶‍♂️
- id: handle_unclear_walk_response
alias: Handle Unclear Walk Response
description: Process user's response to unclear walk return notification
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: confirm_walk_complete
id: walk_complete
- platform: event
event_type: mobile_app_notification_action
event_data:
action: walk_still_ongoing
id: still_walking
condition:
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
action:
- event: UNotify
event_data_template:
message: clear_notification
message_target: parents
tag: unclear_walk_return
- choose:
- conditions:
- condition: trigger
id: walk_complete
sequence:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.walk_in_progress
- choose:
- conditions:
- condition: time
after: 06:00:00
before: '15:00:00'
sequence:
- condition: template
value_template: '{% set morning_walk = states(''input_datetime.morning_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ morning_walk ==
''unknown'' or morning_walk[:10] != today }}
'
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.morning_walk_done
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: morning_dog_walk
- event: UNotify
event_data_template:
message_speak: Awesome job with the morning walk! You're the best!
message_display: Morning Walk Complete! 🐕❤️
message: Thanks for walking the dog! Morning walk marked as complete
- you're amazing!
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: walk_acknowledgment
- conditions:
- condition: time
after: '15:00:00'
before: '22:00:00'
sequence:
- condition: template
value_template: '{% set evening_walk = states(''input_datetime.evening_walk_done'')
%} {% set today = now().strftime(''%Y-%m-%d'') %} {{ evening_walk ==
''unknown'' or evening_walk[:10] != today }}
'
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.evening_walk_done
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: evening_dog_walk
- event: UNotify
event_data_template:
message_speak: Excellent job with the evening walk! You're amazing!
message_display: Evening Walk Complete! 🐕❤️
message: Thanks for walking the dog! Evening walk marked as complete
- you're amazing!
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: walk_acknowledgment
- conditions:
- condition: trigger
id: still_walking
sequence:
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Got it! Walk marked as still in progress. I'll keep monitoring
for the return.
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: walk_acknowledgment
- id: walk_started_detection
alias: Walk Started Detection
description: Detect when someone starts a dog walk and clear reminders
trigger:
- platform: state
entity_id: sensor.driveway_analysis
to: starting_dog_walk
condition:
- condition: state
entity_id: input_boolean.dog_walk_monitoring_enabled
state: 'on'
- condition: state
entity_id: input_boolean.walk_in_progress
state: 'off'
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.walk_in_progress
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.current_walk_started
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: morning_dog_walk
- event: UNotify
event_data_template:
message: clear_notification
message_target: liam
tag: evening_dog_walk
- event: UNotify
event_data_template:
message_speak: Great! You're taking the dog for a walk - have a wonderful time!
message_display: Walk Started! 🚶‍♂️🐕
message: Awesome! You're taking the dog for a walk - have a great time together!
🐕❤️
priority: normal
channel: General
aiprompt: 'no'
message_target: liam
tag: walk_started
- event: UNotify
event_data_template:
message_speak: 'no'
message_display: 'no'
message: Dog walk started at {{ now().strftime('%H:%M') }}.
priority: low
channel: General
aiprompt: 'no'
message_target: parents
tag: walk_started_status