Text to speech calendar appointments at specific trigger?

I recently came across

I wonder if it is possible to do a “simplified” version of this without openAI, probably someone already did something similar.

I’d like HA to text-to-speech the appointments for the current day, triggert by a time each morning or when something is triggered in the morning, like the coffee machine, light or or whatever.

like
if (power consumption of coffee machine >10W && time between 6 and 8)
→ texttospeech appointments of current day on specific device

“specific device” would be a tablet in my case

Here’s mine, for what it’s worth. This is a response to a custom sentence, so you’d need to tinker a bit to get it to work with another trigger.

The sentence is:

language: "en"
intents:
  CustomCalendarToday:
    data:
      - sentences:
          - "[Is] (Anything | What | What's | What is ) ( in | on ) [the] (calendar | diary) [for] today"
          - "[Is] (Anything | What's | What is ) ( happening | going on ) today"

Assist says:

  CustomCalendarToday:
    action:
      - service: calendar.get_events 
        target: 
          entity_id: calendar.mycalendar
        data: 
          duration: 
            hours: "{{ 23 - now().strftime('%H') | float(0) }}"
        response_variable: diary
      - service: script.tts_response
        data:
          tts_sentence: >-
              {% if states('sensor.number_of_events_today') | float(0) > 0 %}
              Today you've got, 
              {% for event in diary['calendar.mycalendar'].events %} 
              {{ event.summary }},
              {% endfor %}
              {% else %}
              Nothing today
              {% endif %}

script.tts_response simply takes the sentence diary and says it on the appropriate speaker.

1 Like

Thank you.
So you are triggering it by voice if I understand that right?
Okay the trigger shouldn’t be the problem, is the event.summary a default from the calendar?
Need to learn more about the output I guess, since I don’t want it to be played on all connected devices.

Yes. event.summary gives you the title of the event. There’s lots of examples in the docs (which is where most of mine came from):