Conditional Card to hide a button

Hi!

Last week I dismantled my lawnmower. Now I wand to hide the related button in a Lovelace dashboard till next year, when I need it again.

I tried to go wie conditional cards. I can now hide the button card (name: Rasenmäher) from the layout, but it never shows. It doesn’t matter if light.eg_arbeiten_steckdosen_prasenz is in state on or off.

What am I doing wrong?

type: custom:layout-card
layout_type: custom:masonry-layout
title: Geräte
cards:
  - type: conditional
    conditions:
      - condition: state
        entity: light.eg_arbeiten_steckdosen_prasenz
        state: "on"
    card:
      type: button
      show_name: true
      show_icon: true
      tap_action: null
      action: navigate
      navigation_path: /lovelace-testbutton/shaun
      icon: mdi:robot-mower-outline
      name: Rasenmäher
      hold_action:
        action: none
      show_state: true
      entity: vacuum.shaun_2
      icon_height: 40px

What happens if you remove the “state:” line in the conditions, and remove the quotes from ‘“on”’? Like This ^^^

(I checked the yaml for my conditional card and I have no quotes and no “state:”.)

This is the new version. Same behavior - no difference.

type: custom:layout-card
layout_type: custom:masonry-layout
title: Geräte
cards:
  - type: conditional
    conditions:
      - entity: light.eg_arbeiten_steckdosen_prasenz
        state: 'on'
    card:
      type: button
      show_name: true
      show_icon: true
      tap_action: null
      action: navigate
      navigation_path: /lovelace-testbutton/shaun
      icon: mdi:robot-mower-outline
      name: Rasenmäher
      hold_action:
        action: none
      show_state: true
      entity: vacuum.shaun_2
      icon_height: 40px

the quotes around on were set automatically, when I save the editor view

We may need someone smarter than me to assist then… I’m out of answers. Sorry. :stuck_out_tongue:

Is the entity actually a light? Maybe it’s a switch?
Or maybe the state is actually “On” with a capital ‘O’ ?
Does the state update instantly for that entity when you use it normally? (I have a ZWave plug that sometimes takes 30-60 seconds to update it’s state if I use the physical button.)

Have you tried using a different entity for the condition just to make sure it’s not entity related?

At this point I’m just throwing things out there… :smiley:

Check the indentation:


      tap_action: 
        action: navigate
        navigation_path: /lovelace-testbutton/shaun

I see it now. :man_facepalming: I feel dumb.

Thank a lot! Indeed you are right, the indentation was wrong. But there was no warning, because somehow the editor put a “null” behind tap_action. Without null, which was obviously wrong, the indentation error was shown. I corrected it and it was working again.