Esempio n. 1
0
def get_node_id():
    global this_node_id
    this_node_id = 0
    log.debug("cmd > get_node_id()")
    mesh.command("get_node_id",[])
    loop(5)
    return this_node_id
Esempio n. 2
0
def execute_command(cmd, params):
    try:
        if (cmd == "set_node_id"):
            mesh.command(cmd, [int(params["node_id"])])
        elif (cmd == "get_node_id"):
            mesh.command(cmd)
        elif (cmd == "set_channel"):
            mesh.command(cmd, [int(params["channel"])])
        elif (cmd == "get_channel"):
            mesh.command(cmd)
        elif (cmd == "set_tx_power"):
            mesh.command(cmd, [int(params["tx_power"])])
        elif (cmd == "get_tx_power"):
            mesh.command(cmd)
        else:
            return False
    except KeyError:
        log.error("mqtt_req > KeyError Exception for %s", cmd)
    return True
Esempio n. 3
0
def get_node_id():
    log.debug("cmd > get_node_id()")
    mesh.command("get_node_id", [])
    loop(2)
    return
Esempio n. 4
0
def get_channel():
    log.debug("cmd > get_channel()")
    mesh.command("get_channel", [])
    loop(2)
    return
Esempio n. 5
0
def set_channel(chan):
    log.debug("cmd > set_channel: %d", chan)
    mesh.command("set_channel", [chan])
    loop(2)
    return