ADHD Medication Watchdog - Prevent Accidental Double-Dosing with Home Assistant
Hi everyone,
I wanted to share a small but genuinely useful automation I built for myself which might help others, especially those managing ADHD medication or other repeat medications with strict dose intervals.
The Problem
I found that I was often forgetting whether I had already taken my medication, which created a risk of accidentally taking a double dose. I needed a simple system where I could quickly check if I had taken my meds in the last few hours. Something my ADHD brain could glance at easily.
The Solution
This package creates a watchdog timer in Home Assistant which tracks when you last took your medication, based on opening the pill bottle using a simple Zigbee door or contact sensor. Once triggered, it prevents you from accidentally dosing again within the configured window. In my case, 6 hours.
Features
- Tracks medication intake based on opening the pill bottle
- Locks out for 6 hours after taking a dose
- Optional reminder notification if you have not taken your medication in 9 hours
- Clean dashboard badge using Mushroom for instant visual feedback
- Fully self-contained Home Assistant package
Before You Start
This setup uses Home Assistant packages. If you have not used packages before, you may need to enable them by adding this to your configuration.yaml
:
homeassistant:
packages: !include_dir_named packages
Then create a /config/packages/
folder and place the YAML file there.
The Code
Here is the full YAML package you can drop into your /config/packages
folder: Home-Assistant-Configuration/packages/medication_watchdog at master · genestealer/Home-Assistant-Configuration · GitHub
Optional Dashboard Badge (Mushroom)
For quick visual feedback, I use Mushroom’s template-badge
(install via HACS):
type: custom:mushroom-template-badge
entity: binary_sensor.medication_watchdog
icon: mdi:pill
content: |
{% if is_state(entity, 'on') %}
âś… Meds Taken
{% else %}
❌ Not Taken
{% endif %}
color: |
{% if is_state(entity, 'on') %}
green
{% else %}
red
{% endif %}
label: >
{% set delta = (now() - states[entity].last_changed).total_seconds() %}
{{ (delta // 3600) | int }}h
If anyone else finds this helpful or has suggestions for improvements, feel free to share. This has been working really well for me and has already prevented several double doses.