def __init__(self): IotDevice.__init__(self) IotDevice.set_light(self, 2.4) IotDevice.set_humidity(self, 30.0) IotDevice.set_moisture(self, 4.0) IotDevice.set_temperature(self, 71.1) # spawn a task to update our data __update_task = asyncio.create_task(self.update_loop())
def update_data(self): IotDevice.set_light(self, random.random() * 10.0) IotDevice.set_moisture(self, random.random() * 10.0) IotDevice.set_humidity(self, random.random() * 100.0) IotDevice.set_temperature(self, 40.0 + random.random() * 40.0)