Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial attempt at creating the room card #125

Merged
merged 5 commits into from
Feb 3, 2022

Conversation

bavo
Copy link
Collaborator

@bavo bavo commented Dec 21, 2021

See the image at: https://community-assets.home-assistant.io/original/4X/2/5/4/25455a9fe8e4a73931f632c1e1e85ee2c525d101.png

Still some work to do:

  • add icons to the side to visualize the state of the room
  • allow temperature visualization when there is climate entity in the room, but only a temperature sensor
  • custom colors for the side bar
  • temperature attribute user configurable
  • custom tap actions for the side bar
  • dynamically show icons in the side bar (eg only show media icon when media is playing + push other icons up when there is empty space above)

All credits go to AndyVR and @sildehoop

@bavo
Copy link
Collaborator Author

bavo commented Dec 21, 2021

@CM000n Can you add the WIP label to this pull request?
Apparently I'm not allowed to do so.

@CM000n CM000n changed the base branch from main to dev December 21, 2021 17:54
@CM000n
Copy link
Collaborator

CM000n commented Dec 21, 2021

Of course, no problem 🙂

@AndyVRD
Copy link
Contributor

AndyVRD commented Dec 21, 2021

Thanks for creating the PR Bavo! The only thing i can't figuring out is making the background of the buttons on the right being addaptive. I mean it have different shapes depening on the screensize + how much grid rows (1, 2 and 3...). I hope someone can take a look at the code and fix this. :)

@sildehoop
Copy link
Collaborator

sildehoop commented Dec 21, 2021

I thought i had already done that for the icons.
Schermafbeelding 2021-12-21 om 19 38 49

@edoardop13
Copy link
Contributor

Wow! This is awesome!😍

@sildehoop
Copy link
Collaborator

sildehoop commented Dec 21, 2021

My code now (icons do not respond to states)

room_test:
  tap_action:
    action: more-info
  color: var(--google-grey-500)
  show_icon: true
  show_name: true
  show_label: true
  size: 45%
  aspect_ratio: 1/1
  label: |-
    [[[
        var temperature = entity.attributes.room_temperature;
        if (temperature == null || isNaN(temperature)) {
          var temperature = entity.attributes.temperature;
          if (temperature == null || isNaN(temperature)) {
          var temperature = entity.state;
            if (temperature == null || isNaN(temperature)) {
            var temperature = '-';
            }
          }
        }
        return temperature + '°C'
    ]]]
  state:
    - styles:
        custom_fields:
          notification:
            - border-radius: 50%
            - border: 2px solid var(--card-background-color)
            - width: 24.5px
            - height: 24.5px
            - position: absolute
            - left: 50%
            - top: 50%
            - transform: translate(-50%,-50%)
            - margin-top: 35%
            - margin-left: -35%
            - line-height: 0
            - display: grid
            - background-color: >
                [[[
                  return "rgba(var(--color-red),1)";
                ]]]
      value: unavailable

  styles:
    card:
      - border-radius: 20px
      - box-shadow: var(--box-shadow)
      - padding: 5px
    grid:
      - grid-template-areas: '"n n n i1" "l l l i2" "i i . i3" "i i . i4"'
      - grid-template-columns: 1fr 1fr 1fr 1fr
      - grid-template-rows: 1fr 1fr 1fr 1fr
      - justify-items: center
    icon:
      - color: "rgba(var(--color-theme),0.2)"
    img_cell:
      - background-color: "rgba(var(--color-theme),0.05)"
      - border-radius: 50%
      - width: 75%
      - height: 75%
      - max-width: none
      - max-height: none
      - position: absolute
      - left: 50%
      - top: 50%
      - transform: translate(-50%,-50%)
      - margin-top: 25%
      - margin-left: -25%
    name:
      - justify-self: start
      - align-self: start
      - font-weight: bold
      - font-size: 14px
      - margin-left: 6px
      - margin-top: 3px
    label:
      - justify-self: start
      - font-weight: bold
      - font-size: 12px
      - filter: opacity(40%)
      - margin-left: 6px
      - margin-top: -50%
    state:
      - justify-self: start
      - font-weight: bold
      - font-size: 12px
      - filter: opacity(40%)
      - margin-left: 6px
    custom_fields:
      i1:
        - border-radius: 50%
        - width: 80%
        - height: 80%
        - line-height: 0
        - display: grid
        - background-color: >
            [[[
              return "rgba(var(--color-yellow), 0.2)";
            ]]]
      i2:
        - border-radius: 50%
        - width: 80%
        - height: 80%
        - line-height: 0
        - display: grid
        - background-color: >
            [[[
              return "rgba(var(--color-green), 0.2)";
            ]]]
      i3:
        - border-radius: 50%
        - width: 80%
        - height: 80%
        - line-height: 0
        - display: grid
        - background-color: >
            [[[
              return "rgba(var(--color-red), 0.2)";
            ]]]
      i4:
        - border-radius: 50%
        - width: 80%
        - height: 80%
        - line-height: 0
        - display: grid
        - background-color: >
            [[[
              return "rgba(var(--color-blue), 0.2)";
            ]]]
  custom_fields:
    i1: >
      [[[
        return `<ha-icon icon="mdi:lightbulb" style="width: 50%; height: 50%; color: rgba(var(--color-yellow),1);"></ha-icon>`
      ]]]
    i2: >
      [[[
        return `<ha-icon icon="mdi:power-plug" style="width: 50%; height: 50%; color: rgba(var(--color-green),1);"></ha-icon>`
      ]]]
    i3: >
      [[[
        return `<ha-icon icon="mdi:thermometer" style="width: 50%; height: 50%; color: rgba(var(--color-red),1);"></ha-icon>`
      ]]]
    i4: >
      [[[
        return `<ha-icon icon="mdi:speaker" style="width: 50%; height: 50%; color: rgba(var(--color-blue),1);"></ha-icon>`
      ]]]
    notification: >
      [[[
        if (entity.state =='unavailable'){
          return `<ha-icon icon="mdi:exclamation" style="width: 50%; height: 50%; color: var(--primary-background-color);"></ha-icon>`
        }
      ]]]

and

  - type: "custom:button-card"
    template:
      - room_test
      - blue_no_state
    entity: sensor.living_room_wall_multi_sensor_temperature
    name: Bathroom
    icon: mdi:shower

@AndyVRD
Copy link
Contributor

AndyVRD commented Dec 21, 2021

@sildehoop First of all thanks for the code you shared with me making this Room Card possible. Like i said before the hardest part i think is making the icons responsive but with the code style you using it's hard to accomplish this (for me it this...). That's why i taked out some parts to make all icons responsive and making the code as much styling the minimalist checks to be passed.

I'm sure there will be someone that are more skilled than me that can fix that issue, i think it's also one of the only issues that need to be fixed apart from some variables names etc fixes.

@sildehoop
Copy link
Collaborator

Sorry if I came off a little agressieve I hadden looked good at your code and didn't now how I did is was not good I am going to try myself an let you now if I get it working

@bavo
Copy link
Collaborator Author

bavo commented Dec 21, 2021

@sildehoop I have integrated some of your changes posted above + added the notification icon.
The icons on the right side should now scale dynamically based on your screen resolution.

I did not change the icons on the right by as you showed in your example. This allows us to add some tap_actions to the icons ;)

@bavo
Copy link
Collaborator Author

bavo commented Dec 21, 2021

Made every icon in the sidebar optional. The icon is not displayed when no entity_id is specified for the icons 1-4.

Still todo:

  • custom colors for the side bar
  • custom tap actions for the side bar
  • dynamically show icons in the side bar (eg only show media icon when media is playing + push other icons up when there is empty space above)

PS: @CM000n I think I broke the "format code" check 😕
The last run is not giving any info about what went wrong.

@basbruss
Copy link
Collaborator

@bavo The format is broken because all the icon-items have a " behind ]]] in the entity.

      entity: >
          [[[
            if (variables.entity_id_2) {
              return variables.entity_id_2;
            }
          ]]]"

@bavo
Copy link
Collaborator Author

bavo commented Dec 22, 2021

😄🤦‍♂️

@sildehoop
Copy link
Collaborator

sildehoop commented Dec 22, 2021

Made every icon in the sidebar optional. The icon is not displayed when no entity_id is specified for the icons 1-4.

Still todo:

  • custom colors for the side bar
  • custom tap actions for the side bar
  • dynamically show icons in the side bar (eg only show media icon when media is playing + push other icons up when there is empty space above)

PS: @CM000n I think I broke the "format code" check 😕 The last run is not giving any info about what went wrong.

dynamically show icons in the side bar (eg only show media icon when media is playing + push other icons up when there is empty space above)

This is very hard if you use grid so maybe we can make the icons gray when off that is easier and this way you can toggle them on and off
card_square

@bavo
Copy link
Collaborator Author

bavo commented Dec 22, 2021

Added new commit where the predefined icon is removed and instead we use the icon from the entity

@bavo
Copy link
Collaborator Author

bavo commented Dec 22, 2021

image

Does anyone have any idea's on how to give the end users control over the colors on the right side?
It would be cool if these were customizable for each entity. But I'm not sure how to do it ...

@bavo
Copy link
Collaborator Author

bavo commented Dec 22, 2021

Something else I'm hoping to get your opinion about:

Should we fix the temperature of the room card right below the name?
Because right now it is floating on somewhere between the icon and the name, and it looks somewhat off to me ....
See screenshot below:
image

@sildehoop
Copy link
Collaborator

sildehoop commented Dec 22, 2021

The temperature sits in an other grid row and moved by -50 but I don't now how to fix thad
Schermafbeelding 2021-12-22 om 12 43 36

@basbruss
Copy link
Collaborator

basbruss commented Dec 22, 2021

image

Does anyone have any idea's on how to give the end users control over the colors on the right side? It would be cool if these were customizable for each entity. But I'm not sure how to do it ...

You could extend the variables to chose a color template

i1:
  card:
    type: "custom:button-card"
    template:
       - "[[[ return variables.color_1 ]]]"
       - "widget_icon_room"

And maybe extend the color templates with additional types of states, specified to the type of device for instance:"on", "off", "idle", "paused", "playing", "heat", "cool",....

Or set certain colors templates to be used when the entity variable is a certain type of device. This can be achieved with if/else statements. This approach is less customizable, but better to use for those with less knowledge or effort to maintain his lovelace-files.

@basbruss
Copy link
Collaborator

basbruss commented Dec 22, 2021

The temperature sits in an other grid row and moved by -50 but I don't now how to fix thad Schermafbeelding 2021-12-22 om 12 43 36

Changing some parameters in de label and name grid should make them appear close to each other:

  name:
      - justify-self: "start"
      - align-self: "end"
      - font-weight: "bold"
      - font-size: "14px"
      - margin-left: "12px"
      - margin-bottom: "10%"
    label:
      - justify-self: "start"
      - align-self: "start"
      - font-weight: "bold"
      - font-size: "12px"
      - filter: "opacity(40%)"
      - margin-left: "12px"
      - margin-top: "-10%"

By changing margin-top: and margin-bottom: you have control of the height of both the name and label :)

@bavo
Copy link
Collaborator Author

bavo commented Dec 22, 2021

@basbruss

And maybe extend the color templates with additional types of states, specified to the type of device for instance:"on", "off", "idle", "paused", "playing", "heat", "cool",....

In my local setup i have some more color options:

yellow:
  styles:
    icon:
      - color: 'rgba(var(--color-yellow),1)'
    label:
      - color: 'rgba(var(--color-yellow-text),1)'
    name:
      - color: 'rgba(var(--color-yellow-text),1)'
    img_cell:
      - background-color: 'rgba(var(--color-yellow), 0.2)'
yellow_on:
  state:
    - styles:
        icon:
          - color: 'rgba(var(--color-yellow),1)'
        label:
          - color: 'rgba(var(--color-yellow-text),1)'
        name:
          - color: 'rgba(var(--color-yellow-text),1)'
        img_cell:
          - background-color: 'rgba(var(--color-yellow), 0.2)'
      value: 'on'
      id: 'on'
yellow_off:
  state:
    - styles:
        icon:
          - color: 'rgba(var(--color-yellow),1)'
        label:
          - color: 'rgba(var(--color-yellow-text),1)'
        name:
          - color: 'rgba(var(--color-yellow-text),1)'
        img_cell:
          - background-color: 'rgba(var(--color-yellow), 0.2)'
      value: 'off'
      id: 'off'

This allows me to use the yellow when I want something yellow everytime, yellow_on gives me yellow when the state is on and then ofcourse yellow_off when you want the yellow color when the state is off.
And I copied this template for most colors.
This gives me a lot of flexibility when configuring a binary sensor for TV for example: green_on and red_off. But the door window sensors are the exact opposite: green_offand red_on.
You could easily add more states you mentioned: paused, heating, ....

But this would mean another breaking change in every configuration 😒

@bavo bavo force-pushed the new-room-card branch 4 times, most recently from 543ab9b to 130b82d Compare December 22, 2021 13:39
@r0binj
Copy link
Contributor

r0binj commented Jan 26, 2022

Testing the new changes on the room card and I getting mixed results..
Without changing anyting:
2 cards:
Skärmavbild 2022-01-26 kl  21 40 00
3 cards:
Skärmavbild 2022-01-26 kl  21 54 26
4 cards:
Skärmavbild 2022-01-26 kl  21 53 11

I don't know if everyone if going to use it with more than 2 cards next to each other. But I will use it 2 cards..
So I did this change:

    name:
      - justify-self: "start"
      - align-self: "end"
      - font-weight: "bold"
      - font-size: "14px"
      - margin-left: "12px"
      - margin-bottom: "20%"
    label:
      - justify-self: "start"
      - align-self: "start"
      - font-weight: "bold"
      - font-size: "12px"
      - filter: "opacity(40%)"
      - margin-left: "12px"
      - margin-top: "-20%" 

And get this results instead and I'm more pleased with.
Skärmavbild 2022-01-26 kl  22 00 14

But this changes makes the name / label on the cards get wrong position.. But works great with 1 or 2 cards.

@r0binj
Copy link
Contributor

r0binj commented Jan 27, 2022

If you choose to set:

label_use_temperature: false 
label_use_brightness: false

Skärmavbild 2022-01-27 kl  23 06 21

The label returned empty. So I added:
if (entity.state == "on"){
            return variables.ulm_on
            } else {
              return variables.ulm_off
        }

And as I want to trigger POPUP card for more info about the room from the entity so couldn't I get the temperature shown so I changed it so you have to add entity_temp: sensor.yoursensorhere so get the temperature in the label..

from:

return (entity.attributes.current_temperature || entity.attributes.temperature || entity.state || '-') + '°C';

to:

return (states[variables.entity_temp].state || '-') + '°C';

I don't know if this is the right was to do it but I got I working..

card_room:
  template:
    - "ulm_language_variables"
  variables:
    label_use_temperature: true
    label_use_brightness: false
  color: "var(--google-grey-500)"
  show_icon: true
  show_name: true
  show_label: true
  size: "45%"
  aspect_ratio: "1/1"
  label: |-
    [[[
      if (variables.label_use_temperature) {
        return (states[variables.entity_temp].state || '-') + '°C';
      } else if (variables.label_use_brightness) {
        if (entity.state){
          if (entity.state == "off"){
            return variables.ulm_off;
          } else if (entity.state == "on"){
            if (entity.attributes.brightness != null){
              var bri = Math.round(entity.attributes.brightness / 2.55);
              return (bri ? bri : "0") + "%";
            } else {
              return variables.ulm_on
            }
          }
        } else {
          return variables.ulm_unavailable;
        }
      } if (entity.state == "on"){
            return variables.ulm_on
            } else {
              return variables.ulm_off
        }  
    ]]]
  state:
    - styles:
        custom_fields:
          notification:
            - border-radius: "50%"
            - border: "2px solid var(--card-background-color)"
            - width: "24.5px"
            - height: "24.5px"
            - position: "absolute"
            - left: "50%"
            - top: "50%"
            - transform: "translate(-50%,-50%)"
            - margin-top: "35%"
            - margin-left: "-35%"
            - line-height: 0
            - display: "grid"
            - background-color: >
                [[[
                  return "rgba(var(--color-red),1)";
                ]]]
      value: "unavailable"
  styles:
    card:
      - border-radius: "20px"
      - box-shadow: "var(--box-shadow)"
      - padding: "5px"
    grid:
      - grid-template-areas: "'n n n i1' 'l l l i2' 'i i . i3' 'i i . i4'"
      - grid-template-columns: "1fr 1fr 1fr 1fr"
      - grid-template-rows: "1fr 1fr 1fr 1fr"
      - justify-items: "center"
    icon:
      - color: "rgba(var(--color-theme),0.2)"
    img_cell:
      - background-color: "rgba(var(--color-theme),0.05)"
      - border-radius: "50%"
      - width: "75%"
      - height: "75%"
      - max-width: "none"
      - max-height: "none"
      - position: "absolute"
      - left: "50%"
      - top: "50%"
      - transform: "translate(-50%,-50%)"
      - margin-top: "25%"
      - margin-left: "-25%"
    name:
      - justify-self: "start"
      - align-self: "end"
      - font-weight: "bold"
      - font-size: "14px"
      - margin-left: "12px"
      - margin-bottom: "20%"
    label:
      - justify-self: "start"
      - align-self: "start"
      - font-weight: "bold"
      - font-size: "12px"
      - filter: "opacity(40%)"
      - margin-left: "12px"
      - margin-top: "-20%" 
    state:
      - justify-self: "start"
      - font-weight: "bold"
      - font-size: "12px"
      - filter: "opacity(40%)"
      - margin-left: "6px"
    custom_fields:
      i1:
        - border-radius: "50%"
        - width: "80%"
        - height: "80%"
        - line-height: 0
        - display: "grid"
      i2:
        - border-radius: "50%"
        - width: "80%"
        - height: "80%"
        - line-height: 0
        - display: "grid"
      i3:
        - border-radius: "50%"
        - width: "80%"
        - height: "80%"
        - line-height: 0
        - display: "grid"
      i4:
        - border-radius: "50%"
        - width: "80%"
        - height: "80%"
        - line-height: 0
        - display: "grid"
  custom_fields:
    notification: >
      [[[
        if (entity.state =='unavailable'){
          return `<ha-icon icon="mdi:exclamation" style="width: 50%; height: 50%; color: var(--primary-background-color);"></ha-icon>`
        }
      ]]]
    i1:
      card:
        type: "custom:button-card"
        template: >
          [[[
            var templates = ['widget_icon_room'];
            if (variables?.entity_1?.templates?.length) {
              return ['widget_icon_room'].concat(variables.entity_1.templates);
            }
            return templates;
          ]]]
        variables: "[[[ return variables.entity_1; ]]]"
        entity: >
          [[[
            if (variables.entity_1.entity_id) {
              return variables.entity_1.entity_id;
            }
          ]]]
        state:
          - operator: "template"
            value: "[[[ return !variables.entity_1; ]]]"
            styles:
              card:
                - display: "none"

    i2:
      card:
        type: "custom:button-card"
        template: >
          [[[
            var templates = ['widget_icon_room'];
            if (variables?.entity_2?.templates?.length) {
              return ['widget_icon_room'].concat(variables.entity_2.templates);
            }
            return templates;
          ]]]
        variables: "[[[ return variables.entity_2; ]]]"
        entity: >
          [[[
            if (variables?.entity_2?.entity_id) {
              return variables.entity_2.entity_id;
            }
          ]]]
        state:
          - operator: "template"
            value: "[[[ return !variables.entity_2; ]]]"
            styles:
              card:
                - display: "none"

    i3:
      card:
        type: "custom:button-card"
        template: >
          [[[
            var templates = ['widget_icon_room'];
            if (variables?.entity_3?.templates?.length) {
              return ['widget_icon_room'].concat(variables.entity_3.templates);
            }
            return templates;
          ]]]
        variables: "[[[ return variables.entity_3; ]]]"
        entity: >
          [[[
            if (variables?.entity_3?.entity_id) {
              return variables.entity_3.entity_id;
            }
          ]]]
        state:
          - operator: "template"
            value: "[[[ return !variables.entity_3; ]]]"
            styles:
              card:
                - display: "none"
    i4:
      card:
        type: "custom:button-card"
        template: >
          [[[
            var templates = ['widget_icon_room'];
            if (variables?.entity_4?.templates?.length) {
              return ['widget_icon_room'].concat(variables.entity_4.templates);
            }
            return templates;
          ]]]
        variables: "[[[ return variables.entity_4; ]]]"
        entity: >
          [[[
            if (variables?.entity_4?.entity_id) {
              return variables.entity_4.entity_id;
            }
          ]]]
        state:
          - operator: "template"
            value: "[[[ return !variables.entity_4; ]]]"
            styles:
              card:
                - display: "none"

widget_icon_room:
  variables:
    tap_action:
      action: toggle
    hold_action:
      action: none
  tap_action:
    action: >
      [[[ if (variables?.tap_action?.action) return variables.tap_action.action; else return 'none'; ]]]
    entity: "[[[ return variables.tap_action.entity; ]]]"
    navigation_path: "[[[ return variables.tap_action.navigation_path; ]]]"
    url_path: "[[[ return variables.tap_action.url_path; ]]]"
    service: "[[[ return variables.tap_action.service; ]]]"
    service_data: "[[[ return variables.tap_action.service_data; ]]]"
  hold_action:
    action: > 
      [[[ if (variables?.hold_action?.action) return variables.hold_action.action; else return 'none'; ]]]
    entity: "[[[ return variables.hold_action.entity; ]]]"
    navigation_path: "[[[ return variables.hold_action.navigation_path; ]]]"
    url_path: "[[[ return variables.hold_action.url_path; ]]]"
    service: "[[[ return variables.hold_action.service; ]]]"
    service_data: "[[[ return variables.hold_action.service_data; ]]]"
  show_icon: true
  show_name: false
  styles:
    grid:
      - grid-template-areas: "'i'"
    card:
      - height: "100%"
      - box-shadow: "none"
      - padding: "0px"
    icon:
      - width: "50%"
      - height: "50%"
      - line-height: "0"
      - color: "rgba(var(--color-theme),0.2)"
    img_cell:
      - border-radius: "50%"
      - background-color: "rgba(var(--color-theme),0.05)"
  size: "15px"
  color: "var(--google-grey)"

@bavo bavo force-pushed the new-room-card branch 4 times, most recently from 0c4bf47 to 040b6c7 Compare January 28, 2022 15:53
@bavo
Copy link
Collaborator Author

bavo commented Jan 28, 2022

return (states[variables.entity_temp].state || '-') + '°C';

I like this solution but it doesn't work for attributes 🤔

@sildehoop
Copy link
Collaborator

sildehoop commented Jan 28, 2022

See the image at: https://community-assets.home-assistant.io/original/4X/2/5/4/25455a9fe8e4a73931f632c1e1e85ee2c525d101.png

Still some work to do:

  • add icons to the side to visualize the state of the room

  • allow temperature visualization when there is climate entity in the room, but only a temperature sensor

  • custom colors for the side bar

  • temperature attribute user configurable

  • custom tap actions for the side bar

  • dynamically show icons in the side bar (eg only show media icon when media is playing + push other icons up when there is empty space above)

All credits go to AndyVR and @sildehoop

I don't think it is necessary to dynamically show the icons gray when off is a good solution I think.

You can add yourself to the credits to @bavo 😉 more than deserved

@bavo
Copy link
Collaborator Author

bavo commented Jan 28, 2022

I did integrate the on/off translations when neither temperature or brightness is selected and a default fallback to show the room state when its not on or off

@bavo
Copy link
Collaborator Author

bavo commented Jan 28, 2022

@CM000n I think this is ready for release 😄
There might be some smaller changes but nothing that cannot be fixed in updates

sildehoop
sildehoop previously approved these changes Jan 29, 2022
- font-size: "12px"
- filter: "opacity(40%)"
- margin-left: "6px"
- margin-top: "-30%"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary fix this does not work when the text gets larger

      - margin-top: 20px
      - position: absolute

Schermafbeelding 2021-12-22 om 12 53 15

@xPhantomNL
Copy link
Contributor

xPhantomNL commented Jan 30, 2022

If I select the dark theme, the icons on the right side show a separate background.
image

This can be fixed by adding;
- background-color: rgba(0, 0, 0, 0.0)

To the widget_icon_room card style. It will get rid of that weird background issue.
image

Edit;
After playing with some colors (yellow in my case), I figured that it still breaks with that. The better solution would be to add a 50px border radius to the widget_icon_room card style.

    card:
      - height: "100%"
      - box-shadow: "none"
      - padding: "0px"
      - border-radius: 50%

@sildehoop sildehoop merged commit 81f6d9d into UI-Lovelace-Minimalist:dev Feb 3, 2022
@antonio1475
Copy link

antonio1475 commented Mar 6, 2022

Hi @bavo I don't know how to submit proposals... I hope this is okay:
I made 3 changes to the template:

  1. Add the option for a custom icon for each widget_icon_room (eg. call a script that does different things with service_data, so no set icon for it).
  2. Add double_tap_action to widget_icon_room
  3. Add ability for haptic feedback to widget_icon_room (I hardcoded it, but should probably be made customizable). Haptic feedback for the big card is already possible in lovelace.yaml, but not for the 4 entities.

Here is the code comparison: https://www.textcompare.org/yaml/?id=62240f625053ac2c15ff2a3d
Feel free to use the idea and/or the code (I basically duplicated fragments).

ETA: I see now that widget_icon_room refers to the one room icon, but adding actions & haptic to that (points 2 & 3) affect (enable) it on the i1-i4 entities? I'm very confused but it works.

Thank you to the 3 of you I see, I love the card.
Sorry for not yet understanding how Github works to submit these things... not my world.

PS: ripple on mobile (iOS) isn't great (square borders). Shown here.

@bavo
Copy link
Collaborator Author

bavo commented Mar 7, 2022

I'll look into this 😃
Thx for the suggestions

@jaku2019
Copy link

jaku2019 commented Nov 6, 2022

Hello,
could you please explain me how can I set up those cards in a way that two of them would be displayed in one row?
I want to achieve en effeect like shown on @sildehoop photo.

I can't do it with "horizontal-stack" because those cards don't seem to work woth it - I see a white, blank bar instead of the square.
Regards,
Jakub

@antonio1475
Copy link

Hello, could you please explain me how can I set up those cards in a way that two of them would be displayed in one row? I want to achieve en effeect like shown on @sildehoop photo.

I can't do it with "horizontal-stack" because those cards don't seem to work woth it - I see a white, blank bar instead of the square. Regards, Jakub

These cards work with Horizontal-stack. Otherwise try Grid card. Does one card work for you?
Post your code otherwise. I have them all in horizontal-stacks and grids.

@jaku2019
Copy link

jaku2019 commented Nov 7, 2022

Hello, could you please explain me how can I set up those cards in a way that two of them would be displayed in one row? I want to achieve en effeect like shown on @sildehoop photo.
I can't do it with "horizontal-stack" because those cards don't seem to work woth it - I see a white, blank bar instead of the square. Regards, Jakub

These cards work with Horizontal-stack. Otherwise try Grid card. Does one card work for you? Post your code otherwise. I have them all in horizontal-stacks and grids.

Hello,
thank you for the reply!

Yes, one card does work for me, but if I want to put two in horizontal-stack, I see only small rectangles as a result:
horizontal-stack_problem

When I was copying my yaml to send it, I saw that I didn't allign content of the "room-card" properly (it was mismatched with the header).
After refining everything is shown as it should.

Thank you for the reply! If you hadn't asked me for the yaml, I wouldn't have found the bug.

Regards,
Jakub

@uzatsepin
Copy link

Hello, sorry to bother you, but please tell me how to make a beautiful 1 small card. If the card is 1, then it is very large

@antonio1475
Copy link

Hello, sorry to bother you, but please tell me how to make a beautiful 1 small card. If the card is 1, then it is very large

Put it within a Grid card and set the column number to your liking. The card will get smaller, and of course occupy the left side only.

@uzatsepin
Copy link

Hello, sorry to bother you, but please tell me how to make a beautiful 1 small card. If the card is 1, then it is very large

Put it within a Grid card and set the column number to your liking. The card will get smaller, and of course occupy the left side only.

thank you very much!)
it was simple, but i waste a time for this)))

have a nice day

@chinswain
Copy link

chinswain commented Sep 30, 2023

I've added a button to each room that summons the robot vacuum on that floor to come and clean:

image

Is there a way I can change the button to active when the vacuum is active?

vacuum.henry states are 'cleaning', 'paused' & 'docked'

    - type: "custom:button-card"
      template:
        - card_room
        - yellow_no_state
      name: Bedroom
      entity: sensor.bedroom_air_purifier_temperature
      icon: mdi:bed
      tap_action:
        action: navigate
        navigation_path: "bedroom"
      variables:
        label_use_temperature: true
        label_use_brightness: false
        entity_1:
          entity_id: light.bedroom_ceiling_light
          templates:
            - yellow_on
          tap_action:
            action: toggle
            service_data:
              entity_id: light.bedroom_ceiling_light
        entity_2:
          entity_id: vacuum.henry
          templates:
            - blue_on
          tap_action:
            action: call-service
            service: script.vacuum_room
            service_data:
              room: '18'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.