Specific persistent notification as a condition

Hi everyone,

I’m trying to make an automation for my old father to remember to take his medications.
He needs to take it twice a day and, unfortunately, it’s in liquid form, so he cannot use those pill dispensers with slots.

I thought about making two persistent notifications with two different IDs, one for the morning (ID 0001) and one for the evening (ID 0002).
That’s the easy part.

So I made a test persistent notification “take the medication” (it also turns on a light so I can see if it’s running while I’m testing).

   sequence:
     - action: persistent_notification.create
       metadata: {}
       data:
         message: take the medication!!
         title: Test title (morning)
         notification_id: "0001"
     - action: light.turn_on
       metadata: {}
       target:
         entity_id: light.studio1
       data: {}
   alias: test persistent notification medicine morning
   description:

Then I made an automation that runs it at 8AM.
And I made a notification dismiss when he takes it (linked to a physical button that he presses when he took the medication).

    actions:
      - action: persistent_notification.dismiss
        data:
           notification_id: "0001"

What I’d like is to run, inside the automation, a condition to check if the previous medication was indeed taken: for example at 19:00 it checks if notification 0001 is still present.

How can I do that?
Is there a way to check if persistent notification 0001 is still present and add it as a condition?

Thank you in advance

Is he reading the notifications on the dashboard?

For the time being yes, but I plan to send notifications to a magic mirror in the future.

After struggling a little bit (I’m not a programmer after all), I ended up with a similar solution to the one suggested but much more basic and simpler (at least for me).

I’ll write it down if anyone needs it in the future.

1- I created a toggle helper “TOGGLE ON/OFF” or whatever name you like
2- I made a script that does 2 things: sends the notification and TOGGLE ON helper
3- Made an automation that runs at a specific time (7AM) and run the script

This way in the morning he sees the notification (and internally there’s something I can use to check it)

4- Made another automation that clears the notification and TOGGLE OFF helper when he presses a physical button

When I’ll implement a check to see if the previous medication was taken, I’ll just have to check if the toggle is ON or OFF.

It might be a bit convoluted but it does work and it seems simple enough.

I’m not writing the code because it seems really simple enough but if anyone needs it, I’ll post it.