Supported_features

@AnyOneWhoCanHelpMe. I am working on navive HomeKit Integration as I am looking at the best possible and “leanest config” options I am extremely curious about the “supported_features” attribute I see in the “states” tab of the “developer tools” of the front-end. I guess that option if of great interest to configure the connection automagically. F.I. a light, can it be switched on/of only, can it DIM, does it have RGB or any other features etc. Again another guess based on my experience is that it is a bitmapped field.

My question is; Where can I find some Docs on that?

1 Like

You should look in the base class e.g ligts/init.py

i am also interested in this?

How does this add together?

i have a hue light with supported_feature 41 (this one makes sense)
and i have another one with color_temp supported_feature 43 (how does this one work)
How would a RGB lamp look like???

# Bitfield of features supported by the light entity
ATTR_SUPPORTED_FEATURES = 'supported_features'
SUPPORT_BRIGHTNESS = 1
SUPPORT_COLOR_TEMP = 2
SUPPORT_EFFECT = 4
SUPPORT_FLASH = 8
SUPPORT_RGB_COLOR = 16
SUPPORT_TRANSITION = 32
SUPPORT_XY_COLOR = 64
SUPPORT_WHITE_VALUE = 128
1 Like

yea its difficult to do, i am working on a smart app for google assistant

I know this post is old, but the calculation is basically binary conversion.
So 43 gets you…
SUPPORT_TRANSITION = 32
SUPPORT_FLASH = 8
SUPPORT_COLOR_TEMP = 2
SUPPORT_BRIGHTNESS = 1
See the math there?

The Sengled bulbs I have are only 33 so I get…
SUPPORT_TRANSITION = 32
SUPPORT_BRIGHTNESS = 1

At least this is how I believe the value is determined.

3 Likes

It’s old, but this method hasn’t been explained yet.

to check if a light supports RGB, use

if (supported_features & SUPPORT_RGB_COLOR) {
// rgb supported  
} else {
// no rgb
}

this is the polite way to ask if the flag for RGB is set and it works on any type of light regardless of supported features. Technically, this way you ask the computer if supported_features and SUPPORT_RGB_COLOR both have the same bit (value 16 which means bit 4) enabled. You don’t care about the other bits.