Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102441

Need Help with TTS and Time

$
0
0

@SMLMG wrote:

I am having trouble with the automation and script listed below. I wanted the automation and script to fire every hour between time x and time time y and it does that as expected. However, when speaking the time it always announces it as 59 minutes past the hour as opposed to on the hour. If it fires at 5:00 pm it will announce the time as 4:59, at 6:00 as 5:59 etc. My questions are - can I round the time up to the nearest hour without minutes or seconds, can I format the time to a 12 hour clock instead of 24 hour, and can I include a.m. or p.m.? Thank you all for any/all assistance. Here is the yaml I have -

  • alias: “Time Based Greeting”
    trigger:
    • platform: time_pattern
      hours: “/1”
      minutes: “0”
      seconds: “0”
      condition:
    • condition: state
      entity_id: device_tracker.life360_stephen
      state: “home”
    • condition: time
      after: “07:00:00”
      before: “22:00:00”
      action:
    • service: homeassistant.turn_on
      entity_id: script.stephen_greeting

stephen_greeting:
alias: Stephen Greeting
sequence:
- service: media_player.volume_set
entity_id: media_player.office
data:
volume_level: 0.25
- service: tts.google_translate_say
data_template:
entity_id: media_player.office
message: >
{% if now().strftime("%H")|int < 12 %}
Good Morning Stephen.
{% elif now().strftime("%H")|int < 18 %}
Good Afternoon Stephen.
{% else %}
Good evening Stephen.
{% endif %}
It’s currently {{states.weather.woodland_hills_north.state}} in San Antonio on {{states.sensor.date.state}} at {{states.sensor.time.state}}

One again, thank you for any help.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 102441

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>