Use async_on_unload in Netatmo (#58461)

This commit is contained in:
Tobias Sauerwein 2021-10-26 13:43:54 +02:00 committed by GitHub
parent e9ba5f3b4b
commit ac4496b985
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 22 deletions

View file

@ -244,7 +244,7 @@ class NetatmoThermostat(NetatmoBase, ClimateEntity):
EVENT_TYPE_CANCEL_SET_POINT,
EVENT_TYPE_SCHEDULE,
):
self._listeners.append(
self.data_handler.config_entry.async_on_unload(
async_dispatcher_connect(
self.hass,
f"signal-{DOMAIN}-webhook-{event_type}",
@ -485,7 +485,7 @@ class NetatmoThermostat(NetatmoBase, ClimateEntity):
return
self._room_status = self._home_status.rooms.get(self._id)
self._room_data = self._data.rooms.get(self._home_id, {}).get(self._id)
self._room_data = self._data.rooms.get(self._home_id, {}).get(self._id, {})
if not self._room_status or not self._room_data:
if self._connected: