Get notified medicine every 4 hours and play sound on Google Home

Hello Guys,

I need some configuration on my Home assistant.

What i need is get notified a medicine or eat time of kids to be alerted on home assistant as badge or something like that and also play a sound on Google Home. It should be fine when the alert happend that i should click on OK on the home assistant and then a new alert will be created or the next scheduled alert will be start.

Are there maybe a script or integration about that?

I suggest you investigate the following resources:

when i make the automation trigger:

automation:
  trigger:
    platform: time_pattern
    # Matches every hour at 5 minutes past whole
    minutes: 5
  1. How can i make switch to enable and disable that trigger?
  2. When trigger happen how can i see that on Lovelace such as green button and i want to click on that button and then the status should be done -> up to the next schedule.
  3. That button should be also register when you have clicked on it and then you can see that also on Lovelace when the medicine was gives.

I thing the idea is simple and can everyone use but my scripting knowledge is not so best to implement this integration…

To help others help you, you will need to explain what your requirements in greater detail. For example, based on the information you have provided:

  1. Get notified medicine every 4 hours and play sound on Google Home
  2. Click on OK and then a new alert will be created or the next scheduled alert will be start

Questions:

  • So is it every 4 hours or the next scheduled alert? Or both?
  • If it’s every 4 hours, does that include throughout the entire day and night?
  • If there is a schedule how do you plan to modify it? Only within the automation or do wish to expose its controls in the Lovelace UI as well?

This is exactly what i want.

Target:
-> Get notified medicine every 4 or 8 hours.
-> Should be fine to set that on Lovelace.
-> On Lovelace get the info about the next scheduled time.
-> When it is clicked on the button on Lovelace, the scheduled time should be automatically reset on that set time over 4 / 8 hours and the time begin again.
-> Alternatively an alarm sound on google home to get the medicine at the scheduled time.

You can use an input_select with two options: 4 and 8 (hours). This can be used to specify the desired time period.

You can use an input_boolean to activate or deactivate the countdown.

You can create an automation that uses a State Trigger. It is triggered whenever the state of the input_boolean is turned on and stays on for the number of hours specified by the input_select (use State Trigger’s for option). When triggered it turns off the input_boolean and plays an announcement to the media_player representing your Google Home.

To re-activate the countdown, you turn the input_boolean back on.

1 Like

Can you please send me an example of this 3 scripts so i can begin and customize it?

It’s not 3 scripts. It’s two entities and an automation.

If you are unfamiliar with the terms I’ve used, I suggest you review the links I provided in my previous posts to familiarize yourself with Home Assistant’s terminology. Otherwise, it will become challenging to explain what I’ve proposed.

In the configuration.yaml file, create an input_select and an input_boolean:

input_select:
  hours:
    options:
      - '4'
      - '8'

input_boolean:
  reminder:
    name: Reminder

In whatever file you use to store your automations (configurations.yaml or automations.yaml), create this automation:

- alias: 'Reminder'
  trigger:
    platform: state
    entity_id: input_boolean.reminder
    to: 'on'
    for:
      hours: "{{states('input_select.hours') | int}}"
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.reminder
    - service: persistent_notification.create
      data_template:
        message: 'This is your {{ trigger.for }} hour reminder to do something.'
        title: 'This is a reminder.'

To simplify this example, this automation reports the reminder using persistent_notification as opposed to using a media_player (i.e. your Google Home device). It just makes it easier to create and test the example and can later be replaced with a notification to your Google Home.

1 Like