I’ve set up a morning routine automation that triggers when my alarm goes off and a motion sensor detects movement. Now, I want to take it a step further:
My goal: My smart speaker should use OpenAI to announce the current weather and my appointments for today and tomorrow.
I’ve already tried and researched quite a bit, but so far without success. So my questions are:
Is this even possible?
If yes, how could I set this up?
Yes it’s possible. My approach was to create a template button that announces today’s events whenever it is pressed. This way I can manually trigger it from the UI or press the button in an automation or script.
- button:
- name: "Announce Calendar Events Jason"
unique_id: announce_calendar_events_jason
icon: mdi:account-voice
press:
- action: calendar.get_events
target:
entity_id: calendar.jazzyisj
data:
duration:
days: 2
response_variable: agenda
- variables:
events: "{{ agenda['calendar.jazzyisj']['events'] }}"
message: |
{%- from 'schedule.jinja' import list_events %}
Good {{ states('sensor.tod_greeting') }}!
{%- if events | count > 0 %}
Here are your upcoming calendar events.
{{ list_events(events) }}
{%- else %}
There are no events on your calendar today!
{%- endif -%}
- action: script.tts_play
data:
media_player: media_player.inside_speakers
min_volume: 50
provider: "HASS"
language: "English (Ireland)"
voice: "Emily"
always_play: true
save_message: false
message: "{{ message }}"
Hey mega! Thank you very much. However, I don’t understand what kind of sensor this is “sensor.tod_greeting”. You are also running a script (script.tts_play) Could you tell me what your settings are? Thank you very much
My config here was just an example to show you one way of tackling the issue in your system. It needs to be modified to fit your needs. But here is my TOD (time of day) greeting template sensor which you may find useful. My script.tts_play should be replaced with your own TTS action call.