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
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
def get_node_id(): log.debug("cmd > get_node_id()") mesh.command("get_node_id", []) loop(2) return
def get_channel(): log.debug("cmd > get_channel()") mesh.command("get_channel", []) loop(2) return
def set_channel(chan): log.debug("cmd > set_channel: %d", chan) mesh.command("set_channel", [chan]) loop(2) return