示例#1
0
def duerPowerState(state):
    ''' '''

    BLINKER_LOG('need set power state: ', state)

    BlinkerDuerOS.powerState(state)
    BlinkerDuerOS.print()
示例#2
0
def duerRelativeBright(bright):
    ''' '''

    BLINKER_LOG('need set relative brightness: ', bright)

    BlinkerDuerOS.brightness(bright)
    BlinkerDuerOS.print()
示例#3
0
def duerColor(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

    BlinkerDuerOS.color(color)
    BlinkerDuerOS.print()
示例#4
0
def duerBright(bright):
    ''' '''

    BLINKER_LOG('need set brightness: ', bright)

    BlinkerDuerOS.brightness(bright)
    BlinkerDuerOS.print()
示例#5
0
def duerPowerState(state, num):
    ''' '''

    BLINKER_LOG("need set outlet: ", num, ", power state: ", state)

    BlinkerDuerOS.powerState(state, num)
    BlinkerDuerOS.print()
示例#6
0
def duerQuery(queryCode):
    ''' '''

    BLINKER_LOG('DuerOS Query codes: ', queryCode)

    if queryCode == BLINKER_CMD_QUERY_TIME_NUMBER:
        BLINKER_LOG("DuerOS Query time")
        BlinkerDuerOS.time(millis())
        BlinkerDuerOS.print()
    else:
        BlinkerDuerOS.time(millis())
        BlinkerDuerOS.print()
def duerPowerState(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

    BlinkerDuerOS.powerState(state, num)
    BlinkerDuerOS.print()
示例#8
0
def duercMode(cmode):
    ''' '''

    BLINKER_LOG('need cancel mode: ', cmode)

    # if mode == BLINKER_CMD_DUEROS_READING:
    #     # Your mode function
    # elif mode == BLINKER_CMD_DUEROS_SLEEP:
    #     # Your mode function
    # elif mode == BLINKER_CMD_DUEROS_ALARM:
    #     # Your mode function
    # elif mode == BLINKER_CMD_DUEROS_NIGHT_LIGHT:
    #     # Your mode function
    # elif mode == BLINKER_CMD_DUEROS_ROMANTIC:
    #     # Your mode function
    # elif mode == BLINKER_CMD_DUEROS_READING:
    #     # Your mode function

    BlinkerDuerOS.mode(cMode)
    BlinkerDuerOS.print()
示例#9
0
def duerQuery(queryCode, num):
    ''' '''

    BLINKER_LOG("DuerOS Query outlet: ", num, ", codes: ", queryCode)

    if queryCode == BLINKER_CMD_QUERY_ALL_NUMBER:
        BLINKER_LOG('DuerOS Query All')
        BlinkerDuerOS.powerState(wsState, num)
        BlinkerDuerOS.print()
    elif queryCode == BLINKER_CMD_QUERY_POWERSTATE_NUMBER:
        BlinkerDuerOS.powerState(wsState, num)
        BlinkerDuerOS.print()
    else:
        BlinkerDuerOS.powerState(wsState, num)
        BlinkerDuerOS.print()
示例#10
0
def duerQuery(queryCode, num):
    ''' '''

    BLINKER_LOG("DuerOS 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('DuerOS Query All')
        BlinkerDuerOS.powerState(state, num)
        BlinkerDuerOS.print()
    elif queryCode == BLINKER_CMD_QUERY_POWERSTATE_NUMBER:
        BlinkerDuerOS.powerState(state, num)
        BlinkerDuerOS.print()
    else:
        BlinkerDuerOS.powerState(state, num)
        BlinkerDuerOS.print()
示例#11
0
def duerQuery(queryCode):
    ''' '''

    BLINKER_LOG('DuerOS Query codes: ', queryCode)

    if queryCode == BLINKER_CMD_QUERY_AQI_NUMBER :
        BLINKER_LOG("DuerOS Query AQI")
        BlinkerDuerOS.aqi(20)
        BlinkerDuerOS.print()
    elif queryCode == BLINKER_CMD_QUERY_CO2_NUMBER :
        BLINKER_LOG("DuerOS Query CO2")
        BlinkerDuerOS.co2(20)
        BlinkerDuerOS.print()
    elif queryCode == BLINKER_CMD_QUERY_PM10_NUMBER :
        BLINKER_LOG("DuerOS Query CO2")
        BlinkerDuerOS.pm10(20)
        BlinkerDuerOS.print()
    elif queryCode == BLINKER_CMD_QUERY_PM25_NUMBER :
        BLINKER_LOG("DuerOS Query CO2")
        BlinkerDuerOS.pm25(20)
        BlinkerDuerOS.print()
    elif queryCode == BLINKER_CMD_QUERY_HUMI_NUMBER :
        BLINKER_LOG("DuerOS Query CO2")
        BlinkerDuerOS.humi(20)
        BlinkerDuerOS.print()
    elif queryCode == BLINKER_CMD_QUERY_TEMP_NUMBER :
        BLINKER_LOG("DuerOS Query CO2")
        BlinkerDuerOS.temp(20)
        BlinkerDuerOS.print()
    elif queryCode == BLINKER_CMD_QUERY_TIME_NUMBER :
        BLINKER_LOG("DuerOS Query CO2")
        BlinkerDuerOS.time(millis())
        BlinkerDuerOS.print()
    else :        
        BlinkerDuerOS.temp(20)
        BlinkerDuerOS.humi(20)
        BlinkerDuerOS.pm25(20)
        BlinkerDuerOS.print()