EasyManuals Logo

Digi IX10 User Manual

Digi IX10
996 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #651 background imageLoading...
Page #651 background image
Applications Use Python to control the color of multi-colored LEDs
IX10 User Guide
651
else:
print("Invalid command path ({}), cannot send reply".format(cmd_path))
return
reply = {
"cmd": cmd,
"status": status
}
client.publish(PREFIX_RSP + path + "/" + cid, json.dumps(reply, separators=
(',',':')))
def on_connect(client, userdata, flags, rc):
print("Connected to MQTT server")
client.subscribe(PREFIX_CMD + "/system")
def on_message(client, userdata, msg):
""" Supporting only a single topic for now, no need for filters
Expects the following message format:
{
"cid": "<client-id>",
"cmd": "<command>",
"params": {
<optional_parameters>
}
}
Supported commands:
- "fw-update"
params:
- "uri": "<firmware_file_URL>"
- "reboot"
params:
"""
try:
m = json.loads(msg.payload)
cid = m["cid"]
cmd = m["cmd"]
try:
payload = m["params"]
except:
payload = None
except:
print("Invalid command format: {}".format(msg.payload))
if not cid:
# Return if client-ID not passed
return None
send_cmd_reply(client, msg.topic, cid, cmd, HTTPStatus.BAD_REQUEST)
try:
status = CMD_HANDLERS[cmd](payload)
except:
print("Invalid command: {}".format(cmd))
status = HTTPStatus.NOT_IMPLEMENTED
send_cmd_reply(client, msg.topic, cid, cmd, status)
def publish_dhcp_leases():

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Digi IX10 and is the answer not in the manual?

Digi IX10 Specifications

General IconGeneral
BrandDigi
ModelIX10
CategoryNetwork Router
LanguageEnglish

Related product manuals