Clean up superfluous Netatmo API calls (#81095)

This commit is contained in:
Tobias Sauerwein 2022-10-27 20:42:16 +02:00 committed by GitHub
parent b490f47334
commit fa350b984a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

View file

@ -252,7 +252,7 @@ class NetatmoDataHandler:
self, signal_name: str, update_callback: CALLBACK_TYPE | None
) -> None:
"""Unsubscribe from publisher."""
if update_callback in self.publisher[signal_name].subscriptions:
if update_callback not in self.publisher[signal_name].subscriptions:
return
self.publisher[signal_name].subscriptions.remove(update_callback)
@ -288,6 +288,9 @@ class NetatmoDataHandler:
person.entity_id: person.pseudo for person in home.persons.values()
}
await self.unsubscribe(WEATHER, None)
await self.unsubscribe(AIR_CARE, None)
def setup_air_care(self) -> None:
"""Set up home coach/air care modules."""
for module in self.account.modules.values():