initial commit

This commit is contained in:
root
2026-06-28 14:27:20 -04:00
commit ae0f1f559e
115 changed files with 30411 additions and 0 deletions
+118
View File
@@ -0,0 +1,118 @@
################################################################################
# cat_medication_tracker_ha.yaml
#
# Home Assistant companion automations for the ESPHome cat medication tracker.
# The device itself resets at midnight; this package adds HA-side controls,
# status sensors, and reminder notifications.
################################################################################
input_button:
reset_cat_medications:
name: "Reset Cat Medications"
icon: mdi:pill-off
template:
- sensor:
- name: "Cats Medicated Today"
unique_id: cats_medicated_today
icon: mdi:cat
state: >
{% set meds = [
states('switch.cat_medication_tracker_penelope_medicated'),
states('switch.cat_medication_tracker_tess_medicated')
] %}
{{ meds | select('equalto', 'on') | list | count }}
- name: "Cats Still Needing Medication"
unique_id: cats_still_needing_medication
icon: mdi:pill-off
state: >
{{ 2 - (states('sensor.cats_medicated_today') | int(0)) }}
automation:
- id: cat_medication_tracker_reset_from_ha
alias: "Cat Medication Tracker - Reset from HA"
trigger:
- platform: state
entity_id: input_button.reset_cat_medications
action:
- service: switch.turn_off
target:
entity_id: switch.cat_medication_tracker_penelope_medicated
- service: switch.turn_off
target:
entity_id: switch.cat_medication_tracker_tess_medicated
- id: cat_medication_tracker_all_done_notify
alias: "Cat Medication Tracker - All cats medicated"
trigger:
- platform: state
entity_id: binary_sensor.cat_medication_tracker_all_cats_medicated
to: "on"
action:
- service: notify.notify
data:
title: "Cat meds done"
message: "Penelope and Tess have both been marked medicated today."
- id: cat_medication_tracker_cat_medicated_notify
alias: "Cat Medication Tracker - Cat medicated notification"
trigger:
- platform: state
entity_id: switch.cat_medication_tracker_penelope_medicated
from: "off"
to: "on"
id: penelope
- platform: state
entity_id: switch.cat_medication_tracker_tess_medicated
from: "off"
to: "on"
id: tess
action:
- variables:
cat_name: >
{% if trigger.id == 'penelope' %}Penelope
{% else %}Tess{% endif %}
- service: notify.mobile_app_joshuas_iphone_of_pain
data:
title: "Cat medication given"
message: "{{ cat_name }} has been marked medicated."
- service: notify.mobile_app_pollys_iphone
data:
title: "Cat medication given"
message: "{{ cat_name }} has been marked medicated."
- id: cat_medication_tracker_evening_reminder
alias: "Cat Medication Tracker - 6PM medication reminder"
trigger:
- platform: time
at: "18:00:00"
condition:
- condition: state
entity_id: binary_sensor.cat_medication_tracker_all_cats_medicated
state: "off"
action:
- service: notify.mobile_app_joshuas_iphone_of_pain
data:
title: "Cat meds still needed"
message: >
{% set ns = namespace(cats=[]) %}
{% if is_state('switch.cat_medication_tracker_penelope_medicated', 'off') %}
{% set ns.cats = ns.cats + ['Penelope'] %}
{% endif %}
{% if is_state('switch.cat_medication_tracker_tess_medicated', 'off') %}
{% set ns.cats = ns.cats + ['Tess'] %}
{% endif %}
{{ ns.cats | join(' and ') }} still need medication.
- service: notify.mobile_app_pollys_iphone
data:
title: "Cat meds still needed"
message: >
{% set ns = namespace(cats=[]) %}
{% if is_state('switch.cat_medication_tracker_penelope_medicated', 'off') %}
{% set ns.cats = ns.cats + ['Penelope'] %}
{% endif %}
{% if is_state('switch.cat_medication_tracker_tess_medicated', 'off') %}
{% set ns.cats = ns.cats + ['Tess'] %}
{% endif %}
{{ ns.cats | join(' and ') }} still need medication.