Help with conditional volume depending on time

Is there anyone out there who can help me with conditional volume based on time?

      - service: media_player.turn_on
          entity_id: media_player.hallway
      - service: media_player.volume_set
          entity_id: media_player.hallway
          volume_level: '0.4' #depending on time of day, similar to messages below
      - service: tts.google_say
          entity_id: media_player.hallway
          message: >
           {% if now().strftime("%H")|int < 12 %}
           {{["Wakey, wakey.","Rise and shine.","Good morning sunshine.","Get your butt out of bed."] | random}} ...
           {% elif now().strftime("%H")|int < 18 %}
           {{["Good afternoon.","Hey there you are.","Do you want some information.","Lets see what i can tell you."] | random}} ...
           {% else %}
           {{["Good evening.","Good to see you.","Nice to see you.","How do you do."] | random}} ...
           {% endif %}

do the same as you’ve done for your messages, replace data with data_template and use the same {% if now().strftime("%H")|int < 12 %} logic to set the volume_level

1 Like