Media player const.py move (#20822)
* Move more constants to const.py * Import constants directly from const * ATTR_ENTITY_ID is not defined in media_player * MEDIA_PLAYER_PLAY_MEDIA_SCHEMA is still in __init__.py * Correct imports in tts * PLATFORM_SCHEMA, SCHEMA is still defined in __init__.py * Pandora imports several services * Some additional fixes for move of const in media_player * Fix hound lengths
This commit is contained in:
parent
faf7ae29b1
commit
d16d14b648
85 changed files with 383 additions and 263 deletions
|
@ -63,7 +63,7 @@ def validate_entity_config(values):
|
|||
if domain in ('alarm_control_panel', 'lock'):
|
||||
config = CODE_SCHEMA(config)
|
||||
|
||||
elif domain == media_player.DOMAIN:
|
||||
elif domain == media_player.const.DOMAIN:
|
||||
config = FEATURE_SCHEMA(config)
|
||||
feature_list = {}
|
||||
for feature in config[CONF_FEATURE_LIST]:
|
||||
|
@ -90,14 +90,16 @@ def validate_media_player_features(state, feature_list):
|
|||
features = state.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
|
||||
|
||||
supported_modes = []
|
||||
if features & (media_player.SUPPORT_TURN_ON |
|
||||
media_player.SUPPORT_TURN_OFF):
|
||||
if features & (media_player.const.SUPPORT_TURN_ON |
|
||||
media_player.const.SUPPORT_TURN_OFF):
|
||||
supported_modes.append(FEATURE_ON_OFF)
|
||||
if features & (media_player.SUPPORT_PLAY | media_player.SUPPORT_PAUSE):
|
||||
if features & (media_player.const.SUPPORT_PLAY |
|
||||
media_player.const.SUPPORT_PAUSE):
|
||||
supported_modes.append(FEATURE_PLAY_PAUSE)
|
||||
if features & (media_player.SUPPORT_PLAY | media_player.SUPPORT_STOP):
|
||||
if features & (media_player.const.SUPPORT_PLAY |
|
||||
media_player.const.SUPPORT_STOP):
|
||||
supported_modes.append(FEATURE_PLAY_STOP)
|
||||
if features & media_player.SUPPORT_VOLUME_MUTE:
|
||||
if features & media_player.const.SUPPORT_VOLUME_MUTE:
|
||||
supported_modes.append(FEATURE_TOGGLE_MUTE)
|
||||
|
||||
error_list = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue