Cloud.tts_say Current Date & Time

I am trying to get the tts service to say the current date and time but cannot get it to speak the day, date, month etc in a natural speech format.

I setup the date time sensor as described here Time & Date - Home Assistant

sensor:

Minimal configuration of the standard time and date sensor

  • platform: time_date
    display_options:
    • ‘date_time_iso’

Build on the standard sensor to produce one that can be customized

template:

  • sensor:
    • name: “Date and time”
      state: “{{ as_timestamp(states(‘sensor.date_time_iso’)) | timestamp_custom(’%A %B %-d, %I:%M %p’) }}”
      icon: “mdi:calendar-clock”

I changed the timestamp_custom slightly as I want to say Day Date Month but when I use this in the message it still says the year first then the month and never actually says the day.

message: >-
Today is {{states(‘sensor.date_time_iso’)}}

I want the tts service to say “Today is Monday the 8th November and the current time is 8:05am”

How can I do that?

Thanks!

I have tried your code and it works fine for me. Can you try like below in the service tab of the developer console.

service: tts.google_say
data:
  entity_id: media_player.92c6c280_d50296b5
  message: >-
    Today is {{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A %B
    %-d, %I:%M %p') }}

Please change the service and entity_id to your’s

2 Likes

Thanks thats working now - I assumed the timestamp_custom was set on the sensor but looks like it is needed in the message also :slight_smile: