I noticed LL cards can have a header toggle. When I have a switch in the card, it will turn off when I toggle it. But that sort off makes the actual switch in the card redundant. Is there any way I can hide or remove the switch in the body of the card while keeping the header toggle functional?
Alternatively, what about hiding/collapsing the contents of the card when I toggle the header switch off? If I turn my power plug off, I don’t need its values displayed anyway.
Under “Customize UI” You can edit the card to turn off the header toggle. You can also heave the header blank. Here is a card with a header but no header toggle.
Here is a card with no header or toggle. In this case, it is just a sensor.
I have two proposed solutions but you ll have to work on them a little,
One is this, that would hide the entities but not conditionally to if they are on or off
The other one is Lovelace’s Conditional card and here’s an example code (add a new custom card in Lovelace delete the code and paste this, then play around) :
cards:
- entity: input_boolean.some_boolean #some boolean that would turn on or off according to your switches
image: /local/custom-lovelace/images/header.jpg # an image for aesthetics, or whatever you like
tap_action:
action: toggle
type: picture-entity # I guess you could go any type here, but picture-entity gives a nice area to click
- card: # This is the card that toggles according to the condition set below
cards: #Any number of cards or entities in here
- cards: # Card Example
type: horizontal-stack
- card: # Card Example
type: entities
- entities: # Card Example
show_header_toggle: false
title: foobar
type: entities
type: vertical-stack
conditions: # Visibility Condition
- entity: input_boolean.some_boolean
state: 'on'
type: conditional
type: vertical-stack
@anon34565116 But what if I wanted the header-toggle to replace the light toggle? In other words, using your example, I want to hide the “Papillon Light” switch in the body of the card, but use the header toggle to switch the light on and off.
It makes little sense for a light switch, more sense for a power-switch which (due to the added sensors) can have its own card.
@krash As you said, I’d have to play around with it. I’m especially curious if the toggle displays/aligns like the “standard” header toggle, which I kind of like. If I’m reading this correctly, your code would create a card within a card, where the parent-card contains a toggle that enables/disables the child-card?
I suppose using the same logic, I could link that toggle to flip a switch as well? So if I take my power switch, I could use a script to toggle it on/off when I flip the toggle of the parent-card?
@philosopher You’re taking the wrong approach here, you need to add an input boolean and trigger an automation to turn off all the lights or restore them based on the value of the boolean, then you’re free to display the toggle wherever you like