A different take on designing a Lovelace UI

lovelace:
  mode: yaml
  resources:
    [ {url: /hacsfiles/bring-shopping-list/bring_shopping_list_card.js,       type: module},
      {url: /hacsfiles/mini-graph-card/mini-graph-card-bundle.js,             type: module},
      {url: /hacsfiles/mini-media-player/mini-media-player-bundle.js,         type: module},
      {url: /hacsfiles/vacuum-card/vacuum-card.js,                            type: module},
      {url: /hacsfiles/tankerkoenig-card/tankerkoenig-card.js,                type: module},
     
      {url: /hacsfiles/bar-card/bar-card.js,                                  type: module},
      {url: /hacsfiles/button-card/button-card.js,                            type: module},
      {url: /hacsfiles/kiosk-mode/kiosk-mode.js,                              type: module},
      {url: /hacsfiles/light-entity-card/light-entity-card.js,                type: module},
      {url: /hacsfiles/light-popup-card/light-popup-card.js,                  type: module},
      {url: /hacsfiles/lovelace-card-mod/card-mod.js,                         type: module},
      {url: /hacsfiles/lovelace-hui-element/hui-element.js,                   type: module},
      {url: /hacsfiles/lovelace-layout-card/layout-card.js,                   type: module},
      {url: /hacsfiles/lovelace-slider-entity-row/slider-entity-row.js,       type: module},
      {url: /hacsfiles/swipe-card/swipe-card.js,                              type: module},
      {url: /hacsfiles/transmission-card/transmission-card.js,                type: module},

      {url: '/local/calendar-card.js?v=31091',                                type: module},
      {url: '/local/stack-in-card.js?v=101',                                  type: module},
      {url: '/local/valetudo-map-card.js?v=42dbceb',                          type: module},
      {url: '/local/custom_icons.js?v=25052001',                              type: module},
      {url: /local/font.css,                                                  type: css} ]

This is in my conf file and this is my Lovelace yaml

##########################################################################
#                                                                        #
#                              * SETTINGS *                              #
#                                                                        #
##########################################################################

anchors:
  ⚓₁: &title
    entity: sensor.placeholder
    tap_action:
      action: none
    hold_action:
      action: none
    type: state-label
  ⚓₂: &title-style
    color: '#bcbebf'
    font-family: SF Text
    font-size: 2.4vw
    font-weight: 500
    max-width: 1px
    cursor: default


button_card_templates: !include button_card_templates.yaml
##########################################################################
#                                                                        #
#                              * LOVELACE *                              #
#                                                                        #
##########################################################################
title: Home
views:
  - panel: true
    path: default_view
    cards:
      - type: picture-elements
        image: /local/background.png
        elements:

          # markdown fix
          - type: custom:hui-element
            card_type: markdown
            style: {opacity: 0}
            content: preload
            
            
          #################################################
          #                                               #
          #                   COVID-19                    #
          #                                               #
          #################################################

          - type: custom:hui-markdown-card
            class: coronavirus
            style:
              {top: 93.65%, left: 70.2%}
            content: >
              {% if is_state('sensor.covid_19_folkhalsomyndigheten', 'Tillgänglig') %}
                {% set data = state_attr('sensor.covid_19_folkhalsomyndigheten', 'embedCode') %}
                {% set total = data | regex_findall_index('Totalt[^,]*?(\d+)[^,]*?(\d+)[^,]*?(\d+)') | list %}
                {% set break = ' ‍ ‍ ‍ ‍ ‍ ‍<font color="#2f3436">|</font> ‍ ‍ ‍ ‍ ‍ ‍' %}
                <font color='#6a7377'>
                <ha-icon icon="mdi:virus"></ha-icon> <b>Coronavirus</b>{{ break -}}
                <ha-icon icon="mdi:chart-bar"></ha-icon> <b>{{ ((total[0] | int / 10327589) * 100) | round(2) }}%</b> av Sverige{{ break -}}
                <ha-icon icon="mdi:emoticon-sad"></ha-icon> <b>{{ total[0] }}</b> fall{{ break -}}
                <ha-icon icon="mdi:grave-stone"></ha-icon> <b>{{ total[2] }}</b> avlidna{{ break -}}
                <ha-icon icon="mdi:map-marker-radius"></ha-icon> <b>{{ data | regex_findall_index('Skåne[^,]*?(\d+)') }}</b> fall i Skåne
                </font>
              {% endif %}


          ##########################################################################
          #                                                                        #
          #                              * SIDEBAR *                               #
          #                                                                        #
          ##########################################################################

          - type: image
            image: local/sidebar.png
            style:
              {top: 49.24%, left: 10.6%, width: 21.5%, pointer-events: none, border-right: '1.5px solid rgba(58,69,73,0.2)'}
        
          #################################################
          #                                               #
          #                   MARKDOWN                    #
          #                                               #
          #################################################

          - type: custom:hui-markdown-card
            class: sidebar
            style:
              {top: 9%, left: 11.1%}
            content: >
              <span>{{ now().strftime('%H') }}<span>:</span>{{ now().strftime('%M') }}</span>
              <font color='#6a7377'><b>{{ states('sensor.sidebar_day') }}</b><br>
              <b>{{ states('sensor.sidebar_date') }}</b> </font><br> 
              <b>{{ states('sensor.sidebar_greeting') }}</b>
              <b>{{ states('sensor.sidebar_active') }}</b>
              <font color='#6a7377'>
              <b>{{ states('sensor.sidebar_vacuum') }}</b>
              {{ states('sensor.sidebar_weather') }}
              {{ states('sensor.tvatta_countdown') }}
              {{ states('sensor.mathem_countdown') }}
              </font>
              
          #################################################
          #                                               #
          #                 VACUUM BUTTON                 #
          #                                               #
          #################################################

          - type: icon
            icon: custom:roborock-vacuum
            title: Dammsugare
            style:
              top: 87.41%
              left: 4.8%
              color: rgb(255, 255, 255)
              opacity: 0.1
              padding: 0.8vw
              --mdc-icon-size: 4vw
            tap_action: !include popup/sidebar_vacuum.yaml

          #################################################
          #                                               #
          #                  INFO BUTTON                  #
          #                                               #
          #################################################

          - type: icon
            icon: mdi:information-outline
            title: Information
            style:
              top: 87.41%
              left: 10.7%
              color: rgb(255, 255, 255)
              opacity: 0.1
              padding: 0.8vw
              --mdc-icon-size: 4vw
            tap_action: !include popup/sidebar_information.yaml

          #################################################
          #                                               #
          #                UPDATES BUTTON                 #
          #                                               #
          #################################################

          - type: icon
            icon: mdi:arrow-up-bold-circle-outline
            title: Uppdateringar
            style:
              top: 87.41%
              left: 16.55%
              color: rgb(255, 255, 255)
              opacity: 0.1
              padding: 0.8vw
              --mdc-icon-size: 4vw
            tap_action: !include popup/sidebar_update.yaml
              
              

not trying to be a wiseass here, but exploring this amazing interface to seek some answers, this just popped up. Why is anyone still using this? I didnt recognize it at first, but it seems to be a now defunct option of the pre-loader card, which in itself isnt needed anymore at all?

Or what am I missing here (had a red card in the past now and then, but using hui-element card has completely removed that issue?)

sorry if this is too obvious…thx.

Sorry but now I don’t quite understand what to do to fix the error. Remove the content: preload?

please don’t get me wrong, I didn’t say it was an error, I was asking why this is still used ( if it indeed is the pre-loader option I think it is). Might just as well be something else I don’t know about :wink:

but yes, if anything, you could comment the line and see what happens.

Thanks for the answer. I have comment the line but I have the same behavior

@Mariusthvdb

content is a required markdown configuration variable, so it can not be left blank. You can write content: x and it’ll work just as well.

Long story short
hui-element markdown, trouble styling
hui-markdown-card, red error

Placing an “empty” hui-element markdown anywhere will fix hui-markdown-card red error and styling will work.

@JayR

It’s been answered

How does the line look like that I should include in the Yaml config. I’ve posted my configuration in the chat. How can I include this in the lovelace yaml

well, of course it is… sorry I missed it was used in the markdown…thought it related to this GitHub - gadgetchnnel/lovelace-card-preloader: Allows preloading of Lovelace cards as a work around for changes in Home Assistant 0.107

(didnt know about the ‘fake content’ though, how come this doesn’t show ‘preload’ somewhere?) I mean, using that exact code

  - type: custom:hui-element
    card_type: markdown
    style: {opacity: 0}
    content: preload

results in

you are aware of the undocumented

    - type: custom:hui-element
      card_type: markdown
      style: |
        ha-card.type-markdown {
          box-shadow: none;
          margin: 0px -16px 0px -16px;
        }

you can use to style cards which cause trouble? Of the many hui-elements (even with markdown) I use, there are only 3 need this though, not sure why. They are used as ‘entities’ in an entities card, is all I can say about that.

this:

  - type: custom:hui-element
    card_type: markdown
    style: |
      ha-card.type-markdown {opacity: 0}
    content: preload

does make opacity 0 and cloak the card… Or any other styling you want to use, so no more need for the opacity: 0 hack.

Did someone managed to get calendar events in de sidebar?
I mean not the countdown to a event but the real event.
If so can you share your code :slight_smile:

I have this in my configuration.yaml for adding the dashboard. Make sure to include theme.yaml in configuration.yaml. I did this by creating a directory named include and included it in configuration.yaml. See examples:

lovelace:
  mode: storage
  # Add yaml dashboards
  dashboards:
    lovelace-yaml:
      mode: yaml
      title: Dashboard
      icon: mdi:script
      show_in_sidebar: true
      filename: lovelace.yaml
packages: !include_dir_named include

this I added to the lovelace.yaml to enable the correct theme.

title: Dashboard
views:
  - panel: true
    theme: tablet
    path: default_view

Hope this helps

Because it has no top/left position so it’s placed “out of bounds”, so opacity: 0 is redundant, but yes my opacity does nothing :smile:

Hi @Mattias_Persson,

When adding your support for FullyKiosk on tablet, I first get the error (in REST-call):

ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.rest]: invalid url for dictionary value @ data['resource']. Got '192.168.XXX.YYY:PORT/?cmd=deviceInfo&type=json&password=PASSWORD'

If I browse the URL, it works fine. Any idea what the issue is?

The second error (which might be connected to the first?) is:

ERROR (MainThread) [frontend.js.latest.202012291] http://192.168.XXX.YYY:PORT/local/kiosk-mode.js?v=145:17:24 Uncaught TypeError: Cannot read property 'config' of undefined

Any directions you can provide here?

Cheers!

Hi! Any idea on how to make themes.yaml’s pop up card to become transparent like this one?
I’ve been trying to make a trial and error but to no avail.

And to make this part a rounded one?

image

Thank you in advance!

I love this setup! Grymt jobbat!
Will definitely try to make something similar for our new house project!
Thanks for sharing!

Were you able to find out which icons these are? They look really great.

4 Likes

Got the same problem.

Use your lovelace.yaml

anchors:
  ⚓₁: &title
    entity: sensor.placeholder
    tap_action:
      action: none
    hold_action:
      action: none
    type: state-label
  ⚓₂: &title-style
    color: '#bcbebf'
    font-family: SF Text
    font-size: 2.4vw
    font-weight: 500
    max-width: 1px
    cursor: default
          - prefix: Wohnzimmer
            <<: *title
            style:
              top: 9.15%
              left: 25.4%
              <<: *title-style

But it wont change the font.

Where is the mistake?

image

Got it, typo in the filename

Wrote fonts.css instead of font.css :exploding_head:

I guess the new browser_mod version 1.30 breaks a lot? Just checking before I upgrade and need a lot of rework.

Starting to unterstand how it works.

Inspired by homekit-panel-card from @DBuit and @Frank_Hagenbuch 's posts in this thread I made a climate-card.

This is my first shot. Next step are popups with thermostat-popup-card. Also from @DBuit

Left is the current temperature measured by the device. When it is heating it will be green.
Right is the target temperature which is set on the device. When it is off it disapears.

Everbody feel free to bring in there Ideas :slight_smile:

image image

          - type: custom:button-card
            entity: climate.wohnesszimmer
            name: Wohnzimmer
            style:
              top: 20.35%
              left: 41.31%
              width: 10%
            template: climate
  climate:
    template: ['base']
    aspect_ratio: 1/1
    show_state: true
    show_icon: false
    show_name: true
    show_current_temperature: true
    show_control: true
    state:
      - value: 'heat'
        styles:
          card: [background-color: 'rgba(255, 255, 255, 0.8)']
          name: [color: 'rgba(0, 0, 0, 0.6)']
          state: [color: 'rgba(0, 0, 0, 0.6)']
    tap_action:
      action: more-info
    custom_fields:
      circle_current: >
        [[[ {
        const temperature = entity.attributes.current_temperature;
        const stroke_color = entity.state === 'heat' ? '#b2b2b2' : '#313638'; 
        const fill_color = entity.state === 'heat' ? '#00ba32' : '#FFFFFF08';
        const radius = 30;
        return `<svg viewBox="0 0 60 60"><circle cx="30" cy="30" r="${radius}" stroke="${stroke_color}" stroke-width="1.5" fill="${fill_color}" style="
        transform: rotate(-90deg); transform-origin: 50% 50%; " />
        <text x="50%" y="54%" fill="#f7f8fa" font-size="18" text-anchor="middle" alignment-baseline="middle">${temperature}<tspan font-size="10">°</tspan></text></svg>`; } ]]]
      circle_target: >
        [[[ if (entity.state === 'heat' && entity.attributes.temperature) {
        const temperature = entity.attributes.temperature;
        const stroke_color = entity.state === 'heat' ? '#b2b2b2' : '#313638'; 
        const fill_color = entity.state === 'heat' ? 'none' : '#FFFFFF08';
        const radius = 20.5;
        return `<svg viewBox="0 0 50 50"><circle cx="25" cy="25" r="${radius}" stroke="${stroke_color}" stroke-width="1.5" fill="${fill_color}" style="
        transform: rotate(-90deg); transform-origin: 50% 50%; " />
        <text x="50%" y="54%" fill="#8d8e90" font-size="14" text-anchor="middle" alignment-baseline="middle">${temperature}<tspan font-size="10">°</tspan></text></svg>`; } ]]]
    styles:
      name:
        [top: 57.7%, left: 11%, line-height: 2vw, position: absolute]
      state:
        [top: 74%, left: 11%, line-height: 2vw, position: absolute]
      card:
        [font-family: Sf Display, letter-spacing: 0.05vw, font-weight: 400, color: 'rgba(255, 255, 255, 0.3)', font-size: 1.34vw, background-color: 'rgba(115, 115, 115, 0.2)', border-radius: 0.8vw, box-shadow: none, transition: none]
      custom_fields:
        circle_target: 
          [top: 8.5%, left: 54.5%, width: 3.5vw, position: absolute, letter-spacing: 0.03vw]
        circle_current: 
          [top: 6.5%, left: 6%, width: 3.5vw, position: absolute, letter-spacing: 0.03vw]
2 Likes

To get the swipe card working i changed his private domain .svg to a blank .svg
now everything is working.

          - type: custom:swipe-card
            start_card: 1
            parameters:
              roundLengths: true
              effect: coverflow
              speed: 650
              spaceBetween: 20
              threshold: 7
              coverflowEffect:
                rotate: 80
                depth: 300
            style:
              top: 56.55%
              left: 35.8%
              width: 20.97%
              height: 1px
              --ha-card-border-radius: .88vw
            cards:
              - type: picture-elements
                image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20height%3D%22300px%22%20viewBox%3D%220%200%20300px%20300px%22%20width%3D%22300px%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3C%2Fsvg%3E"
                elements: