A different take on designing a Lovelace UI

sensor:

      - unique_id: wide_timeclock
        state: template
        attributes:
          hour: >
            {% set hours = now().strftime('%H') %} {{ hours }}
          minutes: >
            {% set minutes = now().strftime('%M') %} {{ minutes}}
          day: >
            {{ states.sensor.day_en.state }}
          date: >
            {{'📆'}} {{ states.sensor.date_en.state }}
          lunar: >
            {{'🌚'}} {{ states.calendar.lunar.attributes.message | replace("/", ".") }}
          events: >
            {%- set midnight = today_at() %}
            {%- set event = state_attr('calendar.ceske_statni_svatky', 'start_time') | as_datetime | as_local %}
            {%- set delta = event - midnight %}
            {%- if delta.days == 0 %}
            {{ state_attr('calendar.ceske_statni_svatky', 'message') }}
            {%- endif %}
            {% set time = now().hour %}
            {%- if time <= 1 -%} {{'💤'}} Good night
            {%- elif time <= 3 -%} {{'😴'}} Good night
            {%- elif time <= 5 -%} {{'😪'}} Good night
            {%- elif time <= 7 -%} {{'🧠'}} Good morning
            {%- elif time <= 9 -%} {{'🤟'}} Good morning
            {%- elif time <= 10 -%} {{'😘'}} Good morning
            {%- elif time <= 13 -%} {{'😍'}} Good day
            {%- elif time <= 15 -%} {{'😏'}} Good day
            {%- elif time <= 17 -%} {{'🖖'}} Good day
            {%- elif time <= 19 -%} {{'🤩'}} Good evening
            {%- elif time <= 22 -%} {{'🤗'}} Good evening
            {%- elif time <= 23 -%} {{'🤫'}} Good night
            {%- else %} {{'🤫'}} Good night
            {%- endif -%}

template:

wide_timeclock:
  # aspect_ratio: 2/1
  show_state: false
  show_name: false
  show_label: false
  show_icon: false
  tap_action: !include /config/UI/popup/calendar.yaml
  double_tap_action:
    action: block
  hold_action:
    action: block
  custom_fields:
    day: >
      [[[ return entity.attributes.day; ]]]
    date: >
      [[[ return entity.attributes.date; ]]]
    lunar: >
      [[[ return entity.attributes.lunar; ]]]
    events: >
      [[[ return entity.attributes.events; ]]]
    hour: >
      [[[ return entity.attributes.hour; ]]]
    minute: >
      [[[ return entity.attributes.minutes; ]]]
  styles:
    grid:
      - grid-template-areas: |
          "hour     events    "
          "hour     date   "
          "minute   lunar  "
          "minute   day "
      - grid-template-columns: 1fr 1fr
      - grid-template-rows: repeat(4, min-content)
      - gap: 0%
      - margin: 0
    card:
      - padding: 0
  extra_styles: |
    #card {
      padding: 0;
      border-width: 0;
    }
    #container {
      justify-items: flex-start;
      align-items: self-end;
      color: #6b6b6b;
      font-family: poppins;
      font-weight: 600;
      letter-spacing: 1.5px;
    }
    #hour, #minute {
      justify-self: flex-end;
      font-weight: 800;
      line-height: 90%;
      letter-spacing: 2px;
      font-family: Futura;
      padding-right: 0.5vw;
    }
    #hour {
      font-size: 3.5em;
      color: #848e93 !important;
    }
    #minute {
      font-size: 3.3em;
      color: #9c9ba3 !important;
    }
    #day {
      font-size: 1.3em;
      text-transform: uppercase;
      font-weight: 600;
      font-family: futura;
      letter-spacing: 1.5px;
      color: #848e93;
    }

button:

  cards:
    - type: custom:button-card
      entity: sensor.template_wide_timeclock
      template:
        - wide_timeclock
1 Like

I have the same problem, see my post a bit up in this community!

Anyone?

Can you share the sidebar code for calender and person with pic? :slight_smile:

Can someone tell me where to icons used in the ‘icon.yamel’ are stored?

I want to add some other icons as well, but I have no clue where to start, there not mdi icons as far as I can see.

Do I need to download them first?

Buttom_card_template map you can find icon.yaml, add code inside the file

Do you have a guide for install youre setup?
I have manage to install matt config before.

Can i just copy all or do manually need to change something.

Maybe some guideline how the setup it up or some requirement before install. Do I need to wipe Matt config before and start all over ?

its Working!! thx :smiley:

Yes, I have found that file. The question is, do I need the icon file stored somewhere?

When I look at the code from example the hue_lamp. I see a path etc.

Ok I have a very noob question, the installation says

  • Manually copy over these files from matt8707/hass-config
    • ui-lovelace.yaml
    • button_card_templates folder
    • popup folder
    • themes folder
    • sidebar.yaml

But where do I paste these folders to? Just insider the main area where I have configuration.yaml etc present? or somewhere specific?

No you dont need to store any files.

In the UI you need to put the name of the icon

1 Like

Yes, all files are under “config”

Did anyone has a nanoleaf and use it with with matts ui?
I try to get this effect-button:

on the light popup from my nanoleaf light:

Screenshot 2023-10-31 095113

But I had no idea how this could work.

I dived into your code :sweat_smile::grimacing:
When I’m correct you switch based on heating / idle, right.

For me your code is already difficult :grimacing:, but I think for my situation it’s even more complex, and I can’t figure it out :speak_no_evil:.

This my entity:

What I try to accomplish…
The havc_mode are ‘off’ auto and heat.

Havc_mode ‘off’
Grey out button and icon ( like the device is off )
State _display: Uit

Havc_mode auto
Button background colour ( like the device is on ) and the icon green
State_display: Auto

Havc_mode heat
Button background colour (like device is on)
And the icon red
State_display: Heat

1 Like

You have the same as me, use the current climate state. havc_action. What you show are the modes your climate can do.

I understand, that’s correct.
But I always monitor the “auto”

For example:
Now ad this moment my wife is in het salon working, because every day she starts and ends ad different times, she manual sets the target temp.

Now the status is heat, but under action it’s idle.

Edit: from the other side, when I use your approach, I see it only when it’s really asking for heat?

Here is my code:

sidebar.yaml

- sensor:
    - unique_id: sidebartime
      state: template
      attributes:
        time: >
          {% set hours = now().strftime('%H') %}
          {% set minutes = now().strftime('%M') %}
          <span class="time">
            {{ hours }}<span class="time-colon">:</span>{{ minutes }}
          </span>

    - unique_id: sidebar
      state: template
      attributes:
        time: >
          {% set hours = now().strftime('%H') %}
          {% set minutes = now().strftime('%M') %}
          <span class="time">
            {{ hours }}<span class="time-colon">:</span>{{ minutes }}
          </span>
        date: >
          <font color='#6a7377'><b>
          {% if strptime(states('sensor.date'), '%Y-%m-%d').day != None %}
          {% set days = ['Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag', 'Zondag'] %}
          {% set months = ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni',
          'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'] %}
            {{ days[now().weekday()] }}
            {{ strptime(states('sensor.date'), '%Y-%m-%d').day }} {{ months[now().month-1] }}
          {% endif %}
          </b></font>
        agenda: >
          <font color='#ffffff' size='4px'> 
          {% for i in range(0, 8) %}
          {% if is_state('sensor.ical_timenmieke_event_' + i|string,'unavailable') %}
          {% elif as_timestamp(state_attr('sensor.ical_timenmieke_event_' + i|string, "start"))|timestamp_custom('%-d')
            == as_timestamp(now())|timestamp_custom('%-d') %}
          📅 &nbsp {{ as_timestamp(state_attr('sensor.ical_timenmieke_event_' + i|string, "start")) | timestamp_custom('%H:%M') }}
          {{ state_attr('sensor.ical_timenmieke_event_' + i|string, "summary") }}<br>
          {% endif %} 
          {% endfor%}
          </font>

    - unique_id: sidebar2
      state: template
      attributes:
        time: >
          {% set hours = now().strftime('%H') %}
          {% set minutes = now().strftime('%M') %}
          <span class="time">
            {{ hours }}<span class="time-colon">:</span>{{ minutes }}
          </span>
        date: >
          <font color='#6a7377'><b>
          {% if strptime(states('sensor.date'), '%Y-%m-%d').day != None %}
          {% set days = ['Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag', 'Zondag'] %}
          {% set months = ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni',
          'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'] %}
            {{ days[now().weekday()] }}
            {{ strptime(states('sensor.date'), '%Y-%m-%d').day }} {{ months[now().month-1] }}
          {% endif %}
          </b></font>

    - unique_id: sidebar3
      state: template
      attributes:
        date: >
          {% if strptime(states('sensor.date'), '%Y-%m-%d').day != None %}
          {% set days = ['Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag', 'Zondag'] %}
          {% set months = ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni',
          'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'] %}
          {% set hours = now().strftime('%H') %}
          {% set minutes = now().strftime('%M') %}
            <span class="time">{{ hours }}<span class="time-colon">:</span>{{ minutes }} </span>
            <font color='#6a7377'><b>
            {{ days[now().weekday()] }}
            {{ strptime(states('sensor.date'), '%Y-%m-%d').day }} {{ months[now().month-1] }}
          {% endif %}
          </b></font>

    - unique_id: sidebar_weather
      state: template
      attributes:
        weather: >
          {% set entity = 'sensor.wupws_weather_1d' %}
          {% if not is_state(entity, 'unknown') %}
            {% set weather = states('sensor.wupws_weather_1d') %}      
              <font color='#6a7377'><b>Vandaag</font></b><br><font color='#6a7377' size='4px'>{{ weather }}</font>
          {% else %}
            {% set weather2 = states('sensor.wupws_weather_1n') %}         
              <font color='#6a7377'><b>Vanavond</font></b><br><font color='#6a7377' size='4px'>{{ weather2 }}</font>
          {% endif %}

    - unique_id: sidebar_vacuum
      state: template
      attributes:
        vacuum: >
          {% set entity_id = 'vacuum.dollie' %}
          {% set entity_id = 'vacuum.dollie' %}
          {% if is_state(entity_id, 'cleaning') %}
            <b>Dollie is aan het stofzuigen</b>
          {% elif is_state(entity_id, 'returning') %}
            <b>Dollie is klaar</b>
          {% endif %}

    - unique_id: sidebar_vacuum2
      state: template
      attributes:
        vacuum: >
          {% set entity_id = 'vacuum.herman' %}
          {% set entity_id = 'vacuum.herman' %}
          {% if is_state(entity_id, 'cleaning') %}
            <b>Herman is aan het maaien</b>
          {% elif is_state(entity_id, 'returning') %}
            <b>Herman gaat terug naar station</b>
          {% endif %}

    - unique_id: sidebar_active
      state: template
      attributes:
        active: >
          <b>
          {% set lights = [
            states.light.bios_spots,
            states.light.eettafel,
            states.light.gevellampen,
            states.light.haard_licht,
            states.light.inloopkast,
            states.light.keuken_spots_channel_1,
            states.light.keukennis_spot,
            states.light.kookeiland_spots,
            states.light.lamp_schuifpui,
            states.light.luifel_boven,
            states.light.luifel_onder_channel_1,
            states.light.muurspots,
            states.light.sauna,
            states.light.slaapkamer_licht,
            states.light.spiegel_channel_1,
            states.light.tuin_lampen,
            states.light.voordeur_licht,
            states.light.woonkamer_licht_achter,
            states.light.woonkamer_licht_voor,
            states.light.zwembad_verlichting
          ] %}
          {% set devices = [
            states.media_player.samsung_the_frame_43,
            states.climate.airconditioning
          ] %}
          {% set lights_on = lights | selectattr('state','eq','on') | list %}
          {% set lights_name = lights | selectattr('state','eq','on') | map(attribute='name') | join(', ') %}
          {% set devices_on = devices | selectattr('state','search','(on|cool|fan_only|playing)') | list %}
          {% set devices_name = devices_on | map(attribute='name') | join(', ') %}
          {% if (lights_on | length == 0) and (devices_on | length > 0) %}
            {{ devices_name | regex_replace(',([^,]*)$',' och\\1') }} is aan
          {% elif (lights_on | length == 1) and (devices_on | length == 1) %}
            {{ lights_name }} en {{devices_name }} zijn aan
          {% elif (lights_on | length == 1) and (devices_on | length > 1) %}
            {{ lights_name }}, {{ devices_name | regex_replace(',([^,]*)$',' och\\1') }} zijn aan
          {% elif (lights_on | length > 1) and (devices_on | length == 1) %}
            {{ lights_on | length }} lampen en {{ devices_name }} zijn aan
          {% elif (lights_on | length > 1) and (devices_on | length > 1) %}
            {{ lights_on | length }} lampen, {{ devices_name | regex_replace(',([^,]*)$',' och\\1') }} zijn aan
          {% elif (lights_on | length == 1) and (devices_on | length == 0) %}
            {{ lights_name }} is aan
          {% elif (lights_on | length > 1) and (devices_on | length == 0) %}
            {{ lights_on | length }} lampen zijn aan
          {% endif %}
          </b>


    - unique_id: sidebar_beregening
      state: template
      attributes:
        beregening: >
          [[[
            if (states['input_boolean.irrigation_cycle1_running'].state == 'on')
              var cycle = 'cycle1';
            else if (states['input_boolean.irrigation_cycle2_running'].state == 'on')
              var cycle = 'cycle2';
            else if (states['input_boolean.irrigation_cycle3_running'].state == 'on')
              var cycle = 'cycle3';
            else
              var cycle = 'cycle0';

            var zone = '{{ zone }}';
            var zone_name = states['input_text.irrigation_' + zone + '_name' ].state;
            var zone_timer_status = entity.state;

            if (cycle == 'cycle0')
              return zone_name;
            else if (zone_timer_status == 'active')
              return 'Watering ' + zone_name;
            else
              return zone_name;
          ]]]

lovelace-ui.yaml sidebar part

      - type: vertical-stack
        view_layout:
          grid-area: sidebar
        cards:
          - type: custom:button-card
            entity: sensor.template_sidebar
            template: sidebar
          - type: custom:button-card
            entity: sensor.template_sidebar_weather
            template: sidebar
          - type: custom:button-card
            entity: sensor.template_sidebar_vacuum
            template: sidebar
            tap_action:
              !include popup/footer_vacuum.yaml
          - type: custom:button-card
            entity: sensor.template_sidebar_vacuum2
            template: sidebar
          - type: custom:button-card
            entity: sensor.template_sidebar_active
            template: sidebar
            tap_action:
              !include popup/active.yaml
 




          - type: horizontal-stack
            mode: horizontal
            cards:
              - type: custom:button-card
                entity: person.tim
                entity_picture: /local/timkleur2.png
                show_entity_picture: true
                show_name: false
                tap_action:
                  !include popup/tim.yaml
                state:
                  - value: 'not_home'
                    styles:
                      card:
                        - filter: opacity(50%)
                      icon:
                        - filter: grayscale(90%)
                template: footer2
                card_mod: 
                  style: |
                    ha-card {
                      margin: 2vh;
                    }
              - type: custom:button-card
                entity: person.mieke
                entity_picture: /local/miekekleur2.png
                show_entity_picture: true
                show_name: false
                tap_action:
                  !include popup/mieke.yaml
                state:
                  - value: 'not_home'
                    styles:
                      card:
                        - filter: opacity(50%)
                      icon:
                        - filter: grayscale(90%)
                template: footer2    
                card_mod: 
                  style: |
                    ha-card {
                      margin: 2vh;
                    }
            card_mod: 
              style: |
                ha-card {
                  border: none;
                  --card-height: inherit !important;
                  position: absolute;
                  bottom: 4vh;
                  left: 6vh;                  
                }
                @media (max-width: 400px) {
                  ha-card {
                    position: inherit;
                  }
                }

did you manage to solve it already? Maybe it has to do with an upgrade of Hass since after moving the docker the latest image was pulled.

Anybody else having the same issue?

i fixed it by updating card_mod and clearing cache then its back to normal.

Nice! did the same. I also change this:A different take on designing a Lovelace UI - #5453 by VietNgoc