thomasloven/lovelace-state-switch

The card still takes some space when none of the conditions match

Opened this issue · 2 comments

Screenshot 2022-10-24 at 12 57 52

I added this card to conditionally show some information to some users above the graph card in this dashboard. However, when the conditions don't match, and since I don't have a default card, the card should be completely invisible. However, it still takes 4px in vertical space. Ideally when no condition matches the <div id="root"> should not have a 4px padding, yielding the card invisible.

I've seens some issues reporting similar stuff but they didn't seem to report the exact same thing. Apologies if this is a dupe.

Would be nice to see your yaml...

Anyways, if I remove the default state, I can't see any extra space.

My card is just this:

type: custom:state-switch
entity: user
states:
  Admin:
    type: custom:mushroom-title-card
    title: ''
    alignment: center
    subtitle: '[  H O U S E  ]'

I also ran into this, I think @cibernox does the same thing as me and renders a conditional card inside the state-switch card, where the condition doesn't match. For example:

type: custom:state-switch
entity: user
states:
  Joshi:
    type: conditional
    conditions:
      - entity: sun.sun
        state: above_horizon
    card:
      type: entities
      entities:
        - entity: light.wohnzimmer
    show_header_toggle: false

when the condition doesn't match the 8px gap is left from the 2x 4px padding making everything looking odd
grafik