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): ''' ''' 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): ''' ''' 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()
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()