It makes more sense in binary and is faster to interpret for humans as well,
from the linked file we can learn there’s 17 features represented so far i.e. 17 bits. (irc pythons bit size is unbounded meaning it is actually a 17 bit value so far)
so let’s look at it as binary instead:
00000000000000000 = 0 This indicates it supports nothing
00000000010000000 = 128 Supports Turn_on but nothing else
00000000100000000 = 256 Supports Turn_off but nothing else
00000000110000000 = 384 Supports Turn_on and Turn_off but nothing else
1111111110011111111 = 523519 Support everything but Turn_on and Turn_off
you could represent this as a bunch of booleans as well but this solution is a bit more elegant when you want to pass the value around since you only have to pass and process one variable.
So sorry, I thought the thread was referring to the piece of quoted code.
I am trying to figure out what features are in included in supported_features of other entities than only ‘media_player’. Right now I want to know more about a ‘cover’ entity.
Taking a look at the code of ‘cover’ I don’t see a list of features with their corresponding meaning and binary value.
My cover entity is specified with supported_features: 3
I guess that means only two features actually?
10000000000000000
01000000000000000
So basically it means my cover probably supports open en close?
So, now you know that your Samsung Player has SUPPORT_SELECT_SOURCE
Great, but how can you actually use this knowledge to create an automation?
What YAML syntax is need to get things moving?
For the convenience of anyone stumbling on this conversation, here’s some quick Python3 code to print a list of which features are supported or unsupported for a given value of supported_features:
In the case of this television you can see the sound but I have no way to turn it on or change the origin for example.
I have another philips that I have to control with a broadlink because it has no possibility of doing anything. Maybe it is not understood why I use a translator. Excuse me and thank you very much for answering
Tv philips (fewer options despite being newer)
device_class: tv
friendly_name: 43PFG5813/77
supported_features: 155453
The audio equipment despite having a smaller number in supported_features: 66060 shows much more information
If anyone without a developer background lands in this thread, here is a tip. To find out what features are enabled, you can either do all the boolean and bitwise operations above, or you can follow a much simpler approach.
So for 51765, that largest number would be SHUFFLE_SET = 32768, as the next one (SELECT_SOUND_MODE) is already over your initial number.
So you know your device supports SHUFFLE_SET. You now have a remainder of 18997 (51765 - 32768). So you apply again, finding the largest number on the table that is lower than your target value, calculating the remainder, and you repeat until you reach zero.