I reported also here:
opened 06:17PM - 07 Mar 24 UTC
bug
<!-- READ THIS FIRST:
- If you need additional help with this template please rā¦ efer to https://www.home-assistant.io/help/reporting_issues/
- Make sure you are running the latest version of Home Assistant before reporting an issue: https://github.com/home-assistant/home-assistant/releases
- Provide as many details as possible. Do not delete any text from this template!
-->
**Checklist:**
- [ ] I updated to the latest version available
- [ ] I cleared the cache of my browser
**Release with the issue:**
**Last working release (if known):2023.2
**Browser and Operating System:**
<!--
Provide details about what browser (and version) you are seeing the issue in. And also which operating system this is on. If possible try to replicate the issue in other browsers and include your findings here.
-->
**Description of problem:**
I try to reproduce the old masonry layout as in picture:
<img width="561" alt="Screenshot 2024-03-07 alle 19 15 21" src="https://github.com/custom-cards/stack-in-card/assets/10352902/cd878510-1e62-455a-87aa-1d10879dfb88">
<!--
Explain what the issue is, and how things should look/behave. If possible provide a screenshot with a description.
-->
but I see that card is now extended to all line and cannot be reduced as previously
<img width="552" alt="Screenshot 2024-03-07 alle 19 16 30" src="https://github.com/custom-cards/stack-in-card/assets/10352902/967295c2-a4a7-4c6d-939b-8dbd18e65066">
**Javascript errors shown in the web inspector (if applicable):**
```
```
**Additional information:**
my code if someone can help me:
`type: custom:stack-in-card
cards:
- type: custom:mushroom-template-card
primary: Serratura Ingresso
secondary: |-
{% if is_state('lock.serratura_ingresso','unlocked')%}
Aperta
{% else %}
Chiusa
{% endif%}
icon: |-
{% if is_state('lock.serratura_ingresso','unlocked') %}
mdi:lock-open
{% else %}
mdi:lock
{% endif%}
layout: horizontal
icon_color: |-
{% if is_state('lock.serratura_ingresso','locked') %}
red
{% else %}
green
{% endif%}
badge_icon: >
{% set battery_level = (states(entity) | int / 10) | round(0) | int * 10
%}
{% if battery_level == 100 %}
mdi:battery
{% elif battery_level > 0 %}
mdi:battery-{{ battery_level }}
{% else %}
mdi:battery-alert-variant-outline
{% endif %}
badge_color: |-
{% set battery_level = states(entity) | int %}
{% if battery_level > 90 %}
green
{% elif battery_level > 60 %}
light-green
{% elif battery_level > 50 %}
lime
{% elif battery_level > 40 %}
yellow
{% elif battery_level > 30 %}
amber
{% elif battery_level > 20 %}
orange
{% elif battery_level > 10 %}
deep-orange
{% else %}
red
{% endif %}
tap_action:
action: more-info
entity: sensor.serratura_ingresso_battery_level
card_mod:
style: |
ha-card {
border: none;
margin-bottom: -6px;
}
- type: custom:mushroom-lock-card
entity: lock.serratura_ingresso
name: Serratura Ingresso
primary_info: none
secondary_info: none
icon_type: none
layout: vertical
card_mod:
style: |
ha-card {
border: none;
margin-top: -6px;
}
`
Description of problem:
I try to reproduce the old masonry layout as in picture:
but I see that card is now extended to all line and cannot be reduced as previously
Additional information:
my code if someone can help me:
type: custom:stack-in-card
cards:
- type: custom:mushroom-template-card
primary: Serratura Ingresso
secondary: |-
{% if is_state('lock.serratura_ingresso','unlocked')%}
Aperta
{% else %}
Chiusa
{% endif%}
icon: |-
{% if is_state('lock.serratura_ingresso','unlocked') %}
mdi:lock-open
{% else %}
mdi:lock
{% endif%}
layout: horizontal
icon_color: |-
{% if is_state('lock.serratura_ingresso','locked') %}
red
{% else %}
green
{% endif%}
badge_icon: >
{% set battery_level = (states(entity) | int / 10) | round(0) | int * 10
%}
{% if battery_level == 100 %}
mdi:battery
{% elif battery_level > 0 %}
mdi:battery-{{ battery_level }}
{% else %}
mdi:battery-alert-variant-outline
{% endif %}
badge_color: |-
{% set battery_level = states(entity) | int %}
{% if battery_level > 90 %}
green
{% elif battery_level > 60 %}
light-green
{% elif battery_level > 50 %}
lime
{% elif battery_level > 40 %}
yellow
{% elif battery_level > 30 %}
amber
{% elif battery_level > 20 %}
orange
{% elif battery_level > 10 %}
deep-orange
{% else %}
red
{% endif %}
tap_action:
action: more-info
entity: sensor.serratura_ingresso_battery_level
card_mod:
style: |
ha-card {
border: none;
margin-bottom: -6px;
}
- type: custom:mushroom-lock-card
entity: lock.serratura_ingresso
name: Serratura Ingresso
primary_info: none
secondary_info: none
icon_type: none
layout: vertical
card_mod:
style: |
ha-card {
border: none;
margin-top: -6px;
}
first i have hard to understand your Topic header , as you use not 1 but 2 Custom-Cards, and Card-mod ā¦ Beside Why even borther to report a ābugā in the " Stack-In-Card Github repo ? , didnāt you noticed, that Nothing have change the past 4 Years ! , in that Card/Repo ā¦ Considered it āDeadā ( or still alive and well, working as intended )
Noone can hard know what you mean by that, and Grid does not āby Natureā behave same way as Masonry
A āworkaroundā or actually common way, is using native vertical or horizontal stack, or custom:card, to accomplice the same, with less restrict options
Beside, with Mushroom And Card-mod(as you use), i wonder why you even have issues, with sizing your cards
iridris
(Steven)
March 7, 2024, 7:05pm
3
It looks like there may be a new feature coming to configure the number of rows/columns a card uses.
home-assistant:dev
ā home-assistant:grid_options
opened 04:09PM - 06 Mar 24 UTC
## Proposed change
Change the API for card sizing. I also improved the grid bā¦ ehavior (max-width, alignment, etc...)
### Before
```ts
class Card {
getGridSize(): [number, number]
}
```
### After
```ts
type LovelaceLayoutOptions = {
grid_columns?: number;
grid_rows?: number;
};
class Card {
getLayoutOptions(): LovelaceLayoutOptions
}
```
Also, it will possible to override this options from the card configuration.
```yaml
type: tile
entity: sensor.temperature
layout_options:
grid_columns: 3
grid_rows: 3
```
## Type of change
<!--
What type of change does your PR introduce to the Home Assistant frontend?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (thank you!)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Example configuration
<!--
Supplying a configuration snippet, makes it easier for a maintainer to test
your PR.
-->
```yaml
```
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #
- This PR is related to issue or discussion:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [ ] The code change is tested and works locally.
- [ ] There is no commented out code in this PR.
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
<!--
Thank you for contributing <3
-->
[docs-repository]: https://github.com/home-assistant/home-assistant.io
1 Like
I am not pro in this matter but I think, to make all such mods to a card I have to use:
custom:mushroom-template-card
and when I use itā¦ card occupy all the spaceā¦
ok, yes nothing wrong with mushroom-cards, i use them my self but for cards with many templates i turned over to custom:button-card, one can use grids also, and set height/width on the card
can you please help me with the code to obtain about the same graphic result on this lock door?
Wait for the coming changes/features, in the link Steven posted above, might solve your issue ( as Paul, the author of mushroom, atleast will ad features to the Section-View, and cards, like tile, and most likely some of mushroom-cards
btw , by default mushroom cards fill the available space, so if you only place 1 in a row, it fills the row, same as if you only put 1 card in a grid-cell, or a horizontal/vertical stack
But first of all, you donāt seem to be familiar with with the 4-Year-old-no-changes-card ( with btw, alot other alternative for the same )
So IF you take time to read the GitHub page, card configurations/features/examples(the very first example), i think you would not have to open this Topic, and blame New Experimental Dashboard, beside open a ābug reportā
by default Stack-in-card is Vertical, meaning card under card under card
Horizontal means side by side by side
type: horizontal-stack
cards:
- type: custom:mushroom-template-card
primary: Serratura Ingresso
secondary: |-
{% if is_state('lock.serratura_ingresso','unlocked')%}
Aperta
{% else %}
Chiusa
{% endif%}
icon: |-
{% if is_state('lock.serratura_ingresso','unlocked') %}
mdi:lock-open
{% else %}
mdi:lock
{% endif%}
layout: horizontal
icon_color: |-
{% if is_state('lock.serratura_ingresso','locked') %}
red
{% else %}
green
{% endif%}
badge_icon: >
{% set battery_level = (states(entity) | int / 10) | round(0) | int * 10
%}
{% if battery_level == 100 %}
mdi:battery
{% elif battery_level > 0 %}
mdi:battery-{{ battery_level }}
{% else %}
mdi:battery-alert-variant-outline
{% endif %}
badge_color: |-
{% set battery_level = states(entity) | int %}
{% if battery_level > 90 %}
green
{% elif battery_level > 60 %}
light-green
{% elif battery_level > 50 %}
lime
{% elif battery_level > 40 %}
yellow
{% elif battery_level > 30 %}
amber
{% elif battery_level > 20 %}
orange
{% elif battery_level > 10 %}
deep-orange
{% else %}
red
{% endif %}
tap_action:
action: more-info
entity: sensor.serratura_ingresso_battery_level
card_mod:
style: |
ha-card {
border: none;
margin-bottom: -6px;
}
- type: custom:mushroom-template-card
primary: Serratura Ingresso
secondary: |-
{% if is_state('lock.serratura_ingresso','unlocked')%}
Aperta
{% else %}
Chiusa
{% endif%}
icon: |-
{% if is_state('lock.serratura_ingresso','unlocked') %}
mdi:lock-open
{% else %}
mdi:lock
{% endif%}
layout: horizontal
icon_color: |-
{% if is_state('lock.serratura_ingresso','locked') %}
red
{% else %}
green
{% endif%}
badge_icon: >
{% set battery_level = (states(entity) | int / 10) | round(0) | int * 10
%}
{% if battery_level == 100 %}
mdi:battery
{% elif battery_level > 0 %}
mdi:battery-{{ battery_level }}
{% else %}
mdi:battery-alert-variant-outline
{% endif %}
badge_color: |-
{% set battery_level = states(entity) | int %}
{% if battery_level > 90 %}
green
{% elif battery_level > 60 %}
light-green
{% elif battery_level > 50 %}
lime
{% elif battery_level > 40 %}
yellow
{% elif battery_level > 30 %}
amber
{% elif battery_level > 20 %}
orange
{% elif battery_level > 10 %}
deep-orange
{% else %}
red
{% endif %}
tap_action:
action: more-info
entity: sensor.serratura_ingresso_battery_level
card_mod:
style: |
ha-card {
border: none;
margin-bottom: -6px;
}
and fix your second card
primary_info: none
secondary_info: none
icon_type: none
thanks for your help but it is not what I wantā¦
the reason why I use stack in custom is that I want to have lock icon red when closed and green when open, and I want to see battery levelā¦ is ther a way to change the normal card in that way without use custo m card?
You initially post was sizing of a mushroom card in a grid-cell.
with horizontal-stack(or stack-in-card#horizontal) you get the 2 cards, beside each other.
Sorry i donāt have any lock card, and btw stack-in-card has nothing to do with this, stack/grid cards are just place holders, for the āorigā card.
whatās wrong with mushroom ?
Changing color can either be accomplished with template , card-mod or Theme settings, if the native/custom card doesnāt provide this option.
If you havenāt got much experience in ānested cardsā the only native card i can think of is Picture-elements card , IF you want additional sensors in the card.
With a little fantasy/creative mind, you can add anything to it.
and with nested cards in a grid cell(or grid in grid), you can use 2-4 Tile-cards, and make it look like 1. And they have alot of default options, such as different colors etc