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 Franck Nijhof
parent a3ad44f7b6
commit 9ec9dc047b

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