mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Clean up code for onewire config flow (#67970)
* Change debug level of integration reload after config update to debug * Remove extra .keys() call for dict itreation * Remove unecessary type check * Remove unused LOGGER reference
This commit is contained in:
parent
ef71ab04ad
commit
7615f138d9
@ -47,5 +47,5 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
|||||||
|
|
||||||
async def options_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
async def options_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||||
"""Handle options update."""
|
"""Handle options update."""
|
||||||
_LOGGER.info("Configuration options updated, reloading OneWire integration")
|
_LOGGER.debug("Configuration options updated, reloading OneWire integration")
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
await hass.config_entries.async_reload(entry.entry_id)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Config flow for 1-Wire component."""
|
"""Config flow for 1-Wire component."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -47,9 +46,6 @@ DATA_SCHEMA_MOUNTDIR = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
async def validate_input_owserver(
|
async def validate_input_owserver(
|
||||||
hass: HomeAssistant, data: dict[str, Any]
|
hass: HomeAssistant, data: dict[str, Any]
|
||||||
) -> dict[str, str]:
|
) -> dict[str, str]:
|
||||||
@ -255,7 +251,7 @@ class OnewireOptionsFlowHandler(OptionsFlow):
|
|||||||
default=self._get_current_configured_sensors(),
|
default=self._get_current_configured_sensors(),
|
||||||
description="Multiselect with list of devices to choose from",
|
description="Multiselect with list of devices to choose from",
|
||||||
): cv.multi_select(
|
): cv.multi_select(
|
||||||
{device: False for device in self.configurable_devices.keys()}
|
{device: False for device in self.configurable_devices}
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@ -273,18 +269,16 @@ class OnewireOptionsFlowHandler(OptionsFlow):
|
|||||||
return await self._update_options()
|
return await self._update_options()
|
||||||
|
|
||||||
self.current_device, description = self.devices_to_configure.popitem()
|
self.current_device, description = self.devices_to_configure.popitem()
|
||||||
data_schema: vol.Schema
|
data_schema = vol.Schema(
|
||||||
if description.family == "28":
|
{
|
||||||
data_schema = vol.Schema(
|
vol.Required(
|
||||||
{
|
OPTION_ENTRY_SENSOR_PRECISION,
|
||||||
vol.Required(
|
default=self._get_current_setting(
|
||||||
OPTION_ENTRY_SENSOR_PRECISION,
|
description.id, OPTION_ENTRY_SENSOR_PRECISION, "temperature"
|
||||||
default=self._get_current_setting(
|
),
|
||||||
description.id, OPTION_ENTRY_SENSOR_PRECISION, "temperature"
|
): vol.In(PRECISION_MAPPING_FAMILY_28),
|
||||||
),
|
}
|
||||||
): vol.In(PRECISION_MAPPING_FAMILY_28),
|
)
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="configure_device",
|
step_id="configure_device",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user