-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement source switching for homekit_controller televisions #32526
Conversation
] | ||
|
||
def _setup_active_identifier(self, char): | ||
self._features |= SUPPORT_SELECT_SOURCE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this ever change during entity lifetime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, no. Some TV's might support it some might not, but it will be determined when the TV is added to HA and not again (until restart). Characteristics don't come and go very frequently. If it changed it would probably be a firmware update that added more capabilities to a device that already had very basic HomeKit support in its firmware.
That said, in a future PR i plan to make it some that the setup phase /can/ be run again, idempotently. HomeKit accessories publish a change to their zeroconf metadata if what i call the entity map changes. I handle this already to some extent and add new entities that have been picked added to bridges. But I want to also reconfigure all entities in that case to pick up new features or altered limits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Supported features shouldn't change during entity lifetime. It could be ok to remove an old entity and add a new one in the old ones place if we want to reconfigure in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks for the heads up - i'll bear that in mind!
Proposed change
This implements
source
andsource_list
for the homekit_controller media player. If they are supported it setsSUPPORT_SELECT_SOURCE
and it addsasync_select_source
.Historically one HomeKit service mapped to one Home Assistant entity. But for TV's there are additional satellite services for input sources. This means that the polling and subscribing logic had to be tweaked a bit too, and to avoid some awful code in HA i've added some abstractions to aiohomekit to make it easier to work with these linked services.
This introduces an
entity_map
object onHKDevice
. The plan is to stop using the raw JSON inHKDevice.accesories
andHKDevice.current_state
and to useentity_map
instead, moving a lot of non-HA specific state management code upstream and out of HA. But that will be in a future PR.Type of change
Additional information
Checklist
black --fast homeassistant tests
)If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.The integration reached or maintains the following Integration Quality Scale: