A different take on designing a Lovelace UI

Can you show your config for the four room`s in one row? I´m struggling with that.

Yeah

- type: custom:button-card
  hold_action:
    action: more-info

It does, or am I missing something?

1

1 Like

You can return html with jinja because that goes into button-card (sidebar)

{% if conditions %}
  <svg>...</svg>
{% else %}
  <ha-icon icon="mdi:battery"></ha-icon>
{% endif %}

It’s a good idea, but to me that is not critical info

Here’s a half assed test

1 Like

It doesn’t break my plex_recently_added config of max: 1, so why not?

1 Like

Same, changed it to james webb space telescope

but also added relative time and responsive spacing


1 Like

Wow, so cool. Might have to do that too.
Thanks for the plex fix.
I just found a new background from this guy
It’s in his www/ui/musica folder.
How cool is this??!!

1 Like

Ah man, you are cheating though. I’m not a programmer like you are.
Where should this jwst.py reside?
Can it be on my pi with home assistant and HA can still call it up with the ssh?
I see that it’s in .ssh folder but that’s a hidden folder right?

Well first of all, thanks so much @Mattias_Persson for sharing your entire setup! Helps me a great deal!!

Is your docker-compose.yml file available somewhere? I can’t seem to find it :blush:

I have a question how to use “card-mod-helper” tools.
I am new to css but after re-engineering your code. I can change some css in custom:button-card.
however I cannot change the css of theme and popup card.
Can you show me the simple one? Such as I want to change the color of “Studio” grid-area.

(BTW: I did see #1285 but still don’t understand.)

I inspect and get from card-mod-helper
“#view>hui-view>grid-layout$#root>hui-grid-card:nth-child(4)$h1”

now I goto lovelace code:

type: grid
title: Studio
style:
  "#view>hui-view>grid-layout$#root>hui-grid-card:nth-child(4)$h1": |
    h1 {
      color: red;
    }

even try to delete try

style:
  "#root>hui-grid-card:nth-child(4)$h1": |
    h1 {
      color: red;
    }

or try something else but the color still be the same.

Could you please guide me out?

Thank you in advance.

Thanks! I used the input_boolean loader code from older commits, and have it work like I wanted now.

However, I find the interface doesn’t load the animation once the boolean changes but only after refreshing the page or the entity state changes. I made adjustment so it works ok for me now but is this working correctly, or am I missing something?

One more question, I find the ‘locking’ and ‘unlocking’ states display with small letters instead of capital like ‘Locking’. I can’t find any lists for this in the codes, would you know how to fix this?

Thanks a lot for all the effort!! It comes together really nicely with a lot of flexibility.

I don’t get that option for some reason.

Thanks. I was looking in the docs yesterday, but just couldn’t find it.

I’m completely in love with the template!

I do however run into two issues:

When trying to add a media player with the base template the action:toggle doesn’t play/pause the media player. I can’t seem to fix this without breaking it for other entities. Is there a way to make the base template play/pause as well?

          - type: custom:button-card
            entity: media_player.sonos_woonkamer
            name: Monitorer
            triggers_update: sensor.volume_sonos_woonkamer
            hold_action:
              !include popup/sonos_woonkamer.yaml
            template:
              - base
              - icon_monitors
              - circle
              - loader
            variables:
              circle_input: >
                [[[
                  var entity_id = 'sensor.volume_sonos_woonkamer';
                  return states[entity_id] === undefined ? null : states[entity_id].state;
                ]]]

I’ve also tried filling in the circle_input with my own Sonos volume template sensor, however that doesn’t show in the card either.

sensor:
  - platform: template
    sensors: 
      volume_sonos_woonkamer:
        value_template: '{{ states.media_player.sonos_woonkamer.attributes.volume_level |float * 100 | round(0) }}'  
        friendly_name: 'Volume' 
        unit_of_measurement: '%'

Any tips on how to make this work?

Add a tap action for that button

tap_action:
  action: call-service
  service: media_player.media_play_pause
  service_data:
    entity_id: >
      [[[ return entity.entity_id; ]]]
1 Like

I don’t remember having any issues, I changed to how it works now because it’s easier not having to deal with input booleans

This works

state_display: >
  [[[
    if (entity) {
      return entity.state.charAt(0).toUpperCase() + entity.state.slice(1);
    }
  ]]]

But just now realized that css can handle that

1 Like

https://github.com/thomasloven/lovelace-card-mod#styling-cards


So you’ll have to wrap it in mod-card or what I do, style from themes.yaml

#################################################
#                                               #
#              GRID CARD HEADINGS               #
#                                               #
#################################################

grid-layout$:
  hui-grid-card:
    $: |
      /* default */
      h1 {
        ...

  hui-grid-card:nth-child(4):
    $: |
      h1 {
        color: red !important;
      }

https://github.com/matt8707/docker-compose-dsm
https://github.com/matt8707/docker-compose-rpi

(also linked from first post under “hardware”)

The problem is you have to install python module requests-html. So for me moving that script to my rpi was an easy way out. It may also be possible with AppDaemon, but I have zero experience with it.