home-assistant / frontend

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

Area Card: Diagnostic binary sensor for battery are not shown #19951

Open DanielHabenicht opened 5 months ago

DanielHabenicht commented 5 months ago

Checklist

Describe the issue you are experiencing

When specifying "battery" in the alert_classes of an area card with a known battery warning (meaning the binary_sensor of the battery entity is on): image

No alert is shown, as it would be with an open window.

Describe the behavior you expected

I would expect a battery symbol to be shown, as it would be the case for an open window: image

Steps to reproduce the issue

  1. Configure a Device with a Diagnostic battery sensor (binary_sensor) and add it to an area 'X'.
  2. Configure an area card for area 'X'.
  3. Add the Battery class to alert_classes.
  4. Set the state of the battery binary_sensor to on.
  5. No icon is displayed on the card.

What version of Home Assistant Core has the issue?

core-2024.2.5

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Google Chrome Version 122.0.6261.69 (Official Build) (64-bit)

Which operating system are you using to run this browser?

Windows 11

State of relevant entities

A battery diagnostic sensor in the area:

binary_sensor.radiator_thermostat_1_battery_low: on

Problem-relevant frontend configuration

alert_classes:
  - window
  - battery
sensor_classes:
  - temperature
  - humidity
type: area
area: sekretariat
navigation_path: /dashboard-ubersicht/eg-sekretariat

Javascript errors shown in your browser console/inspector

none

Additional information

Seems like any sensor with a class is filtered from being displayed in the card: https://github.com/home-assistant/frontend/blob/94e70f81edb58bb8ad270a20d31cf9880be677e3/src/panels/lovelace/cards/hui-area-card.ts#L130-L137

As Diagnostic Devices already have entity_category: "diagnostic" set.

karwosts commented 5 months ago

I assume it's always been the intention for this card to hide diagnostic sensors, as they are sort of intended as not the "primary" sensors of interest for an area, but just secondary information. Admittedly its a grey area.

I've heard that there are some plans in the work for more configuration options for areas that might allow you to choose what sensors are relevant for your area, but I think that's a long term project.

If you really want this sensor shown, I guess the best way that could be achieved right now is just to make a new template sensor for it, and then it would not be tagged as diagnostic.

DanielHabenicht commented 5 months ago

Get it, but what's the benefit of not making them availabe here? One has to set which one to display anway.

I would rather contribute that, than adding a template sensor for each of my battery sensors.

karwosts commented 5 months ago

I guess it's a question of if having those secondary sensors displayed would pollute the card or otherwise mess up the information that most people want to be shown.

I guess I think it's probably mostly an issue for the sensors which do averaging (less so for binary sensors), where having a diagnostic sensor "averaged" with the primary sensor would mess up the result, like maybe where a device has a diagnostic temperature sensor that you don't want or expect to be averaged with a primary room temperature sensor.

But specifically for the binary sensors, maybe an argument could be made to include the diagnostic ones as well.

If you're interested in contributing, feel free to make a pull request for the behavior you think would be correct, and you can get maintainer feedback to see if it's something they would accept. I was just pointing out why I believed it was designed this way.

DanielHabenicht commented 5 months ago

Appreciate your knowledge, thats why I added an issue instead of directly opening a PR.

Yes, if contributing I would only include the binary sensors, but as I read it the current "alert_classes" only accept binary sensors anyway. I wouldn't change the "sensor_classes"

github-actions[bot] commented 2 months 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.

ChristophCaina commented 2 months ago

Hi. I agree that the Information of a battery state is usually a secondary information - and per device Level, IT IS correct to See them as Diagnostic.

But - even since it is only a secondary information - and nothing that will be permanently visible to me in the Dashboard, it would make Sense in my eyes to Show them as a possible Alarm in the area Card - if the battery of a device will be reported as empty.

OK. True, i still have to Check, which device would report the empty battery... But it would allow me to immediately Check the window Sensors or Thermostat in that room / area before i notice this, due to an bin updated / Not available Sensor somewhere in the House