maxwroc/battery-state-card

Support groups created via UI/Helpers

loocd opened this issue · 4 comments

loocd commented

I just stumbled upon this card and it looks amazing. Just one little thing about the groups functionality.

Describe what is wrong
Using existing HA groups to populate the individual entities would be amazing, as this would spare me from adding the same entities in multiple places.
My understanding is: I add the group as the only entity and this would populate all individual devices, according to group.switches_batteries in this explanation: https://github.com/maxwroc/battery-state-card#battery-groups

However, the new UI groups in HomeAssistant no longer follow the groups.* terminology but are added as a sensor.*
Adding this sensor results in a single sensor being added, rather than all the containing entities.

How can I get this to work using the new UI groups from HomeAssistant?

Card configuration

type: custom:battery-state-card
sort_by_level: asc
color_gradient:
  - '#ff0000'
  - '#ffff00'
  - '#00ff00'
entities:
  - entity: sensor.hue_motion_sensor_1_battery_2
    name: Bewegungsmelder Esszimmer
  - sensor.batterien_sensoren_aktoren

Screenshot
Unbenannt

Version
v2.1.1

I have the most recent HA v2023.2.4 and group entities are present and they work with the card
image

loocd commented

The difference, in my opinion, is that you are using group.*
In my opinion, the UI groups don't let me grate any group.* groups, but, as mentioned in my initial question, lead to an actual sensor.* (see my entities list, the last entity is a group).

Or is there a way to create a group via the HA UI that is an actual group.*?

Or is there a way to create a group via the HA UI that is an actual group.*?

I don't see such option unfortunately. I don't know why when you create a group via helpers it doesn't create an entity in the group domain but a regular sensor.

I have a mixed feelings regarding adding the support to "unpack" such groups. What if someone wants to actually see it as a single entity in the card?

I will think about this more. I'm open as well for suggestions

loocd commented

Fully understand your concerns. Maybe this can be implemented as an optional parameter unpack - depending on whether you'd like to unpack the grouped sensor or not.