Advanced medication reminder

It becomes a complex action: A person should not only take the med but select and press it is taken… no no, not good. there would be technical solution to detect the med was not taken and send a notification. My only idea is to use some “smart scale” which reports weight of meds left within some period of time: if one table was taken the weight should be 1 gramm less by 09:00AM. But I could not find such scale yet…

Maybe there is some other solution.

The cheap weighing sensors from ebay or ali are good enough for this. :slight_smile: They measure relatively exact values, and this use case isn’t critical for the values to be very exact. :slight_smile:

Have you tried such a sensor in combination with an ESP?

of course you can check with a scale or something else, but this is no more related to this blueprint :sweat_smile:

the most accurate load cell offers 0 - 100g range… it is not enough for this case. that is the issue

Yes, sure. Just thought it is close topic and still take attention of very tiny group of people.

True, I’ll just leave a short answer and get back to topic. :slight_smile:

But you won’t need to weigh the tablets themself, you just have to weigh the difference. The sensors are exact enough, to mark differences, no matter how much weight this is in total. I tried with one of mine, and it can detect differences that are quite small, where it is def. not working to measure an exact weight (2.5kg off).

If this interests you (and maybe others), open a new thread, could be an interesting discussion. If you do so, please mention me with @paddy0174. :slight_smile:

here

1 Like

Hello,

I use this blueprint but i dont receive any message on my phone ?
I dont understand why is not working
All is ok in my configuration


Can you help me please ?
Thanks in advance

You’ll need to show the automation config and/or the step details of the notification action. MIght also upload the trace (the down arrow button near the top)

Hi @Mati24

I’ve been using this for a bit, and have set up 4 instances for various meds i take (and one for my dog). However, when I mark one as taken it marks others as taken too. Right now, I only selected one, and 3 of the 4 booleans are now ‘true’…all the morning ones. The evening one is still false. Attached are traces of two of them (Flonase is the one i responded to)
Traces:
Flonase trace
Meds automation

Hopefully you can help me figure out what’s going on.

Thanks in advance :slight_smile:

If you change the tag: "medication-reminder" to something unique for each automation, is it better ?

Thanks for the quick response. How would i do that? I see ‘tag’ in the blueprint, but not in the automation config. Would i duplicate it and use the duplicate for one of them (temporarily)?

Or can it be added to the config somehow?

Can you try this tag: "medication-reminder-{{ !input input_boolean }}" instead of tag: "medication-reminder" (two occurences) ?

I made the change and the automations are disabled, Config check says it’s valid though, Did I do it right?

data:
        actions:
        - title: !input 'notification_action_taken'
          action: taken
        - title: !input 'notification_action_later'
          action: later
        - title: !input 'notification_action_skip'
          action: skip
        tag: medication-reminder-{{ !input input_boolean }}
        data:
          tag: medication-reminder-{{ !input input_boolean }}

yes, but try this instead:
tag: !input input_boolean
it should work

same result. New traces:
Flonase

morning meds

do you use android or ios device ?

I found that on android I can add a check to handle different automations by adding

            event_data:
              tag: !input input_boolean

after

        - wait_for_trigger:
            platform: event
            event_type: mobile_app_notification_action

but it will not work on iOS devices after that :frowning:

I didn’t found a way on iOS, sorry

