code: def stop(self):
          
          self._stop_event.set()
          if not self.persistence:
              return
          if self._cancel_save is not None:
              self._cancel_save()
              self._cancel_save = None
          self.persistence.save_sensors()
docs: Stop the background thread.