def refresh_thermostats_from_db(self): # type: () -> None for thermostat in Thermostat.select(): thermostat_pid = self.thermostat_pids.get(thermostat.number) if thermostat_pid is None: thermostat_pid = ThermostatPid(thermostat, self._pump_valve_controller) thermostat_pid.subscribe_state_changes( self._thermostat_changed) self.thermostat_pids[thermostat.number] = thermostat_pid thermostat_pid.update_thermostat(thermostat) thermostat_pid.tick()
def load_cooling_thermostats(self): # type: () -> List[ThermostatDTO] return [ ThermostatMapper.orm_to_dto(thermostat, 'cooling') for thermostat in Thermostat.select() ]