Last active
March 2, 2025 19:25
-
-
Save allenporter/e70d9eb090c7dbdd593cf526e07b4abe to your computer and use it in GitHub Desktop.
Home Assistant Blueprint: Conversation agent Agenda Notification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
blueprint: | |
name: Conversation agent Agenda Notification | |
description: | |
Conversation agent generates a notification based on the upcoming calendar | |
agenda, location, and weather information. | |
domain: automation | |
input: | |
notify_time: | |
name: Notification time | |
description: Time the automation is triggered to send the notification. | |
selector: | |
time: {} | |
default: 07:00:00 | |
notify_service: | |
name: Notify service name | |
description: | |
The name of the notify service where the notification should be | |
sent. | |
selector: | |
text: {} | |
default: notify.notify | |
notify_target: | |
name: Notify target | |
description: The target of the notify service. | |
selector: | |
text: {} | |
default: | |
calendar_entity: | |
name: Calendar | |
description: The calendar entity to use for finding upcoming calendar events. | |
selector: | |
entity: | |
multiple: false | |
filter: | |
- domain: | |
- calendar | |
calendar_duration: | |
name: Calendar Event duration | |
description: How many hours ahead to look for upcoming calendar events. | |
selector: | |
duration: | |
default: | |
hours: 18 | |
weather_entity: | |
name: Weather Entity | |
description: The weather entity to use for upcoming weather forecast. | |
selector: | |
entity: | |
multiple: false | |
filter: | |
- domain: | |
- weather | |
zone_entity: | |
name: Home Zone Entity | |
description: | |
The zone entity to use to determine approximate location for understanding | |
typical weather. | |
selector: | |
entity: | |
multiple: false | |
filter: | |
- domain: | |
- zone | |
conversation_agent: | |
name: Conversation Agent | |
selector: | |
conversation_agent: | |
prompt: | |
name: Conversation Agent Prompt | |
selector: | |
text: | |
multiline: true | |
type: text | |
default: |- | |
Please generate text for a notification that will be sent to the users | |
smartphone with helpful information. | |
You are a helpful personal agent that generates text for the user: | |
- Your answers are helpful, friendly, warm, insightful. | |
- Your answers are not technical, and do not include Home Assistant internal details such as entities in responses. | |
- Your messages help the user prepare for their day, for example: | |
- Making note of unusual weather for the location and time of year (but not mundane details like "0% chance of precipitation") | |
- How much time remaining until their first meeting | |
- Anything that may be special or unique, such as celebrating a birthday | |
trigger: | |
platform: time | |
at: !input notify_time | |
action: | |
- variables: | |
weather_entity: !input weather_entity | |
calendar_entity: !input calendar_entity | |
zone_entity: !input zone_entity | |
calendar_duration: !input calendar_duration | |
prompt: !input prompt | |
- alias: Fetch Weather Forecast | |
service: weather.get_forecasts | |
data: | |
type: hourly | |
target: | |
entity_id: | |
- "{{ weather_entity }}" | |
response_variable: daily_forecast | |
- variables: | |
forecast_entity: "{{ daily_forecast[weather_entity] }}" | |
forecast: "{{ forecast_entity.forecast[0] }}" | |
- alias: Fetch Calendar Agenda | |
service: calendar.get_events | |
data: | |
duration: !input calendar_duration | |
target: | |
entity_id: !input calendar_entity | |
response_variable: events_response | |
- alias: "Conversation Agent Notification Text" | |
service: conversation.process | |
data: | |
text: |- | |
Time: {{ now().strftime("%A %B %d %H:%M %p") }} | |
{%- if weather_entity is defined %} | |
{%- set temperature_unit = state_attr(weather_entity, 'temperature_unit') -%} | |
Forecast: {{ forecast.condition }} ({{ forecast.temperature }}{{ temperature_unit }}, {{ forecast.precipitation }}% precipitation) | |
{%- endif %} | |
Calendar "{{ state_attr(calendar_entity, 'friendly_name') }}" events for the next {{ calendar_duration.hours }}: | |
{%- set agenda = (events_response | items | first)[1] %} | |
{%- 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 %} | |
{{ prompt }} | |
agent_id: !input conversation_agent | |
response_variable: agent | |
- alias: "Send notification" | |
service: !input notify_service | |
data: | |
target: !input notify_target | |
title: "{{ now().strftime('%A') }} Agenda" | |
message: "{{ agent.response.speech.plain.speech }}" |
Awesome, what prompt did you use to get it the quote at the end?
I simply added the last bullet to the prompt.
It would be interesting to somehow get a quote from a rss feed or even to summarize rss but ya.. just the simple bullet works for this.
You are a helpful personal agent that generates text for the user:
- Your answers are helpful, friendly, warm, insightful but also funny and
crude if you want.
- Your answers are not technical, and do not include Home Assistant internal
details such as entities in responses.
- Tell me something inspiring someone famous said.
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Allen Porter ***@***.***>
Sent: Sunday, November 24, 2024 3:30:56 PM
To: allenporter ***@***.***>
Cc: Comment ***@***.***>
Subject: Re: allenporter/notify_agent_agenda.yaml
@allenporter commented on this gist.
________________________________
Awesome, what prompt did you use to get it the quote at the end?
—
Reply to this email directly, view it on GitHub<https://gist.github.com/allenporter/e70d9eb090c7dbdd593cf526e07b4abe#gistcomment-5299033> or unsubscribe<https://github.com/notifications/unsubscribe-auth/BG35KWYSGT57TWDHR3RLMCD2CJHSBBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTEMZRHAZDMOBYU52HE2LHM5SXFJTDOJSWC5DF>.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
Has there been any consideration to incorporating the to-do list? (local to-do) in this?
Has there been any consideration to incorporating the to-do list? (local to-do) in this?
I think it's likely pretty easy to add to the intent_scripts linked to above ( https://github.com/allenporter/home-assistant-config/tree/main/config/intent_scripts) to include local to-do. I tried to do it but wasn't successful, probably some kind of syntax issue that would be less daunting for someone that's more knowledge than simply copy/pasting with ChatGPT ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Final note, I'm using this as tts announcement - just wanted to share the end result :)
Also, the intents I mentioned above weren't actually needed for ChatGPT. I tried removing them and it continues to function, of course the standard home assistant "assist" does seem to need the intents (it no longer has access but I didn't really need it to, yet..). Just thought I'd clear that up.
I think everything you've described worked great btw. It was just a matter of me understanding how this functions and then ultimately giving the "assistant" home control.