Just finished putting together a pill dispenser project centered around the tuya-connected vexa vitamate pro 21. Even though I have 45 yrs experience in systems design & development and 26 coding languages, I couldn’t have finished a project of this size & scope without the help of Mr. Pickle (“Big” to friends) and OpenCode.
Mom came to live with me after my dad passed 2 yrs ago, and I wanted to have this project working while her memory was still solid enough to learn new routines and ask/answer questions. I took responsibility for her meds (20 pills + 2 inhalers & 1 eye drop) about a month ago as we noticed her mind slipping (she’s 84 and diagnosed w/early dementia) and I finally picked up the pill dispenser new on ebay for 1/4 retail.
The attached archive holds all important files and info: pill dispenser yaml for tuya-local (defining the 4 alarm slots), tasker tasks/profiles, ha automations, scripts, blueprints, dashboards, and required entities, and list of important integrations.
Mom takes meds 3x daily: breakfast (morning), dinner, and night. One important design choice was handling morning delivery. Since fracturing her back, Mom usually sleeps in her lift chair in the livingroom, but sometimes takes naps on her bed. Depending on how well she sleeps at night, she might wake anywhere between 6am and 1pm. I designed the project to make the “morning” pills available as soon as she’s awake. The other 2 slots remain pretty static.
So when she wakes (either turning on LR light, or using the google “I’m awake” automation), the code sets the morning device “alarm” time (alarm=dispense time) to current time + 1 min, so those pills are available by the time Mom is ready for breakfast.
I turned off the volume in the VEXA device settings in Tuya because I’m handling all the announcements in HA automations. The device sends status notifications thru my android tuya app that are picked up by tasker/autonotification task to trigger a webhook back to ha. (pills ready, pills taken, pills missed) I used a cheap old android phone that stays at the house to run the Tuya and tasker apps.
I use a hubitat c5 for all of my zigbee/zwave devices, and any virtual devices I need available to the google home environment. I have a virtual rgbw lamp set up there, and a physical kasa rgbw bulb in the LR. When pills are ready, the virtual lamp is set to green. When they’re >2hrs late, it’s set to red. If LR light is on, the physical LR lamp is set to the color of the virtual bulb. If it’s off, the physical lamp will turn on whenever the LR light goes on.
I also cast a “take pills” dashboard onto Mom’s nest hub in her room - it’s at eye level, so it’s easy to see. After she takes the current dose, I re-cast her google calendar (showing 3 days) and reset virtual bulb. I use a text variable to store the currently cast dashboard, and a script to restore that dashboard whenever the nest hub returns to idle.
On Monday mornings, she has to take 1 pill before anything else, then wait 30 mins. I have the morning routine set to annouce the instruction and set a timer, then proceed after 30 mins. At night, she has to take eye drops in addition to the pills, so the night routine announces that special instruction.
All announcements go thru a google media automation to announce on any google speaker in a room where nobody is currently asleep.
All the pill boolean entities are shown on my legacy dashboard, and are reset at 1am.
If I’ve missed anything important, I’ll update this topic as soon as I’m aware.vitamate project files