DBuit / Homekit-panel-card

Homekit panel card for home assistant
MIT License
304 stars 54 forks source link

Ability to set arbitrary attribute for number state #75

Closed ghost closed 4 years ago

ghost commented 4 years ago

Light entities have a badge with brightness values, climate has temperature, sensors have last change and they work nice. However, i have both an air purifier and a humidifier (which are at the moment both fans), for which i'd like to display their attributes (aqi and humidity respectively). Any chance for such option by means of a data template?

DBuit commented 4 years ago

Hi @elfhack,

Can you make it a bit more clear to me. You have an entity and this is an air purifier? you have a tile for this. And this has an on/off state? Is there also an entity with the state that you wanna show on that same tile?

ghost commented 4 years ago

@DBuit Sorry for the lag with the explanation, I had some personal business :)

Let's start from the top. Certain types of entites get their special layout, like lights or climate devices. For those, you seem to get seem to use a preprogrammed attribute, for example, you take the brightness of the light, or the temperature for the climate device.

I have 2 devices that in home assistant are fans, but both are more than just fans - one is a purifier, and one is a humidifer (home assistant recently got a humidifer class, but no integration uses it yet). Both of these devices also have special attributes - the purifier has an AQI value, and the humidifer has an air humidity attribute. Again, both of these are fans, so you can't really pre-program those cases into the entity class, as they would conflict. Instead I'm asking for a way, to tell the entity card which attribute to insert into the card. To make it more visual

I want this card

Screenshot 2020-08-20 at 21 52 32

To have an AQI value

And this card

Screenshot 2020-08-20 at 21 53 21

to have a humidity value

just like this card

Screenshot 2020-08-20 at 21 53 54

has a brightness value

And i want the attribute that it gets it from, to be configurable

Now, I've seen you've added a statePath in 0.5.6, but I haven't yet gotten around to play with it. If it is indeed what I think it is, then this can stay closed, and thank you for that functionality :)