# -*- coding: utf-8 -*-
#
# lhq@python279.org

import pytz
import random
import time
from BaseAirMonitor import BaseAirMonitor


class Simulator(BaseAirMonitor):
    def __init__(self):
        BaseAirMonitor.__init__(self)

    def __del__(self):
        BaseAirMonitor.__del__(self)

    def get_data(self):
        random.seed(time.time())
        sample_readable = {
            'timestamp': int(time.time()),
            'pm1.0': random.randint(30, 100),
            'pm2.5': random.randint(30, 100),
            'pm10': random.randint(30, 100),
            'temperature': random.randint(1, 50),
            'humidity': random.randint(10, 90),
        }
        return sample_readable


if __name__ == '__main__':
    timezone = pytz.timezone('Asia/Shanghai')

    def every_minute(self):
        data = self.get_data()
        print data

    sensor = Simulator()
    sensor.every_minute_job(every_minute)
    while True:
        time.sleep(10)

b982d928a0711cabf2d4235e6d859386068dc80e
# -*- coding: utf-8 -*-
#
# lhq@python279.org

import pytz
import random
import time
from BaseAirMonitor import BaseAirMonitor


class Simulator(BaseAirMonitor):
    def __init__(self):
        BaseAirMonitor.__init__(self)

    def __del__(self):
        BaseAirMonitor.__del__(self)

    def get_data(self):
        random.seed(time.time())
        sample_readable = {
            'timestamp': int(time.time()),
            'pm1.0': random.randint(30, 100),
            'pm2.5': random.randint(30, 100),
            'pm10': random.randint(30, 100),
            'temperature': random.randint(1, 50),
            'humidity': random.randint(10, 90),
        }
        return sample_readable


if __name__ == '__main__':
    timezone = pytz.timezone('Asia/Shanghai')

    def every_minute(self):
        data = self.get_data()
        print data

    sensor = Simulator()
    sensor.every_minute_job(every_minute)
    while True:
        time.sleep(10)
