slider-button-card icon indicating copy to clipboard operation
slider-button-card copied to clipboard

Option to display power consumption

Open bramstroker opened this issue 3 years ago • 3 comments

I love this card, awesome job! Replaced all my light controls with this one.

Have one feature request, maybe you could consider implementing. I have power sensors of all my lights and other appliances. It would be nice to display the current consumption (Watt) in the slider-button-card. Introducing two options to control this: power_entity and maybe display_power.

bramstroker avatar Jun 13 '21 10:06 bramstroker

This state information can be added to displayed state via an "additional state" option which will prompt for either a template or choose multiple entries from the entity's attributes.

mouth4war avatar Jul 08 '21 00:07 mouth4war

@mouth4war would be nice to have some option for additional state. To have some more generic approach and not only for power consumption. however in this issue the power sensor is a different entity than the card entity, so your proposed solution won't work in this case.

Could be something like this maybe in the configuration. additional_state config option with the following possibilities:

entity -> Optional, when not passed the same entity as the card will be assumed state_attribute -> Required, attribute of the entity, or state when you want the state template -> Optional

So for the power sensor the configuration can be:

{
    "additional_state": {
        "entity": "my_power_sensor",
        "state_attribute": "state"
    }
}

Or for you humidity example:

{
    "additional_state": {
        "state_attribute": "humidity"
    }
}

Not sure about the feasibility of this approach. @mattieha, what do you think?

Also issue #84 could be intregrated somehow in this generic implementation

bramstroker avatar Jul 08 '21 18:07 bramstroker

Good idea. Just need multiple addition attributes lines.

mouth4war avatar Jul 09 '21 09:07 mouth4war