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!

4 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

I know this is an old post. But its not working as of January 2025

Mine is still working
image

        - type: custom:stack-in-card
          cards:
            - type: markdown
              tap_action:
                action: navigate
                navigation_path: weather
              card_mod:
                style:
                  .: |
                    ha-card {
                       background-color: rgba(0,0,0,0) !important;
                       box-shadow: none;
                       margin-left:0rem
                       }

                    ha-markdown-element:second-of-type h1 {
                        background-color: rgba(0,0,0,0);
                        color: var(--primary-text-color);
                        font-weight: normal;
                        font-size: 10px;
                        line-height: 3px;
                      }
              content: >
                ###{% if now().hour  < 5 %} Good Night {{'\U0001F634'}} {% elif
                now().hour < 12 %} Good Morning {{'\u2615\uFE0F'}} {% elif
                now().hour < 18 %} Good Afternoon  {{'\U0001F44B\U0001F3FB'}} {%
                else %} Good Evening {{'\U0001F44B\U0001F3FB'}}{% endif %} , 
                {{user}}.<br/>   Today is {{ now().strftime('%A') }}, {{
                now().strftime('%B') }} {% set suffix = ['st', 'nd', 'rd'] %}{%
                set day = now().day %}{% set index = 3 if day // 10 == 1 or day
                % 10 == 0 else (day % 10) - 1 %} {{ day~'th' if index > 2 else
                day~suffix[index] }} and it's {{ now().strftime('%-I:%M %p') }}.
                <br/>  Temperature  
                {{states('sensor.weather_combined_max_temp_today') | int 
                }}°C,   {{states('sensor.weather_combined_daily_condition') }}.
                <br/> Cat Litter Box {{ states
                ('sensor.litter_box_pad_days_left') }} days until next cleaning.
                <br/> HVAC Filter need to be changed in  {{
                states('sensor.hvac_filter_days_left') }} days!
            - type: picture
              image: /local/MyPictures/OIP-removebg-preview.png
              tap_action:
                action: navigate
                navigation_path: weather
              card_mod:
                style: |
                  ha-card { 
                    background-color: transparent !important;
                  }   
          card_mod:
            style: |
              ha-card {
                height: 20em !important;
                background: linear-gradient(to top, transparent, rgba(var(--frog-rgb-{{states('sensor.weather_frog_status_2')}})) 10%), url({{states('sensor.weather_froggy_picture')}});

                background-size: cover, 200% auto;
                background-position: bottom left {% if is_state("sensor.weather_frog_location", "field") %}20%{% elif is_state("sensor.weather_frog_location", "hills") %}40%{% else %}10%{% endif %};
                background-repeat: no-repeat;
                background-blend-mode: saturation;
                font-size: 12px;
              }
1 Like