#Super simple conditional card - not working

1 messages · Page 1 of 1 (latest)

marsh ivy
#

Hi, I have this conditional card:

`type: conditional
conditions:

  • condition: state
    entity: sensor.anniversary_fredrik_fodelsedag
    state: "<46"
    card:
    type: entity
    entity: sensor.anniversary_fredrik_fodelsedag`

However it doesn't show, even though the value is 45. I've tried setting state: "45", and that does work. I've also tried state '<46' and I've tried:

`type: conditional
conditions:

  • condition: template
    value_template: "{{ states('sensor.anniversary_fredrik_fodelsedag') | int <= 46 }}"
    card:
    type: entity
    entity: sensor.anniversary_fredrik_fodelsedag
    state_color: false
    name: Fredrik`

The latter was after some googling but that just says "conditions are invalid".

I've checked in the template editor that {{ states('sensor.anniversary_fredrik_fodelsedag') | int <= 46 }} is TRUE.

Any help for a newbie? Thanks!

proper sail
#

That state “<45” won’t work as states are strings. You’d need to use a numeric_state conditional to make this work as you want.

marsh ivy
#

Ahh. So I changed to numeric_state and then added below: 45

#

Seems to work

#

Thank you! Silly question.