home-assistant / frontend

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

Attribute condition missing from Dashboard visibility #22215

Open Stutchbury opened 12 hours ago

Stutchbury commented 12 hours ago

Checklist

Describe the issue you are experiencing

The Conditions documentation show 'attribute:' as a valid label for numeric state conditions but in Dashboard Cards and Badges, this label is ignored.

Describe the behavior you expected

As per the Conditions documentation, when 'attribute:' is used in visibility conditions for Cards and Badges the specified attribute is used to compare Above/Below rather than the Entity value.

Steps to reproduce the issue

  1. Create a Badge in any Dashboard
  2. Select the 'Visibility' tab
  3. Add an 'Entity Numeric State' condition
  4. Press 'SHOW CODE EDITOR'
  5. Add 'attribute: below the entity line
  6. Save

What version of Home Assistant Core has the issue?

2024.10.0

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Firefos 115.04

Which operating system are you using to run this browser?

Debian 12

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

There is a brief discussion here: https://github.com/home-assistant/frontend/discussions/21550 bus as there is a mismatch between documentation and functionality, I thought it appropriate to raise an issue.

karwosts commented 12 hours ago

That documentation is for automations.

The documentation for dashboard conditionals is here, and it does not mention attribute: https://rc.home-assistant.io/dashboards/conditional/#state

I believe this may be intentional, as I have seen many developer comments that they generally want to move away from using attributes and instead having more sensors. So I think any new development of attribute related features is discouraged.

Stutchbury commented 11 hours ago

Thank you for your reply and link to the 'alternative' conditions for Dashboards. Like most, I suspect people will search for 'Home Assistant conditions' and end up where I did.

I sincerely hope this is not intentional - an entity can currently have many attributes that would never normally be displayed but are essential for conditions. UI conditions are likely to be particularly reliant on non-visible attributes.

If the intention is to limit the use of attributes to values that are defined during configuration (such as UoM) and to move attributes that are set/changed at runtime to sensors, that would be logical but needs a roadmap - and the future usage of attributes communicated to developers.