{
“trace”: {
“last_step”: “action/1/repeat/while/0/entity_id/0”,
“run_id”: “7fb46df0d17c03c791452a27031ef4db”,
“state”: “stopped”,
“script_execution”: “finished”,
“timestamp”: {
“start”: “2021-11-09T12:00:00.003463+00:00”,
“finish”: “2021-11-09T12:00:00.029290+00:00”
},
“domain”: “automation”,
“item_id”: “1635160206915”,
“trigger”: “time”,
“trace”: {
“trigger/0”: [
{
“path”: “trigger/0”,
“timestamp”: “2021-11-09T12:00:00.003840+00:00”,
“changed_variables”: {
“this”: {
“entity_id”: “automation.advanced_medication_reminder”,
“state”: “on”,
“attributes”: {
“last_triggered”: “2021-11-08T12:00:00.005137+00:00”,
“mode”: “restart”,
“current”: 0,
“id”: “1635160206915”,
“friendly_name”: “Advanced medication reminder”
},
“last_changed”: “2021-11-05T15:04:16.531271+00:00”,
“last_updated”: “2021-11-08T12:00:00.024240+00:00”,
“context”: {
“id”: “5068688c469c87de9ded4ae12458520f”,
“parent_id”: null,
“user_id”: null
}
},
“trigger”: {
“id”: “0”,
“idx”: “0”,
“platform”: “time”,
“now”: “2021-11-09T13:00:00.001184+01:00”,
“description”: “time”,
“entity_id”: null
}
}
}
],
“action/0”: [
{
“path”: “action/0”,
“timestamp”: “2021-11-09T12:00:00.010584+00:00”,
“changed_variables”: {
“context”: {
“id”: “65d275fb43a1a08185f88c710d7f32d7”,
“parent_id”: null,
“user_id”: null
}
},
“result”: {
“params”: {
“domain”: “input_boolean”,
“service”: “turn_off”,
“service_data”: {},
“target”: {
“entity_id”: [
“input_datetime.medics”
]
}
},
“running_script”: false,
“limit”: 10
}
}
],
“action/1”: [
{
“path”: “action/1”,
“timestamp”: “2021-11-09T12:00:00.022267+00:00”
}
],
“action/1/repeat”: [
{
“path”: “action/1/repeat”,
“timestamp”: “2021-11-09T12:00:00.022775+00:00”,
“changed_variables”: {
“repeat”: {
“first”: true,
“index”: 1
}
},
“result”: {
“result”: false
}
}
],
“action/1/repeat/while/0”: [
{
“path”: “action/1/repeat/while/0”,
“timestamp”: “2021-11-09T12:00:00.022906+00:00”,
“result”: {
“result”: false
}
}
],
“action/1/repeat/while/0/entity_id/0”: [
{
“path”: “action/1/repeat/while/0/entity_id/0”,
“timestamp”: “2021-11-09T12:00:00.023017+00:00”,
“result”: {
“result”: false,
“state”: “00:00:00”,
“wanted_state”: “off”
}
}
]
},
“config”: {
“trigger”: [
{
“platform”: “time”,
“at”: “13:00:00”
}
],
“mode”: “restart”,
“action”: [
{
“service”: “input_boolean.turn_off”,
“target”: {
“entity_id”: “input_datetime.medics”
}
},
{
“alias”: “Notify until the medication has been take”,
“repeat”: {
“while”: [
{
“condition”: “state”,
“entity_id”: “input_datetime.medics”,
“state”: “off”
}
],
“sequence”: [
{
“service”: “logbook.log”,
“data”: {
“name”: “Medication reminder!”,
“message”: “Reminder sent”,
“entity_id”: “input_datetime.medics”
}
},
{
“choose”: [
{
“conditions”: “{{ true }}”,
“sequence”: []
}
]
},
{
“device_id”: “7d1b8fbe6148552608b8beb99a0edba5”,
“domain”: “mobile_app”,
“type”: “notify”,
“title”: “Medication reminder!”,
“message”: “It’s time to take your medication”,
“data”: {
“actions”: [
{
“title”: “Taken”,
“action”: “taken”
},
{
“title”: “Ask later”,
“action”: “later”
},
{
“title”: “Skip”,
“action”: “skip”
}
],
“tag”: “medication-reminder”
}
},
{
“wait_for_trigger”: {
“platform”: “event”,
“event_type”: “mobile_app_notification_action”
},
“timeout”: {
“minutes”: 5
}
},
{
“choose”: [
{
“conditions”: “{{ wait.trigger.event.data.action == ‘taken’ }}”,
“sequence”: [
{
“service”: “input_boolean.turn_on”,
“target”: {
“entity_id”: “input_datetime.medics”
}
},
{
“service”: “logbook.log”,
“data”: {
“name”: “Medication reminder!”,
“message”: “Medication taken”,
“entity_id”: “input_datetime.medics”
}
}
]
},
{
“conditions”: “{{ wait.trigger.event.data.action == ‘later’ }}”,
“sequence”: [
{
“service”: “logbook.log”,
“data”: {
“name”: “Medication reminder!”,
“message”: “Postpone reminder”,
“entity_id”: “input_datetime.medics”
}
},
{
“delay”: {
“minutes”: 5
}
}
]
},
{
“conditions”: “{{ wait.trigger.event.data.action == ‘skip’ }}”,
“sequence”: [
{
“service”: “input_boolean.turn_on”,
“target”: {
“entity_id”: “input_datetime.medics”
}
},
{
“service”: “logbook.log”,
“data”: {
“name”: “Medication reminder!”,
“message”: “Reminder skipped”,
“entity_id”: “input_datetime.medics”
}
}
]
}
],
“default”: [
{
“device_id”: “7d1b8fbe6148552608b8beb99a0edba5”,
“domain”: “mobile_app”,
“type”: “notify”,
“message”: “clear_notification”,
“data”: {
“tag”: “medication-reminder”
}
},
{
“service”: “logbook.log”,
“data”: {
“name”: “Medication reminder!”,
“message”: “No answer time out”,
“entity_id”: “input_datetime.medics”
}
}
]
}
]
}
}
],
“id”: “1635160206915”,
“alias”: “Advanced medication reminder”,
“description”: “”
},
“blueprint_inputs”: {
“id”: “1635160206915”,
“alias”: “Advanced medication reminder”,
“description”: “”,
“use_blueprint”: {
“path”: “Aohzan/medication_reminder.yaml”,
“input”: {
“logbook_message_no_answer”: “No answer time out”,
“notify_device”: “7d1b8fbe6148552608b8beb99a0edba5”,
“reminder_time”: “13:00:00”,
“optional_action”: [],
“logbook_message_skip”: “Reminder skipped”,
“logbook_message_later”: “Postpone reminder”,
“logbook_message_taken”: “Medication taken”,
“logbook_message_remind”: “Reminder sent”,
“notification_action_skip”: “Skip”,
“notification_action_later”: “Ask later”,
“notification_action_taken”: “Taken”,
“notification_message”: “It’s time to take your medication”,
“ask_later_wait_time”: 5,
“notification_title”: “Medication reminder!”,
“input_boolean”: “input_datetime.medics”
}
}
},
“context”: {
“id”: “65d275fb43a1a08185f88c710d7f32d7”,
“parent_id”: null,
“user_id”: null
}
},
“logbookEntries”: [
{
“name”: “Advanced medication reminder”,
“message”: “has been triggered by time”,
“source”: “time”,
“entity_id”: “automation.advanced_medication_reminder”,
“context_id”: “65d275fb43a1a08185f88c710d7f32d7”,
“when”: “2021-11-09T12:00:00.004717+00:00”,
“domain”: “automation”
}
]
}

the notification is sent :

“device_id”: “7d1b8fbe6148552608b8beb99a0edba5”,
“domain”: “mobile_app”,
“type”: “notify”,
“title”: “Medication reminder!”,
“message”: “It’s time to take your medication”,
“data”: {
...

you should try a notification from dev tools, but the problem don’t come from this blueprint

What about with actions? Here is a pair of automations i made involving a notification and taking an action based on the response. Could this be a way to differentiate the entitiy?


automation:
- id: timetocheckglucose
  alias: Time to check glucose
  trigger:
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.glucosetimer
  action:
  - service: notify.mobile_app_josh_phone
    data:
      message: Check glucose
      data:
        actions:
        - action: glucose_checked
          title: Checked
  - service: notify.alexa_media_living_room_echo
    data:
      message: Josh, it's time to check your glucose
      data:
        type: tts
  mode: single
- id: '1627873698743'
  alias: Glucose checked
  description: ''
  trigger:
  - platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: glucose_checked
  condition: []
  action:
  - service: script.glucose_tested
  mode: single