Type: conditional and equality

Hi there

I can’t find the good way to do a conditional card that display a button if an input_number equal a float number

Can you help me ? Thanks

condition: numeric_state
value_template: "{{ states('input_number.clim_salon') | float = 19}}"

You can try it like this
"{{ states('input_number.clim_salon') | float(0) == 19}}"

Already tried… But thanks :wink:

The error:

Conditions are invalid
type: conditional
conditions:

  • condition: numeric_state
    ‘=value_template’: ‘{{ states(’‘input_number.clim_salon’‘) | float = 19}}’
    card:
    show_name: true
    show_icon: true
    type: button
    tap_action:
    action: toggle
    icon: mdi:fire-circle
    name: 19°C
    icon_height: 50px
    entity: script.salon_19_degres_hiver
    show_state: false

from the conditional card docs it doesn’t look like the conditions accept a template.

And typically that’s the case with almost all built-in cards.

just use the entity_id of the entity to test and use state instead of numeric_state:

condition: state
entity_id:  input_number.clim_salon
state: '19'

Same error: Conditions are invalid

It works but without

_id

that’s strange since that’s not the way yaml conditions work but if it works then good enough.