You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 through supported_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 the turn_on implementation. There may be platforms that do not properly set supported_features which may result in service calls not being invoked as in the past they would have been.
Description:
Adds checks to the media_player default implementations of turn_on and turn_off so that it only raises NotImplementedError 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 and turn_off that error when the service media_player.turn_on: {entity_id: all} is executed: Heos, Roku, and possibly others.
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_onimplementation. There may be platforms that do not properly setsupported_featureswhich may result in service calls not being invoked as in the past they would have been.Description:
Adds checks to themedia_playerdefault implementations ofturn_onandturn_offso that it only raisesNotImplementedErrorif 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_serviceas 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_onandturn_offthat 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: