home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.13k stars 2.81k forks source link

Conditional card no longer working #14033

Closed gigatexel closed 1 year ago

gigatexel commented 2 years ago

Checklist

Describe the issue you are experiencing

I've been using the conditional card below for quite a while now. Since upgrading to 2022.10 beta and now 2022.10.1, it started failing.

type: conditional
conditions:
  - entity: sensor.washing_machine_status
    state_not: 'off'
  - entity: sensor.washing_machine_status
    state_not: not_connected
card:
  type: custom:stack-in-card
  mode: vertical
  cards:
// contents

The sensor.washing_machine_status has the value program_ended. This is visible in the card-editor and in the dev-tools. Also, in the card-editor it is clearly seen that the condition evaluates to "true" because the contents is hidden. However, in the dashboard itself, the card remains visible.

image

image

I have tried multiple browsers and even physically different PC's. It is present on PC and on the iOS app.

Describe the behavior you expected

Evaluating correctly as it did before.

Steps to reproduce the issue

1. 2. 3. ...

What version of Home Assistant Core has the issue?

core-2022.10.1

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

No response

Which operating system are you using to run this browser?

No response

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

karwosts commented 1 year ago

Suspect this might be something related to your custom:stack-in-card?

Does it work properly if you use a different card type?

I tried to reproduce this with just default cards and it works as expected for me.

type: conditional
conditions:
  - entity: input_boolean.mybool
    state_not: 'off'
  - entity: input_boolean.mybool
    state_not: otherstate
card:
  show_name: true
  show_icon: true
  type: button
  tap_action:
    action: toggle
  entity: input_boolean.mybool
ildar170975 commented 1 year ago

This code works as expected:

type: conditional
conditions:
  - entity: input_boolean.test_boolean
    state_not: 'on'
  - entity: input_boolean.test_boolean_2
    state_not: 'on'
card:
  type: custom:stack-in-card
  mode: vertical
  cards:
    - type: entities
      entities:
        - sun.sun
    - type: glance
      entities:
        - sun.sun
ildar170975 commented 1 year ago

Re-check this state_not: not_connected - what is a true value here, probably you need to put the value in quotes.

karwosts commented 1 year ago

I think maybe 'on' and 'off' only get quoted so they don't get cast to booleans or something. Other states don't get quotes applied by default from the visual editor.

So I suspect not_connected without quotes is fine and correct.

ildar170975 commented 1 year ago

not_connected without quotes is fine and correct

Tested - you are right. One more exception - if your string contains unicode symbols, then you need to place the whole string into '.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.