-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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
Check for supported features in media_player services #22878
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #22878 +/- ##
==========================================
+ Coverage 93.82% 93.83% +<.01%
==========================================
Files 448 448
Lines 36528 36532 +4
==========================================
+ Hits 34274 34279 +5
+ Misses 2254 2253 -1
Continue to review full report at Codecov.
|
I am going to mark this as a breaking change, because it might break some integrations that are not setting supported features, and we should call it out. |
Sounds good - I added the breaking change description. Of the ~50 media player platforms, I looked at the first 10 alphabetical and didn't see any discrepancies. |
Breaking Change:
The Media Player component will now guard against calling services that are not supported by the entity. This means that if you attempt to invoke
media_player.turn_on
, but the entity does not indicate it can be turned on throughsupported_features
, the service will not be called and will not log any message. This is a breaking change as in the past it have called theturn_on
implementation. There may be platforms that do not properly setsupported_features
which may result in service calls not being invoked as in the past they would have been.Description:
Adds checks to themedia_player
default implementations ofturn_on
andturn_off
so that it only raisesNotImplementedError
if the platform supports the feature. See the related issue for more details and use-cases.After discussion with @balloob and @robbiet480 it was recommended to move the supported feature guard into the service utility instead (
async_register_entity_service
as the entry-point). The updated PR adds this feature (and fixes a hacked-in test in the demo media_player).Examples of platforms that do not support
turn_on
andturn_off
that error when the servicemedia_player.turn_on: {entity_id: all}
is executed: Heos, Roku, and possibly others.Related issue (if applicable): fixes #22877
Checklist:
tox
. Your PR cannot be merged unless tests passIf the code does not interact with devices: