Assist: Create reminders by voice

Usecase

I wanted a way to replace the voice reminders that I previously used with a Google Nest mini. Now that I have this working I can finally deprecate my Google devices :slight_smile:

Main features

  • Create reminders using HA Assist using a sentence you can configure yourself
  • See the reminders as part of a todo list and optionally show them in your dashboard
  • Use OpenAI integration to parse the reminder time
  • Get the reminders via the HA Companion app when the set time arrives
  • Keep reminders until you dismiss them from the notification

Install guide

  1. Setup the prerequisites as described below.
  2. Import the blueprint
  3. Setup the automation using the blueprint
  4. Test by calling assist with your configured sentence

1. Prerequisites

For this blueprint to work you need a few things to be setup before setting up the blueprint:

2. Import blueprint

Github Gist: voice_reminders.yaml · GitHub

Importing

Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Or import this Blueprint by using the Gist URL above.

3. Setup blueprint

Navigate to your automations section in HA, add a new automation and select the imported blueprint.
Set it up according to the instructions in the blueprint setup page.

This should result in a configured automation. And example for an automation I have setup myself you can find here:

automation:
  - id: "1703332219266"
    alias: Voice reminder to TTS english
    description: ""
    use_blueprint:
      path: homeassistant/voice_reminders.yaml
      input:
        notify_service: notify.mobile_app
        open_ai_config_entry: 50005158a4b775603223d530315c184f
        todo_list: todo.reminders
        assist_command:
          - Remind me to {reminderDescription} at {reminderTime}
        response_sentence_text: "You will receive a reminder about: {{trigger.slots.reminderDescription}} at {{response_from_ai.response.speech.plain.speech}} o' clock."

Testing

Open an Assist dialog screen and enter your configured sentence, if you follow the example this is:

Remind me to test HA voice reminders at 2

F.A.Q.

I have setup everything a described, but it still does not work

Try to debug your created automation in HA and see which step fails.
Post the debug logs here and I will try to help you.
Posting the generated automation in YAML form also helps.

Changelog

  • 2024-03-22: Initial version
  • 2024-03-23: Used a todo list instead of input helper entities to store the reminders

If you have any issues or questions, please let me know :slight_smile:

1 Like

Thanks for sharing this blueprint. Maybe you can help me with an error I am getting on 2024.7.0

Error: Invalid datetime specified: Sorry, I had a problem talking to OpenAI: Error code: 404 - {'error': {'message': 'The model `pt-3.5-turbo` does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}} for dictionary value @ data['due_datetime']
Result:
params:
  domain: todo
  service: add_item
  service_data:
    item: pet the dog
    due_datetime: >-
      Sorry, I had a problem talking to OpenAI: Error code: 404 - {'error':
      {'message': 'The model `pt-3.5-turbo` does not exist or you do not have
      access to it.', 'type': 'invalid_request_error', 'param': None, 'code':
      'model_not_found'}}
    entity_id:
      - todo.reminders
  target:
    entity_id:
      - todo.reminders
running_script: false

It looks like you’ve got a typo in your config and the model is missing a g at the beginning. The error messages says:

The model pt-3.5-turbo does not exist

The name for the model ist gpt-3.5-turbo :slight_smile:

Hey there. I was looking for that kind of automation, and bumped into yours. Thank you!

I use a local Ollama instance, so I made a fork to enable it.

However, the automation is not working, and I don’t know if it’s a problem with my local AI, or something related to your blueprint. Can you please help me?

Save reminder in todo list
Executed: January 5, 2025 at 12:46:03 PM
Error: Invalid datetime specified: 2025-01-05 01:46:00. Since the time now is :00 and we need a time in the future closest to the current time, I will use 2025-01-05 01:47:00 as the output time. The output of this datetime string is '2025-01-05 01:47'. for dictionary value @ data['due_datetime']
Result:
params:
  domain: todo
  service: add_item
  service_data:
    item: test Home Assistant
    due_datetime: >-
      2025-01-05 01:46:00. Since the time now is :00 and we need a time in the
      future closest to the current time, I will use 2025-01-05 01:47:00 as the
      output time. The output of this datetime string is '2025-01-05 01:47'.
    entity_id:
      - todo.to_do_list
  target:
    entity_id:
      - todo.to_do_list
running_script: false

It seems the current time sensor is not there is your home assistant instance. This blueprint expects the {{states.sensor.time.state}} template to resolve to the current time. Perhaps setting this up can help you? Time & Date - Home Assistant

Awesome! I was able to make progress! Indeed adding that integration made it pass to the following step. But then the response I was getting from Ollama had some extra text, so I added an additional instruction to “Respond only with the datetime string, and nothing else.”.

Now, I have a couple of questions:

  1. When the script was initially failing, the voice assistant still responded with “Done”, even though it was not. Is there a way to detect those failures and make it respond accordingly?
  2. The voice assistant acknowledges the added task reading the full datetime string, ending with “o’clock”, which is a weird response. Is there a way to improve this?
  3. Is there a way to make the time calculation use something native to HA, without adding a new integration? If not, you might want to consider adding that information to your install instructions.

Thank you!

Ps.: This is my up to date version of your blueprint to work with Ollama.

This looks really promising. Does this work if you say something like

“Remind me to put out the bins in 3 hours.”

Rather than ‘at’ a specific time.

I appreciate I’d have to change the assistant sentence trigger a bit, but would the OpenAI work it out ?

EDIT:- Ignore me, just tested it and it works fine.

Seems to really struggle with setting specific dates and times together:

Also, I tweaked the final code that speaks the date to be much more human readable:-

You will receive a reminder about: {{trigger.slots.reminderDescription}} at {{ as_timestamp(response_from_ai.response.speech.plain.speech) | timestamp_custom('%A @ %-I:%M %p') }} o' clock.

I’ve tried tweaking the sentence, but that doesn’t work, I think I need to split the date and time component to make it easier.

I’ve tweaked my version of the blueprint to take sentences with a date parameter so you can better set things in the future. I can post my edits here if anyone cares. Seems to work ok.

2 Likes

Does this allow you to query the time left in an active timer?

Yes, please do. I’m interested to set up more flexible reminders. Thanks!

This is my taken over version of the blueprint which allows you to also use dates.
I’ve found the whole thing super flakey trying to say long sentences. They often get cut off, and I’m not using it as its just not reliable, but your mileage might vary:-

alias: Voice - Automation to set reminders for actions using OpenAI
description: ""
triggers:
  - command:
      - (Remind | Tell) me at {reminderTime} to {reminderDescription}
      - >-
        (Remind | Tell) me on {reminderDate} at {reminderTime} to
        {reminderDescription}
    id: assist_command_triggered
    trigger: conversation
  - event_type: mobile_app_notification_action
    event_data:
      action: dismiss_reminder
    id: dismissed_reminder
    trigger: event
  - minutes: /1
    id: every_minute
    trigger: time_pattern
actions:
  - alias: Select correct trigger
    choose:
      - alias: The assist sentence was triggered
        conditions:
          - alias: Assist sentence triggered
            condition: trigger
            id: assist_command_triggered
        sequence:
          - data:
              agent_id: 01JJVW452V4FBEQAA3KWAEN2N9
              text: >
                The current date and time is {{states.sensor.date.state}}
                {{states.sensor.time.state}}:00. Rewrite
                {{trigger.slots.reminderTime}} on {% if
                trigger.slots.reminderDate | length >0 %} {{
                trigger.slots.reminderDate }} {%else%} {{
                states.sensor.time.date }} {%endif%}
                 to time format 'YYYY-MM-DD
                HH:MM:SS'.  The answer should be a datetime and must be in the
                future. In your response return exactly 19 characters of the
                datetime string in format 'YYYY-MM-DD HH:MM:SS'
            response_variable: response_from_ai
            action: conversation.process
          - alias: Save reminder in todo list
            data:
              item: "{{trigger.slots.reminderDescription}}"
              due_datetime: "{{ response_from_ai.response.speech.plain.speech }}"
            target:
              entity_id: "{{todo_list}}"
            action: todo.add_item
          - set_conversation_response: >-
              You will receive a reminder about:
              {{trigger.slots.reminderDescription}} on {{
              as_timestamp(response_from_ai.response.speech.plain.speech) |
              timestamp_custom('%A @ %-I:%M %p') }}.
      - alias: Reset the input entities of the reminder slot that was just dismissed
        conditions:
          - condition: template
            value_template: "{{ trigger.id == 'dismissed_reminder' }}"
        sequence:
          - variables:
              eventMessage: >
                {% set event = trigger.event | string %} {% set message =
                event.split('message=')[1].split(',')[0] %} {{ message }}
          - alias: Remove todo item
            data:
              item: "{{ eventMessage }}"
            target:
              entity_id: todo.reminders
            action: todo.remove_item
      - alias: The time trigger was triggered
        conditions:
          - alias: Time trigger for every minute
            condition: trigger
            id: every_minute
          - alias: There are items in the todo list
            condition: template
            value_template: "{{states(todo_list) |int(0) > 0}}"
        sequence:
          - alias: Get reminders from todo list
            data:
              status: needs_action
            target:
              entity_id: "{{todo_list}}"
            response_variable: itemlist
            action: todo.get_items
          - alias: Check if there is a relevant item in the list of todo items
            repeat:
              for_each: "{{ itemlist[todo_list]['items'] }}"
              sequence:
                - condition: and
                  conditions:
                    - alias: Reminder is the right time
                      condition: template
                      value_template: >
                        {% set reminderDate = repeat.item.due %} {% set
                        reminderTimeStamp =
                        as_timestamp(as_datetime(reminderDate)) %} {% set
                        currentTimeStamp = as_timestamp(now())  %} {% set
                        timeCutOffLow = currentTimeStamp - 30 %} {% set
                        timeCutOffHigh = currentTimeStamp + 30 %} {%  set
                        reminderRelevant = (reminderTimeStamp >= timeCutOffLow)
                        and (reminderTimeStamp <= timeCutOffHigh) %} {{
                        reminderRelevant }}
                    - alias: Reminder needs action
                      condition: template
                      value_template: "{{ repeat.item.status == 'needs_action' }}"
                - alias: Send notification
                  data:
                    title: Reminder
                    message: "{{ repeat.item.summary }}"
                    data:
                      actions:
                        - action: dismiss_reminder
                          title: Dismiss
                  action: "{{ notifyServiceEntity }}"
variables:
  notifyServiceEntity: notify.mobile_app_PUT_YOUR_PHONE_ENTITY_HERE
  todo_list: todo.reminders
mode: parallel

I deliberately moved the reminderDescription to the end of the sentence because otherwise it can interfere with the date or time portion sometimes.

1 Like

Hey cool, out of all the ones I tried, this is the first to show some actual promise! I took the Ollama version and changed the request, added a second one, and also changed the response a little.

[Please] remind me to {reminderDescription} at {reminderTime}
[Please] remind me to {reminderDescription} in {reminderTime}
I'l remind you to {{trigger.slots.reminderDescription}} on {{as_timestamp(response_from_ai.response.speech.plain.speech) | timestamp_custom('%A')}} at {{as_timestamp(response_from_ai.response.speech.plain.speech) | timestamp_custom('%-I:%M %p')}}.

Interestingly, the in x hours version always results in a reminder for the next day, but at the correct time. I think my LLM (llama3.2) might be a little too small to properly understand it. But no biggie for now.

@freakshock , do you think you could update the blueprint to work with both OpenAI as well as with Ollama as added by @badnetmask and incorporate the enhancements posted by @Rofo?

In order to get this up to the level of what Google Assistant does, there’s just something for “set an alarm for x [on y]” and “set a x [hours/minutes] timer” missing. I’m feeling a little excited :slight_smile: