Greeting with other info

This is what I created and thought I’d share…yeah it’s simple but that’s the point :slight_smile:

Capture

      - type: vertical-stack
#                view_layout:
#                grid-area: header
        flex-grow: 2
        style: |
          ha-card {
            box-shadow: none;
            border-style: hidden;
            border-bottom-right-radius: 0px;
            border-bottom-left-radius: 0px;
          }
        cards:
        - type: markdown
          style:
            .: |
              ha-card {
              background-color: rgba(49, 50, 53, 0.8) !important;
              box-shadow: none;
              border: none;
              border-color: white;
              border-radius: 5%;
              }
            ha-markdown:
              $: |
                ha-markdown-element:first-of-type h2 {
                  background-color: rgba(0,0,0,0);
                  color: white;
                  font-size: 18px;
                  line-height: 18px;
                }
                ha-markdown-element:first-of-type h3 {
                  background-color: rgba(0,0,0,0);
                  font-weight: normal;
                  color: white;
                  font-size: 14px;
                  line-height: 14px;
                }
                ha-markdown-element:second-of-type h3 {
                  background-color: rgba(0,0,0,0);
                  color: white;
                  font-weight: normal;
                  font-size: 14px;
                  line-height: 14px;
                }
          content: |
              ## {{ states('input_select.frontend_greeting') }}, {{user}}
              ### Today is {{ states('sensor.date_format')}} and the time is {{ states('sensor.12hourtime')}}
              ### Temperature today will be  <br/>High of: {{ states('sensor.dark_sky_daytime_high_temperature_1d')| round }}° Low of: {{ states('sensor.dark_sky_overnight_low_temperature_1d')| round }}°  <br/> {{ states('sensor.dark_sky_summary_1d') }}
              ### {{ states ('sensor.holiday_time')}}

The input_select greeting [in my config]

input_select:
  frontend_greeting:
    name: Frontend Greeting
    options:
      - Good Morning
      - Good Afternoon
      - Good Evening
      - Good Night

Automation for input_select:

- alias: Frontend Greeting
  trigger:
    - platform: time_pattern
      minutes: /5
    - platform: homeassistant
      event: start
  action:
    service: input_select.select_option
    data_template:
      entity_id: input_select.frontend_greeting
      option:
        "{% if (states.sensor.time.state > '22:00') and (states.sensor.time.state\
        \ < '06:00') %}\n  Good Night\n{% elif (states.sensor.time.state > '06:00')\
        \ and (states.sensor.time.state < '12:00') %}\n  Good Morning\n{% elif (states.sensor.time.state\
        \ > '12:00') and (states.sensor.time.state < '18:00') %}\n  Good Afternoon\n\
        {% elif (states.sensor.time.state > '18:00') and (states.sensor.time.state\
        \ < '21:59') %}\n  Good Evening\n{% endif %}\n"

So there you go :slight_smile:
You can change your time with the time sensors you have on your system or I can give you what I use…

Thanks everyone!!! Been a fun 2 years so far…learning so much from everyone here!

3 Likes

If I want to use this in the text of a telegram notification, what is the variable? I can’t figure it out

You don’t need the input_select or the automation to accomplish this.
You can use the template right in the service call.

    - service: notify.telegram
      data:
        message: |
          {%- if states('sensor.time') > '22:00' and states('sensor.time') < '06:00' %} Good Night
          {%- elif states('sensor.time') >'06:00' and states('sensor.time') < '12:00' %} Good Morning
          {%- elif states('sensor.time') > '12:00' and states('sensor.time') < '18:00' %} Good Afternoon
          {%- elif states('sensor.time') > '18:00' and states('sensor.time') < '21:59' %} Good Evening 
          {%- endif %} Hellomiakoda_ha1
        
          etc. etc etc.

1 Like