-
-
Notifications
You must be signed in to change notification settings - Fork 38.2k
Use enums in vizio #61996
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
Use enums in vizio #61996
Changes from 2 commits
716dda5
626d4e0
dbfe114
6832538
9a5ed82
748fbb1
40a8cba
ed79ee4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |
|
|
||
| from homeassistant import config_entries | ||
| from homeassistant.components import zeroconf | ||
| from homeassistant.components.media_player import DEVICE_CLASS_SPEAKER, DEVICE_CLASS_TV | ||
| from homeassistant.components.media_player import MediaPlayerDeviceClass | ||
| from homeassistant.config_entries import ( | ||
| SOURCE_IGNORE, | ||
| SOURCE_IMPORT, | ||
|
|
@@ -68,7 +68,11 @@ def _get_config_schema(input_dict: dict[str, Any] = None) -> vol.Schema: | |
| vol.Required( | ||
| CONF_DEVICE_CLASS, | ||
| default=input_dict.get(CONF_DEVICE_CLASS, DEFAULT_DEVICE_CLASS), | ||
| ): vol.All(str, vol.Lower, vol.In([DEVICE_CLASS_TV, DEVICE_CLASS_SPEAKER])), | ||
| ): vol.All( | ||
| str, | ||
| vol.Lower, | ||
| vol.Coerce(MediaPlayerDeviceClass), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a change of functionnality: it allows
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @raman325 was this voluntary? I missed the earlier conversation when I posted this.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no that's a good point, I missed that receiver is also a device class. @tkdrob can we revert this commit? |
||
| ), | ||
| vol.Optional( | ||
| CONF_ACCESS_TOKEN, default=input_dict.get(CONF_ACCESS_TOKEN, "") | ||
| ): str, | ||
|
|
@@ -134,7 +138,7 @@ async def async_step_init(self, user_input: dict[str, Any] = None) -> FlowResult | |
| } | ||
| ) | ||
|
|
||
| if self.config_entry.data[CONF_DEVICE_CLASS] == DEVICE_CLASS_TV: | ||
| if self.config_entry.data[CONF_DEVICE_CLASS] == MediaPlayerDeviceClass.TV: | ||
| default_include_or_exclude = ( | ||
| CONF_EXCLUDE | ||
| if self.config_entry.options | ||
|
|
@@ -233,7 +237,9 @@ async def async_step_user(self, user_input: dict[str, Any] = None) -> FlowResult | |
| self._must_show_form = False | ||
| elif user_input[ | ||
| CONF_DEVICE_CLASS | ||
| ] == DEVICE_CLASS_SPEAKER or user_input.get(CONF_ACCESS_TOKEN): | ||
| ] == MediaPlayerDeviceClass.SPEAKER or user_input.get( | ||
| CONF_ACCESS_TOKEN | ||
| ): | ||
| # Ensure config is valid for a device | ||
| if not await VizioAsync.validate_ha_config( | ||
| user_input[CONF_HOST], | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.