thomasloven / lovelace-state-switch

🔹Dynamically replace lovelace cards depending on occasion
MIT License
403 stars 27 forks source link

Seems to fail when states values contain spaces #116

Open cperrier opened 5 months ago

cperrier commented 5 months ago

It seems that when the tested entity's status contains a space character, the card that should be displayed isn't. That happens for instance with the following

type: custom:state-switch entity: sensor.template_lixee_zlinky_tic_tarif_fournisseur states: HC BLEU: type: vertical-stack cards:

I expect a simple markdown card with "Heures Creuses tarif BLEU" to appear as soon as the value of the referenced sensor is "HC BLEU". It actually works with a simple conditional card, but not with state-switch....while whenever the sensor has a value that does NOT contain any space, it works as expected.

I tried quoting the expected states values (with double or single quotes, whatever), but nothing has been helpful.

ildar170975 commented 5 months ago

See no issues here: изображение

type: vertical-stack
cards:
  - type: entities
    entities:
      - input_text.test_text
  - type: custom:state-switch
    entity: input_text.test_text
    default: one one
    states:
      one one:
        type: entity
        entity: sun.sun
        name: one
      two two:
        type: entity
        entity: sun.sun
        name: two
      three three:
        type: entity
        entity: sun.sun
        name: three
cperrier commented 5 months ago

Hmmm, I suspect something weird in the sensor status but can't really find what. Just to be sure, I made a quick test with the standard conditional card

type: conditional conditions:

....and this actually works as expected : if my sensor's value is "HP BLEU" then the markdown card is shown as expected