DSMR: Complete full strictly typed (#52162)

This commit is contained in:
Franck Nijhof 2021-06-24 20:27:25 +02:00 committed by GitHub
parent fba7118d44
commit a2be9a487f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 5 deletions

View file

@ -89,7 +89,7 @@ async def async_setup_entry(
)
@Throttle(min_time_between_updates)
def update_entities_telegram(telegram: dict[str, DSMRObject]):
def update_entities_telegram(telegram: dict[str, DSMRObject]) -> None:
"""Update entities with latest telegram and trigger state update."""
# Make all device entities aware of new telegram
for entity in entities:
@ -222,7 +222,8 @@ class DSMREntity(SensorEntity):
# Get the attribute value if the object has it
dsmr_object = self.telegram[self._sensor.obis_reference]
return getattr(dsmr_object, attribute, None)
attr: str | None = getattr(dsmr_object, attribute)
return attr
@property
def state(self) -> StateType: