コード例 #1
0
async def turn_valve_on_handler(iot_device: IotDevice, values):
    iot_device.cancel_timer()
    if values and type(values) == int:
        duration = values
        print("Turning device on for {0} secs".format(duration))
        _auto_shutoff_timer(iot_device, duration)
    else:
        print("Turning device on.")
    iot_device.turn_valve_on()
コード例 #2
0
def _auto_shutoff_handlers(iot_device: IotDevice):
    iot_device.cancel_timer()
    print("Auto shutoff, turning device off..")
    iot_device.turn_valve_off()
コード例 #3
0
async def turn_valve_off_handler(iot_device: IotDevice, values):
    iot_device.cancel_timer()
    print("Turning device off.")
    iot_device.turn_valve_off()