EntitiesCard: Control which entity header-toggle controls

Integration: Zigbee2MQTT

Here’s an entities card I’m currently using: Header toggle - can control separate entity? - Album on Imgur

When the header-toggle is enabled, toggling it will send a separate-command to each of the entities, which can cause delays/issues.

The solution is to use Zigbee groups, so I added the separate entities to a zigbee group which HA currently recognizes as light.kitchen_lights.

However, from what I understand it’s impossible to control which entities header-toggle controls, it will always be each of the entities in the card’s rows. Is that correct?

I have tried using the header but I think it looks horrible and not nearly as neat as the toggle.

Any solutions out there for this?

A workaround would be to use two entities cards, one with header-toggle enabled, the other not. You could then use something like Vertical Stack In Card from HACS to join them together making them appear to be one card.

In this example, the header toggle turns on the lights but not the sockets.

image

type: custom:vertical-stack-in-card
cards:
  - type: entities
    title: Sockets
    entities:
      - entity: switch.living_room_socket_1
      - entity: switch.living_room_socket_4
    state_color: true
  - type: entities
    entities:
      - entity: switch.living_room_socket_2
      - entity: switch.living_room_socket_3
    state_color: true
    show_header_toggle: false

1 Like

Thanks, so the only way to do this is to give up my current UI-configured dashboard and move YAML-based dashboards?

Only for that one card, surely?

If I use lovelace config with mode YAML then my dashboard is all YAML, no?

If you want to add a custom card to a dashboard, you click on add card in the normal way, then select manual as the card type.

OK maybe if I provide more details it’ll be easier to understand what I’m doing wrong. In configuration.yaml I have added the following:

lovelace:
  resources:
    - url: /local/vertical-stack-in-card.js?v=0.4.1
      type: module

After adding vertical-stack-in-card.js to config/www.

Then In the UI I added a Manual card, with the following YAML code:

type: custom:vertical-stack-in-card
cards:
  - type: entities
    title: Kitchen
    entities:
      - entity: light.kitchen_lights
    state_color: true

But the UI shows a red box with the title: “custom element doesn’t exist vertical-stack-in-card”.

I also see a warning in my logs:

Lovelace is running in storage mode. Define resources via user interface

So what am I doing wrong then?

Don’t add the resource to configuration.yaml.

configuration → lovelace dashboards

1 Like

Also, install the HACS integration and use that to get the custom card.

@Stiltjack @francisp thanks both for helping out! I’d rather rely as little as possible on third-party integrations, and if I can install something manually I’d rather do it this way. I’ll try the Resources tab.

@Stiltjack I got the vertical cards to work, but I don’t want the entity to show. Only to have the header toggle the group, but I don’t want the entity itself to appear. So I’m not sure this is suitable.

HA is pretty much all third-party! :grin:

Agreed, anyway as I said I want the title toggle to control the group, but I don’t want to have to show this group entity in a separate row as well, so this doesn’t look like its’ going to work. Any ideas?

Not quite what you want either, but the fold-entity-row card (also in HACS, sorry) allows you to show and hide entities in an entities card.

OK, maybe an image: Imgur: The magic of the Internet

I want a card that looks exactly like this or almost exactly like this, with the exception that pressing the topmost toggle (the one near the title) will send a toggle to light.some_other_entity instead of the default behavior (sending a toggle command to each of the entities listed in the Entities card).

I hope that’s clear…

You ever figure out a solution to this?

Would also be interested, having the same requirement. Basically a solution would be to select in the entities card configuration which entity is toggled by the header toggle (entity should not need to be configured in the entities card itself)