[SOLVED] Conditional card not working, I think I'm missing something basic?

Hello. I’ve tried creating a simple vertical stack with 3 selector buttons, changing an input value to 1,2 or 3. This should activate the conditional card reliant on this value but I can’t get it to work. Am I missing something basic?

type: vertical-stack
cards:
  - square: true
    type: grid
    cards:
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: call-service
          service: input_number.set_value
          target:
            entity_id: input_number.system_choice_phoneview1_conditional_selection
          data:
            value: 1
        name: Lounge
        icon: mdi:sofa
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: call-service
          service: input_number.set_value
          target:
            entity_id: input_number.system_choice_phoneview1_conditional_selection
          data:
            value: 2
        name: House
        icon: mdi:home
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: call-service
          service: input_number.set_value
          target:
            entity_id: input_number.system_choice_phoneview1_conditional_selection
          data:
            value: 3
        name: Systems
        icon: mdi:desktop-classic
    columns: 3
  - type: conditional
    conditions:
      - condition: state
        entity: input_number.system_choice_phoneview1_conditional_selection
        state: '1'
    card:
      type: entity
      entity: sensor.time
      name: Lounge
  - type: conditional
    conditions:
      - condition: state
        entity: input_number.system_choice_phoneview1_conditional_selection
        state: '2'
    card:
      type: entity
      entity: sensor.time
      name: House
  - type: conditional
    conditions:
      - condition: state
        entity: input_number.system_choice_phoneview1_conditional_selection
        state: '3'
    card:
      type: entity
      entity: sensor.time
      name: Systems
      state_color: false

I don’t think the tap action supports target. You just put the entity_id in the data, like so:

        tap_action:
          action: call-service
          service: input_number.set_value
          data:
            entity_id: input_number.system_choice_phoneview1_conditional_selection
            value: 1

Tap action options are listed here: Actions - Home Assistant

Me clicking on the three buttons does change the input value between 1,2,3 but my issue is the conditional cards not appearing afterwards.

EG, I’ve pressed the “systems” button and the input value changes to 3.

image

However, the conditional card relying on this value to be 3 is not appearing.

I do not think Conditional cards work with numbers.

type: vertical-stack
cards:
  - type: entities
    entities:
      - input_number.test_number
  - type: conditional
    conditions:
      - condition: state
        entity: input_number.test_number
        state: '1'
    card:
      type: entity
      entity: sun.sun
  - type: conditional
    conditions:
      - condition: state
        entity: input_number.test_number
        state: '2'
    card:
      type: entity
      entity: zone.home

Also tested with

 state: 2

but this could be wrong since states are “strings”.

May be considered as a bug.


Bingo.
Here is a working code:

        state: '2.0'

Even an “input_number” with “step=1” still is kept as “2.0”.


Or use “above/below” to define value “2”:

      - condition: numeric_state
        entity: input_number.test_number
        above: 1
        below: 3
2 Likes

Thanks for troubleshooting that. The extra decimal place works fine as you say. Have a happy new year!

1 Like