Remove Tuya climate ext. temperature entity option (#42546)
This commit is contained in:
parent
dc89bfe9ce
commit
ebc26c70b9
4 changed files with 7 additions and 68 deletions
|
@ -24,7 +24,6 @@ from .const import (
|
|||
CONF_COUNTRYCODE,
|
||||
CONF_CURR_TEMP_DIVIDER,
|
||||
CONF_DISCOVERY_INTERVAL,
|
||||
CONF_EXT_TEMP_SENSOR,
|
||||
CONF_MAX_KELVIN,
|
||||
CONF_MAX_TEMP,
|
||||
CONF_MIN_KELVIN,
|
||||
|
@ -229,7 +228,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||
device_id, self.config_entry.options.get(device_id, {})
|
||||
)
|
||||
|
||||
config_schema = await self._get_device_schema(device_type, curr_conf, device)
|
||||
config_schema = self._get_device_schema(device_type, curr_conf, device)
|
||||
if not config_schema:
|
||||
self._form_error = ERROR_DEV_NOT_CONFIG
|
||||
return await self.async_step_init()
|
||||
|
@ -312,13 +311,12 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||
|
||||
return await self.async_step_init()
|
||||
|
||||
async def _get_device_schema(self, device_type, curr_conf, device):
|
||||
def _get_device_schema(self, device_type, curr_conf, device):
|
||||
"""Return option schema for device."""
|
||||
if device_type == "light":
|
||||
return self._get_light_schema(curr_conf, device)
|
||||
if device_type == "climate":
|
||||
entities_list = await _get_entities_matching_domains(self.hass, ["sensor"])
|
||||
return self._get_climate_schema(curr_conf, device, entities_list)
|
||||
return self._get_climate_schema(curr_conf, device)
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
|
@ -362,11 +360,10 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||
return config_schema
|
||||
|
||||
@staticmethod
|
||||
def _get_climate_schema(curr_conf, device, entities_list):
|
||||
def _get_climate_schema(curr_conf, device):
|
||||
"""Create option schema for climate device."""
|
||||
unit = device.temperature_unit()
|
||||
def_unit = TEMP_FAHRENHEIT if unit == "FAHRENHEIT" else TEMP_CELSIUS
|
||||
entities_list.insert(0, ENTITY_MATCH_NONE)
|
||||
|
||||
config_schema = vol.Schema(
|
||||
{
|
||||
|
@ -390,19 +387,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||
CONF_MAX_TEMP,
|
||||
default=curr_conf.get(CONF_MAX_TEMP, 0),
|
||||
): int,
|
||||
vol.Optional(
|
||||
CONF_EXT_TEMP_SENSOR,
|
||||
default=curr_conf.get(CONF_EXT_TEMP_SENSOR, ENTITY_MATCH_NONE),
|
||||
): vol.In(entities_list),
|
||||
}
|
||||
)
|
||||
|
||||
return config_schema
|
||||
|
||||
|
||||
async def _get_entities_matching_domains(hass, domains):
|
||||
"""List entities in the given domains."""
|
||||
included_domains = set(domains)
|
||||
entity_ids = hass.states.async_entity_ids(included_domains)
|
||||
entity_ids.sort()
|
||||
return entity_ids
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue