Unsubscribe from listeners when removing integration sensor (#69235)

This commit is contained in:
Erik Montnemery 2022-04-04 11:09:38 +02:00 committed by GitHub
parent f98b3e44de
commit c79b361927
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -253,8 +253,10 @@ class IntegrationSensor(RestoreEntity, SensorEntity):
self._state = integral
self.async_write_ha_state()
async_track_state_change_event(
self.hass, [self._sensor_source_id], calc_integration
self.async_on_remove(
async_track_state_change_event(
self.hass, [self._sensor_source_id], calc_integration
)
)
@property