Services and applications Python
Digi TransPort WR Routers User Guide
156
Python 3.5.3
>>> from digidevice import cli
>>> import json
>>>
>>> response = cli.execute(“show system -fjson”)
>>> resp = json.loads(response)
>>> resp
{'cpu-max': '99', 'firmware-version': '4.3.0.52 06/28/2018 14:54:33', 'contact':
'', 'part-number': 'LR54-AW403',
'bootloader-version': '1.1.3 (Jun 20 2018 - 20:48:44)', 'temperature': '30.75 C',
'serial-number': 'LR000130',
'model': 'LR54W-FIPS', 'config-file': 'config.da0', 'cpu-usage': '3', 'hardware-
version': '50001899-03 1P',
'system-time': '16 July 2018, 06:28:59', 'cpu-avg': '1', 'bank': '1',
'description': "", 'location': '',
'cpu-min': '0', 'uptime': '3 Days, 11 Hours, 16 Minutes, 50 Seconds'}
>>>
>>> print (resp[“model”])
LR54W-FIPS
>>>
The digidevice datapoint submodule
Use the datapoint submodule to upload custom datapoints to Digi Remote Manager (DRM).
The following characteristics can be defined for a datapoint:
n Stream ID
n Value
n (Optional) Data type
l integer
l long
l float
l double
l string
l binary
n Units (optional)
n Timestamp (optional)
n Location (optional)
l Tuple of latitude, longitude and altitude
n Description (optional)
n Quality (optional)
l An integer describing the quality of the data point
digi.router> python
Python 3.5.3
>>> from digidevice import datapoint
>>> import time
>>>
>>> datapoint.upload(“Velocity”, 69, units=”mph”, data_type=”integer”)
>>> datapoint.upload(“Temperature”, 24, geo_location=(54.409469, -1.718836, 129)