Address late feedback to Overkiz (move to constants) (#64324)

This commit is contained in:
Mick Vleeshouwer 2022-01-17 12:25:24 -08:00 committed by GitHub
parent 728b587933
commit 05c177e3ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 25 deletions

View file

@ -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,