def get_sample(self): if random_value(0, 10) < 1: self._count += 1 if random_value(0, 2) < 1 else -1 self._count = min(self._count, 9) self._count = max(self._count, 0) self._pilots.append((common.timestamp(), self._count)) pilots = self._pilots self._pilots = [] return 'pilots', pilots
def get_sample(self): nwtype = int(random_value(3, 6)) if nwtype == 5: nwtype = 7 sample = { 'nwtype': huawei_status.HuaweiStatus._NW_TYPES[nwtype], 'strength': random_value(65, 85), 'upload': self._upload_mb * 1024 * 1024, 'download': self._download_mb * 1024 * 1024, 'ts': common.timestamp()} self._upload_mb += 1 self._download_mb += 1 return 'link', sample
def get_sample(self): nwtype = int(random_value(3, 6)) if nwtype == 5: nwtype = 7 sample = { 'nwtype': huawei_status.HuaweiStatus._NW_TYPES[nwtype], 'strength': random_value(65, 85), 'upload': self._upload_mb * 1024 * 1024, 'download': self._download_mb * 1024 * 1024, 'ts': common.timestamp() } self._upload_mb += 1 self._download_mb += 1 return 'link', sample
def get_sample(self): if random_value(0, 10) < 1: self._door_open = 1 - self._door_open self._events.append((common.timestamp(), self._door_open)) events = self._events self._events = [] return 'door', events
def get_sample(self): now_ts = common.timestamp() self._avg = max(0, random_value(-2, 10)) maxKmh = self._avg + random.random() * self._avg mean_ts = (now_ts + self._last_ts) / 2 wind = { 'avg': self._avg, 'max': maxKmh, 'max_ts': mean_ts, 'hist': {int(self._avg): 1}, 'start_ts': self._last_ts, 'end_ts': now_ts} self._last_ts = now_ts return 'wind', wind
def get_sample(self): now_ts = common.timestamp() self._avg = max(0, random_value(-2, 10)) maxKmh = self._avg + random.random() * self._avg mean_ts = (now_ts + self._last_ts) / 2 wind = { 'avg': self._avg, 'max': maxKmh, 'max_ts': mean_ts, 'hist': { int(self._avg): 1 }, 'start_ts': self._last_ts, 'end_ts': now_ts } self._last_ts = now_ts return 'wind', wind
def get_sample(self): return 'rain', (common.timestamp(), random_value(0, 100))
def get_sample(self): return 'temp_hum', (common.timestamp(), random_value(-5, 15), random_value(40, 80))
def get_sample(self): return 'vane', (common.timestamp(), random_value(0, 360))
def get_sample(self): return 'press', (common.timestamp(), random_value(900, 1100))
def __init__(self): self._door_open = int(random_value(0, 2)) self._events = [(common.timestamp(), self._door_open)]
def get_sample(self): sample = {} for c in self._channels: sample[c] = (common.timestamp(), random_value(10, 15)) return 'adc', sample
def get_sample(self): return 'temp_hum', (common.timestamp(), random_value(-5, 15), random_value(40, 80))