Lovelace: hide/show entities based on state of other entities, within a card

I’ve implemented a “conditional entity” using a Conditional Card plus Custom:vertical-stack-in-card. This can hide or show an entity based on the state of a switch in the same “Card”.

It doesn’t look great - due to ‘vertical-stack-in-card’ adding quite a bit of deadspace, but at least it does the job.

Here’s the construct:

  - type: 'custom:vertical-stack-in-card'
    cards:
      - type: entities
        entities:
          - switch.espresso
          - switch.espresso_automatic_control
          - switch.espresso_override
      - type: conditional
        conditions:
          - entity: switch.espresso_override
            state: 'on'
        card:
          type: entities
          entities:
            - input_datetime.espresso_override_start
      - type: entities
        show_header_toggle: false
        entities:
          - sensor.kitchen_sink_water_detector

Here is how it looks like:

(switch off: extra entity hidden)

image

(switch on: extra entity shown)

image

Still hoping that when lovelace matures they will add a better (simpler and better looking) way to achieve this.