GPT Multi Calendar Agenda notification

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

GitHub Link Click Here

Hello, :grin::raised_hands:

This is a modified version of @allenporter’s blueprint

Video Tutorial

Version: 2.1

  • Updated to new home assistant services to fetch Forecast and Calendar Data

Version: 2.0

  • Allows you to use up to 3 calendars and 3 notify services to send the message.
  • Consider increasing the maximum tokens to return in a response to get the full information processed by ChatGPT as shown here. (400 - 500 would be a starting point, for two calendars)
  • This blueprint will send you a personalized message every morning to help you prepare for your day.
  • Using OpenIA conversation, it will generate a summarized message using the weather and your calendar information.
  • You can customize the prompt to get better-detailed messages according to your needs.
  • And also customize the time that the message is sent.

Need help? or Just want to say hi :slightly_smiling_face:?
Let me know what you think about this blueprint in the comments
All feedback is welcome, so let me know if you have any questions.

Hope you find it useful :smile:

:spiral_notepad: My Other Projects

1 Like

I am getting this error for the conversation agent?

1 Like

I am also receiving this error. Started I believe with this months major HA release

1 Like

For weather entities, the fotecast attribute was removed, which breaks this blueprint.

Hello, thank you for this blueprint.

I made a slight adaptation to display the notification on the dashboard. I find it convenient to be able to easily find the LLM’s response on my dashboard.

Here is the code I added:

  • alias: Save speech

service: input_text.set_value

target:

entity_id: input_text.speech

data:

value: “{{ agent.response.speech.plain.speech }}”

With a help from discussion to original blueprint I’ve fixed the issue with forecast attributes like this:

add this:

- alias: Get Weather Forecast
  service: weather.get_forecasts
  data:
    type: daily
  target:
    entity_id: !input weather_entity
  response_variable: weekly_weather_forecast

and in text replace section {%- if weather_entity ... {%- endif %}

with this:

{%- if weather_entity is defined %}
        {%- set temperature_unit = state_attr(weather_entity, 'temperature_unit') -%}
        {%- set todays_forecast = weekly_weather_forecast[weather_entity]['forecast'][0] %}
        Weather: {{ todays_forecast.condition }} ({{ todays_forecast.temperature }}{{ temperature_unit }}, {{ todays_forecast.precipitation }}% precipitation)
        {%- endif %}
1 Like

Does anyone have the skill to update this due to the breaking change of removing calendar.list_events and switching to calendar.get_events

Documentation

1 Like

I have the same issue, but don’t have the ability to fix this either.
I was about to rebuild this as a standalone automation, but realised that this was waaaaay above my pay-grade!

@fixt would you like assistance fixing this?

@Martin_Granger and @fixt just FYI the orignal creator @allenporter has updated his amazing blueprint that resolves the calendar.get_events service change. Might be able to merge the changes, but I’ll just stick with his blueprint as getting notifications was my primary goal anyway.

1 Like

Hey, thank you for the heads up, I’m about to start working on a fix, and this is great to start.

Sorry for the delay, I had this on my to-do list for months, but due to time constraints, I wasn’t able to work on it.
Hope I can have the fixed version working after this week’s video release, but wanted to let you know that I’m finally working on it.

1 Like

Updated to use the new Home Assistant Services for fetching information

1 Like

Found out that in multi calendar, the new get_calendar broke parsing, so I’ve rebuilt it:

        {% set calendar_name = calendar_entity_1 %}
        Calendar "{{ state_attr(calendar_entity_1, 'friendly_name') }}" events for the next {{ calendar_duration.hours }} hours:
          {% set agenda = agenda_1[calendar_name] if calendar_name in agenda_1 else {} %}
          {% if agenda.events %}
            {% for event in agenda.events %}
            - Summary: {{ event.summary }}
              Start-End: {% if event.start is defined %}{{ event.start }} to {{ event.end }}{% else %}All Day{% endif %}
              {% if event.description is defined %}
              Description: {{ event.description }}
              {% endif %}
              {% if event.location is defined %}
                Location: {{ event.location }}
              {% endif %}
            {% endfor %}
          {% else %}
            - No upcoming events.
          {% endif %}

        {%- if (calendar_number == "two") or (calendar_number == "three") %}
        Calendar "{{ state_attr(calendar_entity_2, 'friendly_name') }}" events for the next {{ calendar_duration.hours }} hours:
          {% set agenda = agenda_2['calendar_entity_2'] if 'calendar_entity_2' in agenda_2 else {} %}
          {% if agenda.events %}
            {% for event in agenda.events %}
            - Summary: {{ event.summary }}
              Start-End: {% if event.start is defined %}{{ event.start }} to {{ event.end }}{% else %}All Day{% endif %}
              {% if event.description is defined %}
              Description: {{ event.description }}
              {% endif %}
              {% if event.location is defined %}
                Location: {{ event.location }}
              {% endif %}
            {% endfor %}
          {% else %}
            - No upcoming events.
          {% endif %}
        {%- endif %}

        {%- if (calendar_number == "three") %}
        Calendar "{{ state_attr(calendar_entity_3, 'friendly_name') }}" events for the next {{ calendar_duration.hours }} hours:
          {% set agenda = agenda_3['calendar_entity_3'] if 'calendar_entity_3' in agenda_3 else {} %}
          {% if agenda.events %}
            {% for event in agenda.events %}
            - Summary: {{ event.summary }}
              Start-End: {% if event.start is defined %}{{ event.start }} to {{ event.end }}{% else %}All Day{% endif %}
              {% if event.description is defined %}
              Description: {{ event.description }}
              {% endif %}
              {% if event.location is defined %}
                Location: {{ event.location }}
              {% endif %}
            {% endfor %}
          {% else %}
            - No upcoming events.
          {% endif %}
        {%- endif %}

Also, this was needed for google calendar, and in my setup, by adding the ollama integration, you could also run the assistant FULLY locally (except for the google calendar bit)

Any way to add the to do list to the blueprint with the calenders?

I am having issues with a O365 calendar. The meetings for the next week are shown in the entity as well as the default calendar view but when using this blueprint the response I get is that there are no events. I have the blue print set to look out 120 hours in the future and it works if I use a different calendar. It seems to be just this calendar that is affected.

alias: Multi Calendar Conversation agent agenda notification
description: ""
use_blueprint:
  path: fixtse/multiple_notify_agent_calendar_agenda.yaml
  input:
    calendar_entity_1: calendar.elevation_calendar
    calendar_number: one
    calendar_duration:
      hours: 120
      minutes: 0
      seconds: 0
    weather_entity: weather.home
    zone_entity: zone.home
    notify_service_1: notify.pottshomebot
    conversation_agent: conversation.chatgpt

Is this working for anyone?

I’m having the exact same problem as you, however in my case I’m using gmail calendar.

I’m getting this error when i try to run the blueprint. The error is “Weather entity ‘weather.accuweather’ does not support ‘hourly’ forecast” Where do i get the hourly forecast?

Weather forecast in Core has changes in the last month.
You will need to modify this or contact the original author to get a fix, most likely.

Weather - Home Assistant.

Definitive guide to Weather integrations 🌦.

Fixed it, I was using the wrong variable for the calendar 1, calendar 2 and 3 should have been working.