Address late feedback to Overkiz (move to constants) (#64324)
This commit is contained in:
parent
728b587933
commit
05c177e3ed
5 changed files with 19 additions and 25 deletions
|
@ -102,6 +102,10 @@ BINARY_SENSOR_DESCRIPTIONS: list[OverkizBinarySensorDescription] = [
|
|||
),
|
||||
]
|
||||
|
||||
SUPPORTED_STATES = {
|
||||
description.key: description for description in BINARY_SENSOR_DESCRIPTIONS
|
||||
}
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
|
@ -112,10 +116,6 @@ async def async_setup_entry(
|
|||
data: HomeAssistantOverkizData = hass.data[DOMAIN][entry.entry_id]
|
||||
entities: list[OverkizBinarySensor] = []
|
||||
|
||||
key_supported_states = {
|
||||
description.key: description for description in BINARY_SENSOR_DESCRIPTIONS
|
||||
}
|
||||
|
||||
for device in data.coordinator.data.values():
|
||||
if (
|
||||
device.widget in IGNORED_OVERKIZ_DEVICES
|
||||
|
@ -124,7 +124,7 @@ async def async_setup_entry(
|
|||
continue
|
||||
|
||||
for state in device.definition.states:
|
||||
if description := key_supported_states.get(state.qualified_name):
|
||||
if description := SUPPORTED_STATES.get(state.qualified_name):
|
||||
entities.append(
|
||||
OverkizBinarySensor(
|
||||
device.device_url,
|
||||
|
|
|
@ -48,6 +48,10 @@ BUTTON_DESCRIPTIONS: list[ButtonEntityDescription] = [
|
|||
ButtonEntityDescription(key="ring", name="Ring", icon="mdi:bell-ring"),
|
||||
]
|
||||
|
||||
SUPPORTED_COMMANDS = {
|
||||
description.key: description for description in BUTTON_DESCRIPTIONS
|
||||
}
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
|
@ -58,10 +62,6 @@ async def async_setup_entry(
|
|||
data: HomeAssistantOverkizData = hass.data[DOMAIN][entry.entry_id]
|
||||
entities: list[ButtonEntity] = []
|
||||
|
||||
supported_commands = {
|
||||
description.key: description for description in BUTTON_DESCRIPTIONS
|
||||
}
|
||||
|
||||
for device in data.coordinator.data.values():
|
||||
if (
|
||||
device.widget in IGNORED_OVERKIZ_DEVICES
|
||||
|
@ -70,7 +70,7 @@ async def async_setup_entry(
|
|||
continue
|
||||
|
||||
for command in device.definition.commands:
|
||||
if description := supported_commands.get(command.command_name):
|
||||
if description := SUPPORTED_COMMANDS.get(command.command_name):
|
||||
entities.append(
|
||||
OverkizButton(
|
||||
device.device_url,
|
||||
|
|
|
@ -50,6 +50,8 @@ NUMBER_DESCRIPTIONS: list[OverkizNumberDescription] = [
|
|||
),
|
||||
]
|
||||
|
||||
SUPPORTED_STATES = {description.key: description for description in NUMBER_DESCRIPTIONS}
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
|
@ -60,10 +62,6 @@ async def async_setup_entry(
|
|||
data: HomeAssistantOverkizData = hass.data[DOMAIN][entry.entry_id]
|
||||
entities: list[OverkizNumber] = []
|
||||
|
||||
key_supported_states = {
|
||||
description.key: description for description in NUMBER_DESCRIPTIONS
|
||||
}
|
||||
|
||||
for device in data.coordinator.data.values():
|
||||
if (
|
||||
device.widget in IGNORED_OVERKIZ_DEVICES
|
||||
|
@ -72,7 +70,7 @@ async def async_setup_entry(
|
|||
continue
|
||||
|
||||
for state in device.definition.states:
|
||||
if description := key_supported_states.get(state.qualified_name):
|
||||
if description := SUPPORTED_STATES.get(state.qualified_name):
|
||||
entities.append(
|
||||
OverkizNumber(
|
||||
device.device_url,
|
||||
|
|
|
@ -75,6 +75,8 @@ SELECT_DESCRIPTIONS: list[OverkizSelectDescription] = [
|
|||
),
|
||||
]
|
||||
|
||||
SUPPORTED_STATES = {description.key: description for description in SELECT_DESCRIPTIONS}
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
|
@ -85,10 +87,6 @@ async def async_setup_entry(
|
|||
data: HomeAssistantOverkizData = hass.data[DOMAIN][entry.entry_id]
|
||||
entities: list[OverkizSelect] = []
|
||||
|
||||
key_supported_states = {
|
||||
description.key: description for description in SELECT_DESCRIPTIONS
|
||||
}
|
||||
|
||||
for device in data.coordinator.data.values():
|
||||
if (
|
||||
device.widget in IGNORED_OVERKIZ_DEVICES
|
||||
|
@ -97,7 +95,7 @@ async def async_setup_entry(
|
|||
continue
|
||||
|
||||
for state in device.definition.states:
|
||||
if description := key_supported_states.get(state.qualified_name):
|
||||
if description := SUPPORTED_STATES.get(state.qualified_name):
|
||||
entities.append(
|
||||
OverkizSelect(
|
||||
device.device_url,
|
||||
|
|
|
@ -344,6 +344,8 @@ SENSOR_DESCRIPTIONS: list[OverkizSensorDescription] = [
|
|||
),
|
||||
]
|
||||
|
||||
SUPPORTED_STATES = {description.key: description for description in SENSOR_DESCRIPTIONS}
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
|
@ -354,10 +356,6 @@ async def async_setup_entry(
|
|||
data: HomeAssistantOverkizData = hass.data[DOMAIN][entry.entry_id]
|
||||
entities: list[SensorEntity] = []
|
||||
|
||||
key_supported_states = {
|
||||
description.key: description for description in SENSOR_DESCRIPTIONS
|
||||
}
|
||||
|
||||
for device in data.coordinator.data.values():
|
||||
if device.widget == UIWidget.HOMEKIT_STACK:
|
||||
entities.append(
|
||||
|
@ -374,7 +372,7 @@ async def async_setup_entry(
|
|||
continue
|
||||
|
||||
for state in device.definition.states:
|
||||
if description := key_supported_states.get(state.qualified_name):
|
||||
if description := SUPPORTED_STATES.get(state.qualified_name):
|
||||
entities.append(
|
||||
OverkizStateSensor(
|
||||
device.device_url,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue