temperature_store: remove stale temperature sensors from the "last_temps" dict

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-08-02 07:29:23 -04:00
parent 4191aac63f
commit d768a30d47
1 changed files with 4 additions and 0 deletions

View File

@ -63,6 +63,10 @@ class TemperatureStore:
'temperatures': deque(maxlen=TEMPERATURE_STORE_SIZE),
'targets': deque(maxlen=TEMPERATURE_STORE_SIZE)}
self.temperature_store = new_store
# Prune unconfigured sensors in self.last_temps
for sensor in list(self.last_temps.keys()):
if sensor not in self.temperature_store:
del self.last_temps[sensor]
self.temp_update_cb.start()
else:
logging.info("No sensors found")