Skip to main content

This package provides a command line interface to the EMQx LwM2M plugin.

It supports read, discover, write, write-attr, execute, create, delete. It also has some handy features for tracking notifications, etc.

NOTE: This package is in beta stage and backwards incompatible changes may be added in the releases prior to version 1.0.0.

Usage and command line options

usage: python3 -m emqxlwm2m [--host HOST] [--port PORT]
                            [-l {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                            [--timeout SEC] [--xml-path DIR]
                            [--ep-active EP_ACTIVE] [--ep-known EP_KNOWN]
                            [--ep-prefix EP_PREFIX] [--startup-script PATH]
                            [command]

positional arguments:
  command               Select command: cmd, discover, read, write,
                        write_attr, execute, create, delete, observe,
                        cancel_observe, wiretap, uplink, downlink, requests,
                        responses, events, registrations, updates,
                        notifications, commands, discoverall, reboot, update,
                        firmware_update. Use with --help to see command
                        arguments.

optional arguments:
  --host HOST           EMQx MQTT broker host (default: localhost)
  --port PORT, -p PORT  EMQx MQTT port (default: 1883)
  -l {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Logging level (default: INFO)
  --timeout SEC, -t SEC
                        Timeout when waiting for response in seconds (default:
                        60)
  --xml-path XML_PATH, -x XML_PATH
                        Directory containing LwM2M object definition XML-
                        files. Can be used multiple times to provide multiple
                        paths. Used when selecting a path interactively.
  --ep-active EP_ACTIVE
                        Default endpoint in interactive mode (subcommand
                        "cmd")
  --ep-known EP_KNOWN   Path to a text file listing known endpoints. Used for
                        interactive selection when endpoint is not specified
                        in command.
  --ep-prefix EP_PREFIX
                        Ensure endpoints starts with prefix.
  --startup-script PATH
                        Execute initialization commands from a script.

Installation

From PyPI:

$ python3 -m pip install emqxlwm2m

Examples

Read: Read hardware version resource:

$ python3 -m emqxlwm2m --host localhost --port 1883 read urn:imei:123456789012345 /3/0/18
{'/3/0/18': '1.2.3'}

Write: Set the lifetime resource to 60 seconds:

$ python3 -m emqxlwm2m write urn:imei:123456789012345 /1/0/1=60

Execute: Execute the reboot resource:

$ python3 -m emqxlwm2m execute urn:imei:123456789012345 /3/0/4

Write-attr: Set attributes (syntax: [pmin,pmax]lt:st:gt) on battery level resource:

$ python3 -m emqxlwm2m attr urn:imei:123456789012345 /3/0/9=[60,120]5:10:95

Attributes can be omitted. To only set pmax to 100 seconds:

$ python3 -m emqxlwm2m attr urn:imei:123456789012345 /3/0/9=[,100]

Discover: Discover instances/resources and their attributs, for example, the battery level attribute previously set:

$ python3 -m emqxlwm2m discover urn:imei:123456789012345 /3/0/9
{'/3/0/9': {'pmax': '100', 'gt': '95', 'lt': '5', 'st': '10', 'pmin': '60'}}

Observe: Observe battery level resource:

$ python3 -m emqxlwm2m observe urn:imei:123456789012345 /3/0/9

Cancel-Observe: Cancel observe on battery level resource:

$ python3 -m emqxlwm2m cancel-observe urn:imei:123456789012345 /3/0/9

Metadata

Release files for emqxlwm2m 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emqxlwm2m 0.6.0
File Size Uploaded Provenance Actions
emqxlwm2m-0.6.0.tar.gz 52.2 kB Without provenance Details for emqxlwm2m-0.6.0.tar.gz

Release files / emqxlwm2m-0.6.0.tar.gz

Download URL emqxlwm2m-0.6.0.tar.gz
Size 52.2 kB
Tags Source
SHA-256 checksum
How to use checksums
627c7fccb2cd0e8f04786d231c8c4a11ab244573ad5ff8c01f345dc05fe9e8fc
BLAKE2b-256 checksum
How to use checksums
ab28e23b025dff7902d9be66a3e738e433db9e0e41857c455e9a07220a616ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Security for emqxlwm2m 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page