Skip to main content

python-openzwave-mqtt

Python library for the OpenZWave MQTT implementation.

Consumes MQTT output from https://github.com/OpenZWave/qt-openzwave

For Home Assistant integration, see the custom component homeassistant-zwave_mqtt.

Install

  • Python 3.7+ is required. We support the two latest Python 3 versions released at any one time.
pip install python-openzwave-mqtt

Structure

Each object maps to one or two parts in the topic. A topic can contain the following parts:

  • <Prefix>: the prefix of each topic. This is ignored in the processing. Usually openzwave/.
  • <CollectionType>/<CollectionID>: The collection type and the ID of the item in the collection. Example: value/3
  • <CollectionID>: Some objects will have a direct collection that is not typed in the topic. Example is the OZW instance in <Prefix>/1
  • <ObjectType>: If there is only a single instance of a type under a parent. For example node/2/statistics.

Example

A message is sent to topic openzwave/1/node/2/statistics. This maps to:

Type ID
Prefix -
OZWInstance 1
OZWNode 2
OZWNodeStatistics -

Message ordering

We work with signals to signal listeners when things change. However, when we connect to MQTT we will receive a lot of retained messages at once. To prevent signals being sent out of order, we will hold all messages for children until the parent has received its information.

This has been disabled for OZWManager and OZWInstance.

If we receive messages on the following topics:

  1. openzwave/1/node/2/statistics
  2. openzwave/1/node/2

We will process the messages in the reverse order:

  1. openzwave/1/node/2
  2. openzwave/1/node/2/statistics

Modelling Rules

This library should not aim to do fancy things. We should, as much as possible, represent the data from MQTT as-is. We don't want to change names besides making them Pythonic (CamelCase -> snake_case).

Automatic added helpers

Models will have automatic helpers added based on their child models. For example, the Node model has the following child collections:

    def create_collections(self):
        """Create collections that Node supports."""
        return {
            # A collection of children
            "instance": ItemCollection(OZWNodeInstance),
            # A single child
            "statistics": OZWNodeStatistics,
        }

This means that Node has the following automatic functions created:

  • get_instance(item_id) to get an instance by ID.
  • instances() to get an iterator over all available instances.
  • get_statistics() get the direct child.

Gathering Data

This library is instantiated using messages received from MQTT. To make development easier, we have created two helper scripts. One that will dump all MQTT messages and one that will read messages from a text file and instantiate an OZWManager with all the data. This can be used to develop, test or reproduce bugs.

python3 -m script.dump_mqtt > dump.csv
python3 -m script.instance_from_file dump.csv

Development

  • Install all requirements:

    pip install -r requirements_dev.txt
    
  • We use black to format the code:

    black ./
    
  • Use tox to run tests and linting:

    tox
    

Metadata

Release files for python-openzwave-mqtt 1.0.3

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

Source distribution (sdist)

Source distribution for python-openzwave-mqtt 1.0.3
File Size Uploaded Provenance Actions
python-openzwave-mqtt-1.0.3.tar.gz 18.9 kB Without provenance Details for python-openzwave-mqtt-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-openzwave-mqtt 1.0.3
File Interpreter ABI Platform Actions
python_openzwave_mqtt-1.0.3-py3-none-any.whl Python 3 none any Details for python_openzwave_mqtt-1.0.3-py3-none-any.whl

Total release size: 44.1 kB

Release files / python-openzwave-mqtt-1.0.3.tar.gz

Download URL python-openzwave-mqtt-1.0.3.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1e9e7e1ff72896a627404f49a31d072e37a477bd8bd424c702b04b82d863e5e2
BLAKE2b-256 checksum
How to use checksums
5bae93d12a5fa14e50804d0cd9d113dd040d2f7c7c134d9c00c5d54b4fe9e103
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release files / python_openzwave_mqtt-1.0.3-py3-none-any.whl

Download URL python_openzwave_mqtt-1.0.3-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c441466a1a1ddc719b8bdfabe70fb5818d9df7c8964e187be81869c3cbd9f564
BLAKE2b-256 checksum
How to use checksums
f324d47abd5e7e2c97bff6f78dd628db3b09478874fb2b2fdeacce6f9544201d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Security for python-openzwave-mqtt 1.0.3

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