def miotBright(bright): ''' ''' BLINKER_LOG('need set brightness: ', bright) BlinkerMIOT.brightness(bright) BlinkerMIOT.print()
def miotColor(color): ''' ''' BLINKER_LOG('need set color: ', color) # if color == 0xFF0000: # 'Red': # # your codes # elif color == 0xFFFF00: # 'Yellow': # # your codes # elif color == 0x0000FF: # 'Blue': # # your codes # elif color == 0x00FF00: # 'Green': # # your codes # elif color == 0xFFFFFF: # 'White': # # your codes # elif color == 0x000000: # 'Black': # # your codes # elif color == 0x00FFFF: # 'Cyan': # # your codes # elif color == 0x800080: # 'Purple': # # your codes # elif color == 0xFFA500: # 'Orange': # # your codes BlinkerMIOT.color(color) BlinkerMIOT.print()
def miotPowerState(state): ''' ''' BLINKER_LOG('need set power state: ', state) BlinkerMIOT.powerState(state) BlinkerMIOT.print()
def miotPowerState(state): ''' ''' global oState BLINKER_LOG('need set power state: ', state) oState = state BlinkerMIOT.powerState(state) BlinkerMIOT.print()
def miotPowerState(state): global oState BLINKER_LOG('need set power state: ', state) oState = state BlinkerMIOT.powerState(state) BlinkerMIOT.print() # 给小爱反馈设备受控状态 if oState == 'true': button.text('已开机') # 更新文本 wake_up() elif oState == 'false': button.text('已关机') shut_down() button.print() # 更新数据到云端
def miotPowerState(state, num): ''' ''' BLINKER_LOG("need set outlet: ", num, ", power state: ", state) global wsState wsState[num] = state if num == 0 and state == 'false': for i in len(wsState): wsState[i] = state BlinkerMIOT.powerState(state, num) BlinkerMIOT.print()
def miotPowerState(state): global oState global counter BLINKER_LOG('need set power state: ', state) oState = state BlinkerMIOT.powerState(state) BlinkerMIOT.print() if state == 'true': os.system("ping -c 4 www.bing.com") # 使用系统命令ping www.bing.com counter += 2 # counter + 2 elif state == 'false': os.system("ping -c 1 www.bing.com") # 使用系统命令ping www.bing.com counter -= 1 # counter + 2 button1.text(state) # 设置按钮文字 button1.print(state) # 发送数据,调整button1 number1.print(counter) # 发送数据,调整number1
def miotQuery(queryCode): ''' ''' BLINKER_LOG('MIOT Query codes: ', queryCode) if queryCode == BLINKER_CMD_QUERY_ALL_NUMBER: BLINKER_LOG('MIOT Query All') BlinkerMIOT.temp(20) BlinkerMIOT.humi(20) BlinkerMIOT.pm25(20) BlinkerMIOT.print() else: BlinkerMIOT.temp(20) BlinkerMIOT.humi(20) BlinkerMIOT.pm25(20) BlinkerMIOT.print()
def miotMode(mode): ''' ''' BLINKER_LOG('need set mode: ', mode) # if mode == BLINKER_CMD_MIOT_READING: # # Your mode function # elif mode == BLINKER_CMD_MIOT_SLEEP: # # Your mode function # elif mode == BLINKER_CMD_MIOT_ALARM: # # Your mode function # elif mode == BLINKER_CMD_MIOT_NIGHT_LIGHT: # # Your mode function # elif mode == BLINKER_CMD_MIOT_ROMANTIC: # # Your mode function # elif mode == BLINKER_CMD_MIOT_READING: # # Your mode function BlinkerMIOT.mode(mode) BlinkerMIOT.print()
def miotQuery(queryCode): ''' ''' global oState BLINKER_LOG('MIOT Query codes: ', queryCode) if queryCode == BLINKER_CMD_QUERY_ALL_NUMBER: BLINKER_LOG('MIOT Query All') BlinkerMIOT.powerState(oState) BlinkerMIOT.print() elif queryCode == BLINKER_CMD_QUERY_POWERSTATE_NUMBER: BLINKER_LOG('MIOT Query Power State') BlinkerMIOT.powerState(oState) BlinkerMIOT.print() else: BlinkerMIOT.powerState(oState) BlinkerMIOT.print()
def miotQuery(queryCode, num): ''' ''' BLINKER_LOG("MIOT Query outlet: ", num,", codes: ", queryCode) global wsState state = 'off' for i, val in enumerate(wsState) : if i == num : state = val if queryCode == BLINKER_CMD_QUERY_ALL_NUMBER : BLINKER_LOG('MIOT Query All') BlinkerMIOT.powerState(state, num) BlinkerMIOT.print() elif queryCode == BLINKER_CMD_QUERY_POWERSTATE_NUMBER : BlinkerMIOT.powerState(state, num) BlinkerMIOT.print() else : BlinkerMIOT.powerState(state, num) BlinkerMIOT.print()
def miotQuery(queryCode): global oState BLINKER_LOG('MIOT Query codes: ', queryCode) BlinkerMIOT.powerState(oState) BlinkerMIOT.print()
def miotQuery(queryCode): ''' ''' BLINKER_LOG('MIOT Query codes: ', queryCode) if queryCode == BLINKER_CMD_QUERY_ALL_NUMBER: BLINKER_LOG('MIOT Query All') BlinkerMIOT.powerState(wsState) BlinkerMIOT.color(getColor()) BlinkerMIOT.mode(wsMode) BlinkerMIOT.colorTemp(50) BlinkerMIOT.brightness(100) BlinkerMIOT.print() elif queryCode == BLINKER_CMD_QUERY_POWERSTATE_NUMBER: BLINKER_LOG('MIOT Query Power State') BlinkerMIOT.powerState(wsState) BlinkerMIOT.print() elif queryCode == BLINKER_CMD_QUERY_COLOR_NUMBER: BLINKER_LOG('MIOT Query Color') BlinkerMIOT.color('red') BlinkerMIOT.print() elif queryCode == BLINKER_CMD_QUERY_MODE_NUMBER: BLINKER_LOG('MIOT Query Mode') BlinkerMIOT.mode(wsMode) BlinkerMIOT.print() elif queryCode == BLINKER_CMD_QUERY_COLORTEMP_NUMBER: BLINKER_LOG('MIOT Query ColorTemperature') BlinkerMIOT.colorTemp(50) BlinkerMIOT.print() elif queryCode == BLINKER_CMD_QUERY_BRIGHTNESS_NUMBER: BLINKER_LOG('MIOT Query Brightness') BlinkerMIOT.brightness(100) BlinkerMIOT.print() else: BlinkerMIOT.powerState(wsState) BlinkerMIOT.color('red') BlinkerMIOT.mode(wsMode) BlinkerMIOT.colorTemp(50) BlinkerMIOT.brightness(100) BlinkerMIOT.print()