A different take on designing a Lovelace UI

@Mattias_Persson hi, how I get these sensors?

sensor.hass_version_installed
sensor.hass_version_latest

with the version integration it doesn’t work…

thx in adv.

Hello. Did you add this integration?

[Link to Integrations: Add integration – My Home Assistant](https://Version Integration)


Are these the sensors in the photo? They have a different name than the one in the repository @Mattias_Persson

Hi. What calculation did you make to complete the circle according to the value it has inside. Thank you

Hello. Could someone share the temperature card template? Thank you

                    variables:
                      circle_input: >
                        [[[
                          let sensor = states['sensor.your_volume_entity_here'];
                          return sensor === undefined || sensor.state;
                        ]]]

thanks for the reply. I did not express myself very well. I meant the whole card. I’m having trouble displaying the chart properly as it doesn’t fill all the way to the bottom and there’s a gap at the bottom of the card

Mmh, I have an AC and made 3 scripts. Every script has it’s own timer inside (1hr, 2hrs and 3hrs).
Now I want to link this script to a button to trigger the AC to run it for a certain amount of time and to shutoff.

Now, it works when I add the template ‘- base’ to it, but it doesn’t work if I want to run it on the custom button card with the template ‘- icon_only’.
The scaling doesn’t work very well with the base template on the entity so I have no clue how to proceed here.

My current config:

          - type: custom:button-card
            entity: script.1u_ac_slaapkamer
            name: Timer 1u
            hold_action:
              action: none
            icon: mdi:numeric-1-box
            template: 
              - icon_only

Also tried (but didnt work)

          - type: custom:button-card
            name: 1hr Timer
            icon: mdi:numeric-1-box
            entity: script.1u_ac_slaapkamer
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.1u_ac_slaapkamer
            template: icon_only

Can somebody help me with this? :slight_smile:

Can you send a screenshot, I dont get what you mean with this.

I got here and I don’t know how to continue. The graphic was outside the card

Sin título

This is my card. this is the code from @Mattias_Persson

Bildschirmfoto 2022-07-03 um 20.10.06

and this is my code in the ui-lovelace.yaml

- type: custom:button-card
            entity: sensor.sensor_terrasse_temperature
            name: Temperatur
            tap_action: none
            state_display: >
              [[[ return ' '; ]]]
            template:
              - base
              - circle
              - icon_climate
            custom_fields:
              icon: >
                <ha-icon icon="mdi:thermometer" style="color: #9da0a2;"></ha-icon>
              circle: >
                [[[
                  if (entity) {
                    return `
                      <svg viewBox="0 0 50 50">
                        <circle cx="25" cy="25" r="20.5" stroke="none" stroke-width="1.5" fill="rgba(255,255,255,0.04)" />
                        <text x="50%" y="54%" fill="#8d8e90" font-size="14" text-anchor="middle" alignment-baseline="middle" dominant-baseline="middle">${parseInt(entity.state)}<tspan font-size="10">°C</tspan></text>
                      </svg>
                    `;
                  }
                ]]]
              graph:
                card:
                  type: sensor
                  entity: >
                    [[[ return entity.entity_id; ]]]
                  graph: line
                  card_mod:
                    style: |
                      .header, .value, .measurement {
                        display: none !important;
                      }
              push_graph: >
                [[[
                  setTimeout(() => {
                    let elt = this.shadowRoot,
                      card = elt.getElementById('card'),
                      container = elt.getElementById('container'),
                      graph = elt.getElementById('graph');
                    if (elt && card && container && graph) {
                      card.insertBefore(graph, container);
                    }
                  }, 0);
                  return null;
                ]]]
            styles:
              custom_fields:
                graph:
                  - position: absolute
                  - width: 100%
                  - height: 100%
                  - clip-path: inset(0 round var(--custom-button-card-border-radius))
                  - left: 0
                  - bottom: 0
8 Likes

Cool. thanks for sharing. With this I will be able to see what the problem was

Excellent friend. I work perfect. Thank you very much
The only thing I don’t understand is where the color of the line comes from

You can just add the color parameter at the css styling

- color: '#html_color_code_here'

@Mattias_Persson how did you get it sorted to get the slide animation? Like, when you slide in your gif it has some depth to it. Mine just staticly slides from left to right.

1 Like

If I don’t change it in the repository, it has it as you want.

I was trying with line-color. Thank you

add effect: ‘coverflow’ to the parameters of the swipe card in ui-lovelace.yaml

- type: custom:swipe-card
            parameters:
              effect: 'coverflow'
              speed: 550
              spaceBetween: 40
              threshold: 5

here is the thread with examples

2 Likes

could you show an example were to place the color option in the code?

thx

Just don’t include something like a slider on your card , or do you have a solution for that? I mostly gave up on swiper because I could not have a slider that would not also cause swiping and my wife said “forget it”

Like input_number slider in a card which you can say “I am sliding that and not the card” … I gave up. Gave her a hold_action