EasyManuals Logo

Digi Connect IT 16 User Manual

Digi Connect IT 16
756 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 #479 background imageLoading...
Page #479 background image
Applications Use the Paho MQTTpython library
Digi Connect IT® 16/48 User Guide
479
3. At the shell prompt, use the python command with no parameters to enter an interactive
Python session:
# python
Python 3.6.12 (default, Jan 11 2021, 10:25:21)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
4. Import the serial module:
>>> import serial
>>>
5. You can now perform operations on the serial port. For example, to write a message to the
serial port:
>>> s = serial.Serial("/dev/serial/USB_port1", 115200)
>>> s.write(b"Hello from USBserial port")
26
>>>
6. Use Ctrl-D to exit the Python session. You can also exit the session using exit() or quit().
Use the Paho MQTTpython library
Your Connect IT 16/48 device includes support for the Paho MQTT python library. MQTTis a
lightweight messaging protocol used to communicate with various applications including cloud-based
applications such as Amazon Web Services and Microsoft Azure. The following is example code that
reads some data from updates the device firmware, then publishes information about DHCP clients
and system information to the MQTTserver.
"""
MQTT client example:
- Reporting some device metrics from runt
- Reporting DHCP clients
- Firmware update feature (simple implementation, read TODO in cmd_fwupdate)
"""
import sys
import time
import paho.mqtt.client as mqtt
import json
from acl import runt, config
from http import HTTPStatus
import urllib.request
import tempfile
import os
from digidevice import cli
POLL_TIME = 60
def cmd_reboot(params):
print("Rebooting unit...")
try:

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Digi Connect IT 16 and is the answer not in the manual?

Digi Connect IT 16 Specifications

General IconGeneral
BrandDigi
ModelConnect IT 16
CategoryServer
LanguageEnglish

Related product manuals