Last active
March 7, 2024 23:35
-
-
Save sam2332/64edf263fbca83135dabbf3c13c75a2a to your computer and use it in GitHub Desktop.
Notification_to_take_Medicine.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: Reminder for Medication | |
description: Sends reminders to take medication at a specific time and notifies when medication is not taken. | |
domain: automation | |
input: | |
reminder_time: | |
name: Reminder Time | |
description: The time to send the medication reminder | |
selector: | |
time: {} | |
door_sensor: | |
name: Door Sensor | |
description: The door sensor to check if the person has accessed the medication | |
selector: | |
entity: | |
domain: binary_sensor | |
counter: | |
name: Counter | |
description: The counter to use for tracking medication missed | |
selector: | |
entity: | |
domain: counter | |
notification_device: | |
name: Notification Device | |
description: The device to send the notification to | |
selector: | |
device: | |
integration: mobile_app | |
trigger: | |
- platform: time | |
at: !input reminder_time | |
condition: | |
- condition: state | |
entity_id: !input door_sensor | |
state: 'off' | |
action: | |
- service: counter.increment | |
target: | |
entity_id: !input counter | |
- service: notify.mobile_app | |
target: | |
device_id: !input notification_device | |
data: | |
title: "Reminder!!" | |
message: "Please Take Your Medicine!!" | |
- wait_for_trigger: | |
- platform: state | |
entity_id: !input door_sensor | |
to: 'on' | |
timeout: "00:05:00" | |
continue_on_timeout: true | |
- choose: | |
- conditions: | |
- condition: state | |
entity_id: !input door_sensor | |
state: 'on' | |
sequence: | |
- service: counter.reset | |
target: | |
entity_id: !input counter | |
default: | |
- service: notify.mobile_app | |
target: | |
device_id: !input notification_device | |
data: | |
title: "Missed Medication Alert" | |
message: "You missed your medication time. Please take it as soon as possible." | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment