A different take on designing a Lovelace UI

And here is the media card:

type: picture-elements
image: local/overlay.svg
style: |
  ha-card {
    --ha-card-background: var(--temp-background-color) !important; 
    --ha-card-border-width: 0px !important;
    --ha-card-border-radius: 5px !important;
    box-shadow: none !important;
  }        
elements:
  - aspect_ratio: 1/1
    entity: media_player.spotify_homeassistant
    show_icon: false
    show_label: false
    show_last_changed: false
    show_entity_picture: true
    show_name: false
    show_state: false
    tap_action:
      action: none
    style:
      height: 100%
      width: 100%
      top: 50%
      left: 50%
    state:
      - styles:
          entity_picture:
            - filter: grayscale(100%) blur(4px)
            - transition: all 0.5s ease
        value: paused
    styles:
      card:
        - padding: 0px
        - background-color: rgba(255,255,255,0)  
      entity_picture:
        - filter: grayscale(60%) 
        - border-radius: 5px
        - height: 100%
        - width: 100%
        - position: absolute
        - transition: all 0.5s ease
    type: 'custom:button-card'
    tap_action:
      !include popup/media_popup.yaml

  - type: 'custom:mod-card'
    style:
      '--mini-media-player-icon-color': var(--text-color) #change or remove to use own color
      '--mini-media-player-base-color': var(--text-color) #change or remove to use own color
      '--mini-media-player-accent-color': var(--music-accent-color) #change or remove to use own color
      width: 100%
      transform: 'translate(0%, -100%'
    card:
      artwork: none
      entity: media_player.spotify_homeassistant
      group: false
      hide:
        controls: true
        icon: true
        name: true
        power: true
        runtime: false
        source: true
        volume: true
      hold_action:
        action: none
      icon: 'mdi:spotify'
      info: scroll
      card_mod:
        style: |
          ha-card { 
            height: 55px;
            font-family: Mynerve;
            {%- if states['media_player.spotify_homeassistant'].state == 'idle' -%}
              --ha-card-background: rgba(0, 0, 0, 0);
            {% else %}
              --ha-card-background: rgba(0, 0, 0, 0.65); 
            {% endif %}
          }
          .entity__info {
            max-width: 100% !important; 
          }    
          .mmp__bg,
          .mmp-player,
          .mmp__container {
            border-radius: 0px !important; 
          } 
      type: 'custom:mini-media-player'
      tap_action:
        !include popup/media_popup.yaml

  - aspect_ratio: 1/1
    show_name: false
    show_icon: true
    show_entity_picture: true
    entity_picture: /local/next.png
    icon: 'mdi:circle'
    type: 'custom:button-card'  #next track
    template:
      - tilt
      - media_button
    size: 108%
    entity: media_player.spotify_homeassistant
    style:
      right: '-5%'
      top: 40%
      height: 25%
      width: 25%
    tap_action:
      action: call-service
      service: media_player.media_next_track
      service_data:
        entity_id: media_player.spotify_homeassistant
      haptic: medium
    hold_action:
      action: none

  - aspect_ratio: 1/1
    show_icon: true
    show_name: false
    show_state: false
    show_entity_picture: true
    entity_picture: /local/prev.png
    icon: 'mdi:circle'  # prev track
    type: 'custom:button-card'
    template:
      - tilt
      - media_button
    size: 108%
    entity: media_player.spotify_homeassistant
    style:
      right: 55%
      top: 40%
      height: 25%
      width: 25%
    tap_action:
      action: call-service
      service: media_player.media_previous_track
      service_data:
        entity_id: media_player.spotify_homeassistant
      haptic: medium
    hold_action:
      action: none

  - aspect_ratio: 1/1
    show_name: false
    show_state: false
    show_entity_picture: true
    entity_picture: /local/pause.png
    icon: 'mdi:circle'
    type: 'custom:button-card' # PAUSE
    template:
      - tilt
      - media_button
    size: 108%
    entity: media_player.spotify_homeassistant
    style:
      right: 10%
      top: 40%
      height: 40%
      width: 40%
    tap_action:
      action: call-service
      service: script.spotistart_main
      haptic: medium
    hold_action:
      action: none

  - show_name: false
    entity: media_player.spotify_homeassistant
    show_entity_picture: true
    entity_picture: /local/down.png
    icon: 'mdi:circle'  # down vol
    style:
        left: 27.5%
        top: 62.5%
        height: 15%
        width: 15%
    tap_action:
        action: call-service
        service: media_player.volume_set
        service_data:
          volume_level: "[[[ return entity.attributes.volume_level - 0.050 ]]]"
          entity_id: media_player.spotify_homeassistant
        haptic: medium          
    type: 'custom:button-card'  
    size: 109%
    template:
      - tilt
      - media_button
    # VOLUME +          

  - show_name: false
    show_entity_picture: true
    entity_picture: /local/up.png
    icon: 'mdi:circle'  # up vol
    entity: media_player.spotify_homeassistant
    style:
        left: 72.5%
        top: 62.5%
        height: 15%
        width: 15%
    tap_action:
        action: call-service
        service: media_player.volume_set
        service_data:
          volume_level: "[[[ return entity.attributes.volume_level + 0.050 ]]]"
          entity_id: media_player.spotify_homeassistant
        haptic: medium          
    type: 'custom:button-card'    
    size: 109%
    template:
      - tilt   
      - media_button

media_button template:

media_button: 
  state:
    - styles:
        card:
          - padding: 0px
          - border-radius: 50%
          - background-color: rgba(0,0,0,0.5)
          - border-width: 0px  
          - border-color: rgba(255,255,255,0.6) 
        icon:
          - filter: opacity(0.5)
          - transition: all 0.5s ease
          - color: black #color of button while paused
      value: paused
  styles:
    card:
      - padding: 0px
      - border-radius: 50%
      - background-color: rgba(0,0,0,0.5)
      - border-width: 0px  
      - border-color: rgba(255,255,255,0.6) 
    icon:
      - filter: opacity(0.5)
      - transition: all 0.5s ease
      - color: black

fel
le
next
prev
pause
play
down
up

2 Likes

hello,

has someone a hint where my error is? i change the rows a little bit but now the rows or the cards have a defferent size, how you can see on the picture

would be nice if some can help me

- type: custom:grid-layout
    path: 0
    layout:
      #default TABLET BREIT
      margin: 0
      #grid-gap: 2.7% 2.7%
      grid-gap: var(--custom-layout-card-padding) #3.3vw
      grid-template-columns: 0 1fr 1fr 1fr 1fr 1fr 0
      grid-template-rows: 0 min-content fit-content(100%) fit-content(100%) min-content 0
      grid-template-areas: |
        ". .             .                .             .        .              ."
        ". chips         chips            chips         .        .              ."
        ". hemma         home_2           smokesensors  climate  studio         ."
        ". media         vardagsrum       flur          sovrum   rolladen       ."
        ". keller        ankleidezimmer   badezimmer    garten   schlafzimmer   ."
        ". övrigt        .                .             .        .              ."

Hi, could you share the code for this sensor used in your nowplaying mediaplayer?

sensor.vibrant_color

Hi, this is the sensor that generates the colors from the image, specifically in my case from the attribute entity_picture. The sensor is created via node red, which I copied from another forum thread. I don’t know how to create it any other way…

nodes, change your HA ip address

[
    {
        "id": "bd9143fe7b314177",
        "type": "function",
        "z": "1f04fadd7ecc56e6",
        "name": "Format Album Art URL",
        "func": "msg.payload = 'http://192.168.0.73:8123' + msg.data.new_state.attributes.entity_picture\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 570,
        "y": 100,
        "wires": [
            [
                "c309c0f5a752ecdd"
            ]
        ]
    },
    {
        "id": "7882f420860746b9",
        "type": "function",
        "z": "1f04fadd7ecc56e6",
        "name": "Colors",
        "func": "var msg1 = { payload: msg.payload.Vibrant.rgb[0] + ',' + msg.payload.Vibrant.rgb[1] + ',' + msg.payload.Vibrant.rgb[2] };\nvar msg2 = { payload: msg.payload.DarkVibrant.rgb[0] + ',' + msg.payload.DarkVibrant.rgb[1] + ',' + msg.payload.DarkVibrant.rgb[2] };\nvar msg3 = { payload: msg.payload.LightVibrant.rgb[0] + ',' + msg.payload.LightVibrant.rgb[1] + ',' + msg.payload.LightVibrant.rgb[2] };\nvar msg4 = { payload: msg.payload.Muted.rgb[0] + ',' + msg.payload.Muted.rgb[1] + ',' + msg.payload.Muted.rgb[2] };\nvar msg5 = { payload: msg.payload.DarkMuted.rgb[0] + ',' + msg.payload.DarkMuted.rgb[1] + ',' + msg.payload.DarkMuted.rgb[2] };\nvar msg6 = { payload: msg.payload.LightMuted.rgb[0] + ',' + msg.payload.LightMuted.rgb[1] + ',' + msg.payload.LightMuted.rgb[2] };\n\nreturn [msg1, msg2, msg3, msg4, msg5, msg6];",
        "outputs": 6,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1110,
        "y": 200,
        "wires": [
            [
                "cf6ff890cadf96ef"
            ],
            [
                "63e066959f858c54"
            ],
            [
                "6efb0dc3953b3240"
            ],
            [
                "5806b87267d02bc3"
            ],
            [
                "77b1979bc5ad11f3"
            ],
            [
                "e5b91489990a01ea"
            ]
        ]
    },
    {
        "id": "9a76bf988f90900d",
        "type": "switch",
        "z": "1f04fadd7ecc56e6",
        "name": "",
        "property": "data.new_state.attributes.active_child",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "media_player.spotify",
                "vt": "str"
            },
            {
                "t": "neq",
                "v": "media_player.living_room_tv",
                "vt": "str"
            }
        ],
        "checkall": "false",
        "repair": false,
        "outputs": 2,
        "x": 330,
        "y": 180,
        "wires": [
            [
                "bd9143fe7b314177"
            ],
            [
                "4423075c7a23222b"
            ]
        ]
    },
    {
        "id": "4423075c7a23222b",
        "type": "function",
        "z": "1f04fadd7ecc56e6",
        "name": "Format Album Art URL",
        "func": "msg.payload = msg.data.new_state.attributes.entity_picture\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 570,
        "y": 270,
        "wires": [
            [
                "c309c0f5a752ecdd"
            ]
        ]
    },
    {
        "id": "c309c0f5a752ecdd",
        "type": "vibrant",
        "z": "1f04fadd7ecc56e6",
        "name": "Extract Album Art Color",
        "x": 890,
        "y": 200,
        "wires": [
            [
                "7882f420860746b9"
            ]
        ]
    },
    {
        "id": "eacdc375eb4de995",
        "type": "server-state-changed",
        "z": "1f04fadd7ecc56e6",
        "name": "Currently Playing Changed",
        "server": "b7acd042.10f4c",
        "version": 5,
        "outputs": 2,
        "exposeAsEntityConfig": "",
        "entityId": "media_player.currently_playing",
        "entityIdType": "exact",
        "outputInitially": true,
        "stateType": "str",
        "ifState": "playing",
        "ifStateType": "re",
        "ifStateOperator": "is",
        "outputOnlyOnStateChange": false,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": true,
        "ignorePrevStateUnavailable": true,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 150,
        "y": 180,
        "wires": [
            [
                "9a76bf988f90900d"
            ],
            []
        ]
    },
    {
        "id": "cf6ff890cadf96ef",
        "type": "ha-sensor",
        "z": "1f04fadd7ecc56e6",
        "name": "Vibrant Color",
        "entityConfig": "dfb12e11b7a6e846",
        "version": 0,
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 1360,
        "y": 60,
        "wires": [
            []
        ]
    },
    {
        "id": "63e066959f858c54",
        "type": "ha-sensor",
        "z": "1f04fadd7ecc56e6",
        "name": "Dark Vibrant Color",
        "entityConfig": "3e58f341fe905599",
        "version": 0,
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 1380,
        "y": 110,
        "wires": [
            []
        ]
    },
    {
        "id": "6efb0dc3953b3240",
        "type": "ha-sensor",
        "z": "1f04fadd7ecc56e6",
        "name": "Light Vibrant Color",
        "entityConfig": "70d8791a24738ee6",
        "version": 0,
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 1380,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "5806b87267d02bc3",
        "type": "ha-sensor",
        "z": "1f04fadd7ecc56e6",
        "name": "Muted Color",
        "entityConfig": "be0a1e0059e1713e",
        "version": 0,
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 1360,
        "y": 210,
        "wires": [
            []
        ]
    },
    {
        "id": "77b1979bc5ad11f3",
        "type": "ha-sensor",
        "z": "1f04fadd7ecc56e6",
        "name": "Dark Muted Color",
        "entityConfig": "90991e9dde96cec6",
        "version": 0,
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 1380,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "e5b91489990a01ea",
        "type": "ha-sensor",
        "z": "1f04fadd7ecc56e6",
        "name": "Light Muted Color",
        "entityConfig": "13f67da67efbf0ae",
        "version": 0,
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 1380,
        "y": 310,
        "wires": [
            []
        ]
    },
    {
        "id": "b7acd042.10f4c",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": "at: ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "h23",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": true
    },
    {
        "id": "dfb12e11b7a6e846",
        "type": "ha-entity-config",
        "server": "b7acd042.10f4c",
        "deviceConfig": "",
        "name": "Vibrant Color",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "Vibrant Color"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "entity_picture",
                "value": ""
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": false,
        "debugEnabled": false
    },
    {
        "id": "3e58f341fe905599",
        "type": "ha-entity-config",
        "server": "b7acd042.10f4c",
        "deviceConfig": "",
        "name": "Dark Vibrant Color",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "Dark Vibrant Color"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "entity_picture",
                "value": ""
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": false,
        "debugEnabled": false
    },
    {
        "id": "70d8791a24738ee6",
        "type": "ha-entity-config",
        "server": "b7acd042.10f4c",
        "deviceConfig": "",
        "name": "Light Vibrant Color",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "Light Vibrant Color"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "entity_picture",
                "value": ""
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": false,
        "debugEnabled": false
    },
    {
        "id": "be0a1e0059e1713e",
        "type": "ha-entity-config",
        "server": "b7acd042.10f4c",
        "deviceConfig": "",
        "name": "Muted Color",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "Muted Color"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "entity_picture",
                "value": ""
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": false,
        "debugEnabled": false
    },
    {
        "id": "90991e9dde96cec6",
        "type": "ha-entity-config",
        "server": "b7acd042.10f4c",
        "deviceConfig": "",
        "name": "Dark Muted Color",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "Dark Muted Color"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "entity_picture",
                "value": ""
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": false,
        "debugEnabled": false
    },
    {
        "id": "13f67da67efbf0ae",
        "type": "ha-entity-config",
        "server": "b7acd042.10f4c",
        "deviceConfig": "",
        "name": "Light Muted Color",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "Light Muted Color"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "entity_picture",
                "value": ""
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": false,
        "debugEnabled": false
    }
]

Wow thanks… would you mind adding the script.mediapopup_main :wink:
Thanks

EDIT: Or maybe that’s a pre defined service?

EDIT 2: And also the spotify_popup.yaml is needed (line 77 of media popup)

  mediapopup_main:
    alias: "Media Popup"
    sequence:
      - if:
          - condition: state
            entity_id: media_player.spotify_homeassistant
            state: "idle"
        then:
          - service: media_player.select_source
            data:
              entity_id: media_player.spotify_homeassistant
              source: Grandmaster's Echo Dot

For spotify_popup you can use my media card from my other post.

WoW, please share the hole config sir :wink:

Thanks, and sorry to bug you again but I guess I also need the “script.spotistart_sauna”
I’m guessing the other two for tv and Konyha are the same as the Sauna one.
Ah ha, and also your image: local/overlay.svg (unless it’s the same as in Mattia’s)

For that matter, I wouldn’t mind stealing your background image on the main dashboard. If I’m not mistaken it moves. Looks real nice.

Overlay is the origilnal svg of Matthias.

spotistart_sauna:
  alias: "Start Spotify @ Sauna"
  sequence:
    - service: media_player.select_source
      data:
        entity_id: media_player.spotify_homeassistant
        source: "Sauna's Speaker"
    - service: spotcast.start
      data:
        random_song: true
        shuffle: true
        start_volume: 52
        device_name: "Sauna's Speaker"
        uri: "spotify:playlist:37i9dQZF1DX9uKNf5jGX6m?si=8507244083904e06"

I use .svg background. Just save the code in yourbackground.svg and change the background.png to it in the theme.yaml. It’s constantly changing, you never see the same background. You can set the colours or add more, you can change tthe durations.

Here is a few sample:

<svg width="2000" height="1200" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <linearGradient id="gradient" x1="0%" y1="0%" x2="0%" y2="100%">
      <!-- Defining stops for the gradient -->
      <stop offset="0%" stop-color="#2a3829" />
      <stop offset="40%" stop-color="#1f1d19" />
      <stop offset="60%" stop-color="#191c17" />
      <stop offset="100%" stop-color="#19171c" />
      <!-- Animate the gradient direction -->
      <animate attributeName="x1" values="0%;100%;0%" dur="80s" repeatCount="indefinite" />
      <animate attributeName="x2" values="100%;0%;100%" dur="70s" repeatCount="indefinite" />
      <animate attributeName="y1" values="0%;100%;0%" dur="120s" repeatCount="indefinite" />
      <animate attributeName="y2" values="100%;0%;100%" dur="90s" repeatCount="indefinite" />
    </linearGradient>
  </defs>
  <rect width="100%" height="100%" fill="url(#gradient)" />
</svg>

GM7_background3

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin:auto;background:#192314;display:block;z-index:1;position:relative" width="2000" height="1200" preserveAspectRatio="xMidYMid" viewBox="0 0 1200 600">
<g transform=""><linearGradient id="lg-0.06622949145019907" x1="0" x2="1" y1="0" y2="0">
  <stop stop-color="#000000" offset="0"></stop>
  <stop stop-color="#3d5632" offset="1"></stop> 
</linearGradient><path d="M 0 0 M 0 478.865 Q 128 481.128 256 475.112 T 512 472.145 T 768 412.07 T 1024 353.096 T 1280 395.281 L 1280 227.949 Q 1152 207.365 1024 203.222 T 768 194.744 T 512 192.056 T 256 187.689 T 0 129.141 Z" fill="url(#lg-0.06622949145019907)" opacity="0.1">
  <animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcmod="spline" keySplines="0.2 0 0.2 1;0.2 0 0.2 1;0.2 0 0.2 1" begin="0s" values="M0 0M 0 481.102200835888Q 128 482.13234929000265 256 474.77112501822967T 512 472.0944480099066T 768 401.51604437333106T 1024 333.3795957455428T 1280 386.08754170062605L 1280 205.26271355786332Q 1152 192.2261386458235 1024 190.01053129523368T 768 178.3222304634388T 512 187.78727591913707T 256 203.8182262743053T 0 139.33673670029265Z;M0 0M 0 467.0059438656607Q 128 482.8189279894348 256 475.08542915966996T 512 423.70286513388214T 768 392.7697953675268T 1024 371.13427734011543T 1280 328.9726997016895L 1280 213.0034716773044Q 1152 267.50996190618304 1024 258.5025845911917T 768 261.4255569298248T 512 235.83959209062903T 256 212.73228555559217T 0 138.22241233350678Z;M0 0M 0 472.68572839758343Q 128 478.3544815682155 256 476.05532909564016T 512 472.2837414172623T 768 441.2180061314122T 1024 407.5540009707629T 1280 420.67220928871745L 1280 290.60770442450917Q 1152 249.1776020739966 1024 239.71187163187972T 768 240.10167634694062T 512 203.84737434245108T 256 143.1401094419824T 0 100.97897014007748Z;M0 0M 0 481.102200835888Q 128 482.13234929000265 256 474.77112501822967T 512 472.0944480099066T 768 401.51604437333106T 1024 333.3795957455428T 1280 386.08754170062605L 1280 205.26271355786332Q 1152 192.2261386458235 1024 190.01053129523368T 768 178.3222304634388T 512 187.78727591913707T 256 203.8182262743053T 0 139.33673670029265Z"></animate>
</path><path d="M 0 0 M 0 501.404 Q 128 434.429 256 432.021 T 512 417.972 T 768 409.537 T 1024 356.875 T 1280 364.181 L 1280 259.246 Q 1152 262.181 1024 252.971 T 768 163.874 T 512 218.258 T 256 185.239 T 0 145.534 Z" fill="url(#lg-0.06622949145019907)" opacity="0.4">
  <animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcmod="spline" keySplines="0.2 0 0.2 1;0.2 0 0.2 1;0.2 0 0.2 1" begin="-2.5s" values="M0 0M 0 525.4314864673963Q 128 408.05214348334334 256 404.5301720563637T 512 388.00448527137326T 768 437.4273884318718T 1024 354.9483810768206T 1280 377.28640893911745L 1280 285.95083734924776Q 1152 295.2673114508907 1024 286.43331183053914T 768 153.88693124383008T 512 221.6357394170857T 256 219.84208317106004T 0 149.19650664310353Z;M0 0M 0 475.8825702129207Q 128 462.44526998929246 256 461.2208463668984T 512 449.80197434525286T 768 379.91367719548487T 1024 358.921154967457T 1280 350.2616537065325L 1280 230.8827560036217Q 1152 227.03856948493078 1024 217.42994661486958T 768 174.48197945306777T 512 214.6713353345002T 256 148.4859412378812T 0 141.6442961568369Z;M0 0M 0 522.2079932884865Q 128 463.2046301909477 256 462.2405570159417T 512 432.38607534359755T 768 365.9661258662021T 1024 397.8945587768751T 1280 410.97771073254034L 1280 241.5023856918122Q 1152 197.48557547803097 1024 188.70200166544925T 768 199.81391395001543T 512 189.0195036515799T 256 191.82461970460957T 0 104.4366761971371Z;M0 0M 0 525.4314864673963Q 128 408.05214348334334 256 404.5301720563637T 512 388.00448527137326T 768 437.4273884318718T 1024 354.9483810768206T 1280 377.28640893911745L 1280 285.95083734924776Q 1152 295.2673114508907 1024 286.43331183053914T 768 153.88693124383008T 512 221.6357394170857T 256 219.84208317106004T 0 149.19650664310353Z"></animate>
</path><path d="M 0 0 M 0 495.835 Q 128 470.802 256 464.588 T 512 457.358 T 768 389.304 T 1024 412.238 T 1280 330.016 L 1280 201.709 Q 1152 277.777 1024 273.488 T 768 246.876 T 512 184.901 T 256 165.849 T 0 187.254 Z" fill="url(#lg-0.06622949145019907)" opacity="0.4">
  <animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcmod="spline" keySplines="0.2 0 0.2 1;0.2 0 0.2 1;0.2 0 0.2 1" begin="-5s" values="M0 0M 0 423.0016610361811Q 128 497.18452553402244 256 495.046681086204T 512 409.8292465043182T 768 354.198502380812T 1024 332.63560175466597T 1280 329.7483151790175L 1280 298.4080671834795Q 1152 285.9066118306576 1024 279.3020730991134T 768 222.39701985648594T 512 228.59714294666418T 256 219.29820006692967T 0 146.33692508160658Z;M0 0M 0 495.0369839929971Q 128 470.67310616197085 256 463.6272097189134T 512 477.8649427658089T 768 390.37250566327606T 1024 426.5599578715388T 1280 329.2345045642405L 1280 201.94294983621438Q 1152 289.3833532526224 1024 286.8438839217043T 768 258.6998481867193T 512 170.39375791555085T 256 162.89327222120502T 0 188.4324450755991Z;M0 0M 0 498.43239898022716Q 128 471.2237160405163 256 467.7172473026421T 512 390.59430251188775T 768 385.8256525022898T 1024 365.60884057018285T 1280 332.5602111554086L 1280 200.9478380339938Q 1152 239.99125903247594 1024 230.00357997161439T 768 208.38061963038683T 512 232.13230914498303T 256 175.4736993975623T 0 183.41800955999634Z;M0 0M 0 423.0016610361811Q 128 497.18452553402244 256 495.046681086204T 512 409.8292465043182T 768 354.198502380812T 1024 332.63560175466597T 1280 329.7483151790175L 1280 298.4080671834795Q 1152 285.9066118306576 1024 279.3020730991134T 768 222.39701985648594T 512 228.59714294666418T 256 219.29820006692967T 0 146.33692508160658Z"></animate>
</path><path d="M 0 0 M 0 430.641 Q 128 434.277 256 426.333 T 512 443.152 T 768 433.689 T 1024 391.126 T 1280 356.922 L 1280 289.731 Q 1152 261.451 1024 256.539 T 768 172.401 T 512 153.423 T 256 152.502 T 0 147.789 Z" fill="url(#lg-0.06622949145019907)" opacity="0.4">
  <animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcmod="spline" keySplines="0.2 0 0.2 1;0.2 0 0.2 1;0.2 0 0.2 1" begin="-7.5s" values="M0 0M 0 475.4251262918319Q 128 471.10748116777194 256 461.74116892112926T 512 411.65999259709963T 768 457.9541091340221T 1024 352.06601813454705T 1280 317.3554023871965L 1280 296.96373596514906Q 1152 185.95846441113358 1024 176.11634493392467T 768 263.0472948493037T 512 163.43837198468105T 256 109.30014184438795T 0 174.84021063316368Z;M0 0M 0 527.56667736228Q 128 489.91350966726293 256 482.68663892829284T 512 439.4946670945364T 768 376.88922678546413T 1024 354.4070850206998T 1280 404.91497158871874L 1280 199.42568704021454Q 1152 236.0106021374217 1024 232.96948038054416T 768 256.0762775510558T 512 214.73547650298445T 256 206.5239193840938T 0 96.07881400629819Z;M0 0M 0 429.01255129861414Q 128 433.34261602162394 256 425.3869752876835T 512 443.21313336840774T 768 434.6428538960158T 1024 391.74285424323193T 1280 356.1160643913454L 1280 291.2480875725315Q 1152 261.87831159132776 1024 256.93445394349806T 768 170.99541152891726T 512 152.39330170285393T 256 151.5946037172196T 0 148.6574431263556Z;M0 0M 0 475.4251262918319Q 128 471.10748116777194 256 461.74116892112926T 512 411.65999259709963T 768 457.9541091340221T 1024 352.06601813454705T 1280 317.3554023871965L 1280 296.96373596514906Q 1152 185.95846441113358 1024 176.11634493392467T 768 263.0472948493037T 512 163.43837198468105T 256 109.30014184438795T 0 174.84021063316368Z"></animate>
</path></g>
</svg>

GM7_background2

7 Likes

Okay I feel bad but could I also get this last one: script.spotistart_main :sweat_smile:

  spotistart_main:
    alias: "Start Spotify"
    sequence:
      - if:
          - condition: state
            entity_id: media_player.spotify_homeassistant
            state: "idle"
        then:
          - service: media_player.select_source
            data:
              entity_id: media_player.spotify_homeassistant
              source: Grandmaster's Echo Dot
      - service: media_player.media_play_pause
        data:
          entity_id: media_player.spotify_homeassistant
1 Like

Question. I know the answer is already given… but can’t find, searching for hours…

How can I fix the “loader-SVG-Wheel”? I started with the updated files from GitHub.

I just found your post about your ambilight svg icon - a beautiful animated icon. But I am completely lost in how to implement your code -?! :face_with_spiral_eyes:

Did you place the code as “custom_fields” in your custom:button-card or did you put it in the “icons.yaml” or is it a separate yaml file in the “button_card_templates” folder?

Could you pls be so kind and post your code for your button card? Thank you in advance. :blush:

Do you have the file “loader.svg” in your “www folder”?

1 Like

awesome!!! (Forgotten… How stupid!)

Thanx!!

In fact, it doesn’t matter whether it’s icons.yaml or the button card template folder;
just follow the format of icons.yaml. It should be something like this.

icon_test1:
  styles:
    custom_fields:
      icon:
        - width: 125%
        - margin-top: -15%
        - margin-left: -15%
        - fill: >
            [[[
              return variables.state_on
                  ? '#616161'
                  : '#9da0a2';
            ]]]

  custom_fields:
    icon: >
        [[[
          const boolean = states['light.workroom'].state;
          const style = `
          <style>
            .fade-in1 {
            animation: fadeIn1 ease 3s;
            animation-fill-mode: forwards;
            }
            @keyframes fadeIn1 {
            0% {opacity:0;}
            97% {opacity:1;}
            98% {opacity:0.9;}
            99% {opacity:0.8;}
            100% {opacity:0.7;}
            }
1 Like

Thanxs for your hint and help. :+1:t3:
With a little trail and error - I got it working now. :smiley:

Can anyone help to explain why my card mod styling is not applying for one particular card type within a popup, when using this theme? I am launching a popup window with browser mod, however it seems the tablet theme is preventing certain aspects of my card mod styling from applying to my thermostat cards, within this one popup. Other popups are having their card mod style applied correctly when using this theme. Also, within this popup, my horizontal stack of 3 mushroom template cards are being styled via card mod correctly, so it’s just my thermostat cards that are failing to pick up the card mod styling.

I thought it might be a syntax issue with card mod, given I am using it within a popup, however when I revert back to the HA default theme, my styling works correctly, so this tablet theme is blocking the styling from applying to these specific cards within my popup.

Example using default HA theme:

Example using the tablet theme from this thread:

Here is the code of one of my 6 thermostat cards within this popup - all are setup and styled the same, and only the entity is different in each one.

- type: thermostat
  view_layout:
    grid-area: lounge
  entity: climate.wiser_lounge
  name: Lounge
  features:
    - type: climate-preset-modes
      style: dropdown
      preset_modes:
        - Advance Schedule
        - Cancel Overrides
        - Boost 30m
        - Boost 1h
        - Boost 2h
        - Boost 3h
  show_current_as_primary: true
  card_mod:
    style: |
      {%- if state_attr(config.entity, 'is_heating') -%}
        ha-card {
          --state-climate-auto-color: var(--state-climate-heat-color) !important;
        }
      {%- elif state_attr(config.entity, 'is_boosted') -%}
        ha-card {
          --state-climate-auto-color: red;
        }
      {%- elif state_attr(config.entity, 'percentage_demand') | float(0) > 0 -%}
        ha-card {
          --state-climate-auto-color: var(--state-climate-heat-cool-color) !important;
        } 
      {%- endif -%}

      ha-card {
        transform: scale(0.8,0.8) !important;
      }

      .more-info {
        width: 0;
      }

      ha-state-control-climate-temperature:
        $:
          .: |
            {% if state_attr(config.entity, 'is_heating') %}
              .label { color: var(--state-climate-heat-color) !important; }
            {% elif state_attr(config.entity, 'is_boosted') %}
              .label { color: red !important; }
                    {% endif %}

and the whole popup code:

Full Popup code
action: fire-dom-event
browser_mod:
  service: browser_mod.popup
  data:
    title: Heating
    #timeout: 60000
    size: fullscreen
    content:
      type: custom:layout-card
      layout_type: custom:grid-layout
      layout:
        margin: 0
        grid-template-columns: auto
        grid-template-rows: 10% 45% 45%
        grid-template-areas: |
          "controls   controls  controls"
          "lounge   kitchen   hall"
          "spare    office    main"
        mediaquery:
          #phone
          "(max-width: 800px)":
            grid-template-columns: 1fr 1fr
            grid-template-rows: auto
            grid-template-areas: |
              "controls controls"
              "lounge kitchen"
              "hall   spare"
              "office main"
      cards:
        - type: horizontal-stack
          view_layout:
            grid-area: controls
          cards:
            - type: custom:mushroom-template-card
              entity: sensor.wiser_boiler
              primary: Boiler Status
              secondary: |-
                {% if states(config.entity) == 'On' %}
                On
                {% else %}
                Off
                {% endif %}
              icon: mdi:fire
              layout: vertical
              badge_icon: ""
              icon_color: |-
                {% if states(config.entity) == 'On' %}
                red
                {% else %}
                grey
                {% endif %}
              tap_action:
                action: none
              card_mod:
                style: |
                  ha-card {
                    width: 30%;
                    margin: auto;
                  }
                  @media screen and (max-width: 800px) {
                    ha-card {
                      width: 100%;
                      margin: 20px auto;
                    }
                  }

            - type: custom:mushroom-template-card
              entity: button.wiser_boost_all_heating
              primary: ""
              secondary: Boost ALL Rooms
              multiline_secondary: true
              icon: mdi:heat-wave
              layout: vertical
              tap_action:
                action: toggle
              card_mod:
                style: |
                  ha-card {
                    --card-secondary-font-size:font-size: 1.8em;
                    --secondary-text-color: var(--primary-text-color);
                    width: 30%;
                    margin: auto;
                    background: none;
                    box-shadow: inset 1px 1px 1px 0px rgba(255,255,255,0.2), 4px 4px 5px 1px rgba(0,0,0,0.3);
                  }
                  @media screen and (max-width: 800px) {
                    ha-card {
                      width: 100%;
                      margin: 20px auto;
                    }
                  }

            - type: custom:mushroom-template-card
              entity: button.wiser_cancel_all_heating_overrides
              primary: ""
              secondary: Cancel All Overrides
              multiline_secondary: true
              icon: mdi:cancel
              layout: vertical
              tap_action:
                action: toggle
              icon_color: ""
              card_mod:
                style: |
                  ha-card {
                    --card-secondary-font-size: font-size: 1.8em;
                    --secondary-text-color: var(--primary-text-color);
                    width: 30%;
                    margin: auto;
                    background: none;
                    box-shadow: inset 1px 1px 1px 0px rgba(255,255,255,0.2), 4px 4px 5px 1px rgba(0,0,0,0.3);
                  }
                  @media screen and (max-width: 800px) {
                    ha-card {
                      width: 100%;
                      margin: 20px auto;
                    }
                  }
                  mushroom-state-info$ .multiline_secondary .secondary {
                    color: orange !important;
                  }

        ### LOUNGE ###
        - type: thermostat
          view_layout:
            grid-area: lounge
          entity: climate.wiser_lounge
          name: Lounge
          features:
            - type: climate-preset-modes
              style: dropdown
              preset_modes:
                - Advance Schedule
                - Cancel Overrides
                - Boost 30m
                - Boost 1h
                - Boost 2h
                - Boost 3h
          show_current_as_primary: true
          card_mod:
            style: |
              {%- if state_attr(config.entity, 'is_heating') -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-color) !important;
                }
              {%- elif state_attr(config.entity, 'is_boosted') -%}
                ha-card {
                  --state-climate-auto-color: red;
                }
              {%- elif state_attr(config.entity, 'percentage_demand') | float(0) > 0 -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-cool-color) !important;
                } 
              {%- endif -%}

              ha-card {
                transform: scale(0.8,0.8) !important;
              }

              .more-info {
                width: 0;
              }

              ha-state-control-climate-temperature:
                $:
                  .: |
                    {% if state_attr(config.entity, 'is_heating') %}
                      .label { color: var(--state-climate-heat-color) !important; }
                    {% elif state_attr(config.entity, 'is_boosted') %}
                      .label { color: red !important; }
                    {% endif %}

        ### KITCHEN ###
        - type: thermostat
          view_layout:
            grid-area: kitchen
          entity: climate.wiser_kitchen
          name: Kitchen
          features:
            - type: climate-preset-modes
              style: dropdown
              preset_modes:
                - Advance Schedule
                - Cancel Overrides
                - Boost 30m
                - Boost 1h
                - Boost 2h
                - Boost 3h
          show_current_as_primary: true
          card_mod:
            style: |
              {%- if state_attr(config.entity, 'is_heating') -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-color) !important;
                }
              {%- elif state_attr(config.entity, 'is_boosted') -%}
                ha-card {
                  --state-climate-auto-color: red;
                }
              {%- elif state_attr(config.entity, 'percentage_demand') | float(0) > 0 -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-cool-color) !important;
                } 
              {%- endif -%}

              ha-card {
                transform: scale(0.8,0.8) !important;
              }

              .more-info {
                width: 0;
              }

              ha-state-control-climate-temperature:
                $:
                  .: |
                    {% if state_attr(config.entity, 'is_heating') %}
                      .label { color: var(--state-climate-heat-color) !important; }
                    {% elif state_attr(config.entity, 'is_boosted') %}
                      .label { color: red !important; }
                    {% endif %}

        ### HALL ###
        - type: thermostat
          view_layout:
            grid-area: hall
          entity: climate.wiser_hallway
          name: Hall
          features:
            - type: climate-preset-modes
              style: dropdown
              preset_modes:
                - Advance Schedule
                - Cancel Overrides
                - Boost 30m
                - Boost 1h
                - Boost 2h
                - Boost 3h
          show_current_as_primary: true
          card_mod:
            style: |
              {%- if state_attr(config.entity, 'is_heating') -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-color) !important;
                }
              {%- elif state_attr(config.entity, 'is_boosted') -%}
                ha-card {
                  --state-climate-auto-color: red;
                }
              {%- elif state_attr(config.entity, 'percentage_demand') | float(0) > 0 -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-cool-color) !important;
                } 
              {%- endif -%}

              ha-card {
                transform: scale(0.8,0.8) !important;
              }

              .more-info {
                width: 0;
              }

              ha-state-control-climate-temperature:
                $:
                  .: |
                    {% if state_attr(config.entity, 'is_heating') %}
                      .label { color: var(--state-climate-heat-color) !important; }
                    {% elif state_attr(config.entity, 'is_boosted') %}
                      .label { color: red !important; }
                    {% endif %}

        ### SPARE BEDROOM ###
        - type: thermostat
          view_layout:
            grid-area: spare
          entity: climate.wiser_spare_bedroom
          name: Spare Bed
          features:
            - type: climate-preset-modes
              style: dropdown
              preset_modes:
                - Advance Schedule
                - Cancel Overrides
                - Boost 30m
                - Boost 1h
                - Boost 2h
                - Boost 3h
          show_current_as_primary: true
          card_mod:
            style: |
              {%- if state_attr(config.entity, 'is_heating') -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-color) !important;
                }
              {%- elif state_attr(config.entity, 'is_boosted') -%}
                ha-card {
                  --state-climate-auto-color: red;
                }
              {%- elif state_attr(config.entity, 'percentage_demand') | float(0) > 0 -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-cool-color) !important;
                } 
              {%- endif -%}

              ha-card {
                transform: scale(0.8,0.8) !important;
              }

              .more-info {
                width: 0;
              }

              ha-state-control-climate-temperature:
                $:
                  .: |
                    {% if state_attr(config.entity, 'is_heating') %}
                      .label { color: var(--state-climate-heat-color) !important; }
                    {% elif state_attr(config.entity, 'is_boosted') %}
                      .label { color: red !important; }
                    {% endif %}

        ### OFFICE ###
        - type: thermostat
          view_layout:
            grid-area: office
          entity: climate.wiser_office
          name: Office
          features:
            - type: climate-preset-modes
              style: dropdown
              preset_modes:
                - Advance Schedule
                - Cancel Overrides
                - Boost 30m
                - Boost 1h
                - Boost 2h
                - Boost 3h
          show_current_as_primary: true
          card_mod:
            style: |
              {%- if state_attr(config.entity, 'is_heating') -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-color) !important;
                }
              {%- elif state_attr(config.entity, 'is_boosted') -%}
                ha-card {
                  --state-climate-auto-color: red;
                }
              {%- elif state_attr(config.entity, 'percentage_demand') | float(0) > 0 -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-cool-color) !important;
                } 
              {%- endif -%}

              ha-card {
                transform: scale(0.8,0.8) !important;
              }

              .more-info {
                width: 0;
              }

              ha-state-control-climate-temperature:
                $:
                  .: |
                    {% if state_attr(config.entity, 'is_heating') %}
                      .label { color: var(--state-climate-heat-color) !important; }
                    {% elif state_attr(config.entity, 'is_boosted') %}
                      .label { color: red !important; }
                    {% endif %}

        ### MAIN BEDROOM ###
        - type: thermostat
          view_layout:
            grid-area: main
          entity: climate.wiser_main_bedroom
          name: Main Bed
          features:
            - type: climate-preset-modes
              style: dropdown
              preset_modes:
                - Advance Schedule
                - Cancel Overrides
                - Boost 30m
                - Boost 1h
                - Boost 2h
                - Boost 3h
          show_current_as_primary: true
          card_mod:
            style: |
              {%- if state_attr(config.entity, 'is_heating') -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-color) !important;
                }
              {%- elif state_attr(config.entity, 'is_boosted') -%}
                ha-card {
                  --state-climate-auto-color: red;
                }
              {%- elif state_attr(config.entity, 'percentage_demand') | float(0) > 0 -%}
                ha-card {
                  --state-climate-auto-color: var(--state-climate-heat-cool-color) !important;
                } 
              {%- endif -%}

              ha-card {
                transform: scale(0.8,0.8) !important;
              }

              .more-info {
                width: 0;
              }

              ha-state-control-climate-temperature:
                $:
                  .: |
                    {% if state_attr(config.entity, 'is_heating') %}
                      .label { color: var(--state-climate-heat-color) !important; }
                    {% elif state_attr(config.entity, 'is_boosted') %}
                      .label { color: red !important; }
                    {% endif %}

Thanks for any help.

You can edit these parameters in the tablet theme, or remove them and it will be default in HA

Ah I see, so for example, just commenting out the climate specific vars from my theme file, it will default back in HA and then my card mod colour styles will apply?

image