- alias: Daily Agenda
- description: ""
- trigger:
- - platform: time
- at: "10:00:00"
- action:
- - variables:
- weather_entity: weather.thermoking
- calendar_number: one
- calendar_entity_1: calendar.birthdays
- calendar_entity_2: calendar.kids_school
- calendar_entity_3: calendar.events
- notify_number: three
- zone_entity: zone.home
- calendar_duration:
- hours: 18
- prompt: >-
- 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 answers should have some anime refrences for motivation.
-
- - Your messages help the user prepare for their day, for example:
- - Each calendar belongs to a different person, use the calendar name to refer to them, provide individual recommendations for each calendar, and make special remarks if some events match in time and the title or description makes a mention between calendars
- - 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
- - alias: Fetch First Calendar Agenda
- data:
- duration:
- hours: 18
- target:
- entity_id: calendar.birthdays
- response_variable: agenda_1
- action: calendar.get_events
- - if:
- - condition: template
- value_template: "{{ (calendar_number == 'two') or (calendar_number == 'three') }}"
- then:
- - alias: Fetch Second Calendar Agenda
- data:
- duration:
- hours: 18
- response_variable: agenda_2
- action: calendar.get_events
- target:
- entity_id: calendar.kids_school
- - if:
- - condition: template
- value_template: "{{ calendar_number == 'three'}}"
- then:
- - alias: Fetch Third Calendar Agenda
- data:
- duration:
- hours: 18
- target:
- entity_id:
- - calendar.events
- response_variable: agenda_3
- action: calendar.get_events
- - action: weather.get_forecasts
- metadata: {}
- data:
- type: daily
- target:
- entity_id: "{{ weather_entity }}"
- response_variable: weather.get_forecasts
- alias: Fetch Weather Forecast
- - variables:
- forecast_entity: "{{ daily_forecast[weather_entity] }}"
- forecast: "{{ forecast_entity.forecast[0] }}"
- - alias: Conversation Agent Notification Text
- data:
- text: >-
- Time: {{ now().strftime("%A %B %d %H:%M %p") }}
-
- {%- if zone_entity is defined %}
-
- Latitude: {{ state_attr(zone_entity, 'latitude') | round(1) }}
-
- Longitude: {{ state_attr(zone_entity, 'longitude') | round(1) }}
-
- {% endif %}
-
-
- {%- 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_1, 'friendly_name') }}" events
- for the next {{ calendar_duration.hours }} hours:
-
- {%- set agenda = (agenda_1 | 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 %}
-
-
- {%- 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 | 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 %}
- {%- 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 | 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 %}
- {%- endif %}
-
-
- {{ prompt }}
- agent_id: conversation.google_generative_ai_3
- response_variable: agent
- action: conversation.process
- - alias: Send notification
- data:
- title: "{{ now().strftime('%A') }} Agenda"
- message: "{{ agent.response.speech.plain.speech }}"
- action: notify.mobile_app_luffy1987
- - if:
- - condition: template
- value_template: "{{ (notify_number == 'two') or (notify_number == 'three') }}"
- then:
- - alias: Send notification
- data:
- title: "{{ now().strftime('%A') }} Agenda"
- message: "{{ agent.response.speech.plain.speech }}"
- action: notify.alexa_media_echo_show
- - if:
- - condition: template
- value_template: "{{ notify_number == 'three'}}"
- then:
- - alias: Send notification
- data:
- title: "{{ now().strftime('%A') }} Agenda"
- message: "{{ agent.response.speech.plain.speech }}"
- action: notify.alexa_media_animeking_echo_dot