Is there an easy way to hide entity on a Lovelace card based on state of another entity?

it’s better to ask the owner of the original monster card I presume…

Ok, I have found this thread because I wanted basically the same that the topic says…
I see the “solution” is to use the customized monster-card, which was actually deprecated in favour of its successor auto-entities-card.

Therefore, I decided to post the up-to-date solution using the card which is official and not deprecated.
For instance, to hide/show the light brightness and temperature entities (input_number.kitchen_intelite_brightness and input_number.kitchen_intelite_temperature) based on the light entity state (light.kitchen_intelite) use this:

  - type: custom:auto-entities
    card:
      title: Kitchen Lights
      type: entities
      show_header_toggle: false
    entities:
    - light.kitchen_intelite
    filter:
      template: |
         {% if is_state('light.kitchen_intelite','on') %}input_number.kitchen_intelite_brightness{% endif %}
         {% if is_state('light.kitchen_intelite','on') %}input_number.kitchen_intelite_temperature{% endif %}

light.kitchen_intelite entity will be shown regardless of it’s state.
input_number.kitchen_intelite_brightness and input_number.kitchen_intelite_temperature entities’ sliders will be shown only when the light.kitchen_intelite is on

I think it’s the prettiest way to do it atm

5 Likes

Perfect, have used this to hide the Xmas Tree Light Switch until next Xmas.

type: 'custom:auto-entities'
card:
  title: Lounge
  type: entities
  show_header_toggle: true
entities:
  - light.lounge
  - light.lounge_corner
filter:
  template: |
    {% if now().month==12 %}switch.xmas_tree{% endif %}