Tweak Meater typing and variable naming (#71333)

pull/71343/head
Erik Montnemery 2022-05-05 11:24:43 +02:00 committed by GitHub
parent e145d3c65b
commit 22d2587593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -136,9 +136,9 @@ async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up the entry."""
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
"coordinator"
]
coordinator: DataUpdateCoordinator[dict[str, MeaterProbe]] = hass.data[DOMAIN][
entry.entry_id
]["coordinator"]
@callback
def async_update_data():
@ -146,22 +146,22 @@ async def async_setup_entry(
if not coordinator.last_update_success:
return
devices: dict[str, MeaterProbe] = coordinator.data
devices = coordinator.data
entities = []
known_probes: set = hass.data[DOMAIN]["known_probes"]
# Add entities for temperature probes which we've not yet seen
for dev in devices:
if dev in known_probes:
for device_id in devices:
if device_id in known_probes:
continue
entities.extend(
[
MeaterProbeTemperature(coordinator, dev, sensor_description)
MeaterProbeTemperature(coordinator, device_id, sensor_description)
for sensor_description in SENSOR_TYPES
]
)
known_probes.add(dev)
known_probes.add(device_id)
async_add_entities(entities)