from machine import Pin # 设备类型 model = '01001' # 版本 version = 1.0 led = Pin(4, Pin.OUT) def command(com): """ 执行命令 """ if com == 'on': led.on() elif com == 'off': led.off() def status(): """ 上报状态 """ return { 'status': led.value() == 1 }