Use new helper properties in hyperion options flow (#129777)

This commit is contained in:
epenet 2024-11-04 18:54:22 +01:00 committed by GitHub
parent 81735b7b47
commit 8870b657d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -424,24 +424,22 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
@staticmethod
@callback
def async_get_options_flow(config_entry: ConfigEntry) -> HyperionOptionsFlow:
def async_get_options_flow(
config_entry: ConfigEntry,
) -> HyperionOptionsFlow:
"""Get the Hyperion Options flow."""
return HyperionOptionsFlow(config_entry)
return HyperionOptionsFlow()
class HyperionOptionsFlow(OptionsFlow):
"""Hyperion options flow."""
def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize a Hyperion options flow."""
self._config_entry = config_entry
def _create_client(self) -> client.HyperionClient:
"""Create and connect a client instance."""
return create_hyperion_client(
self._config_entry.data[CONF_HOST],
self._config_entry.data[CONF_PORT],
token=self._config_entry.data.get(CONF_TOKEN),
self.config_entry.data[CONF_HOST],
self.config_entry.data[CONF_PORT],
token=self.config_entry.data.get(CONF_TOKEN),
)
async def async_step_init(
@ -470,8 +468,7 @@ class HyperionOptionsFlow(OptionsFlow):
return self.async_create_entry(title="", data=user_input)
default_effect_show_list = list(
set(effects)
- set(self._config_entry.options.get(CONF_EFFECT_HIDE_LIST, []))
set(effects) - set(self.config_entry.options.get(CONF_EFFECT_HIDE_LIST, []))
)
return self.async_show_form(
@ -480,7 +477,7 @@ class HyperionOptionsFlow(OptionsFlow):
{
vol.Optional(
CONF_PRIORITY,
default=self._config_entry.options.get(
default=self.config_entry.options.get(
CONF_PRIORITY, DEFAULT_PRIORITY
),
): vol.All(vol.Coerce(int), vol.Range(min=0, max=255)),