Skip to main content

pynhc2

version = 0.1.4

Lightweight Python wrapper library to interact with Niko Home Control 2 systems built on top of paho-mqtt. Includes functionality to read NHC2 config files for better device readability. The library is primary built for home use.

PyPI version Python 3.12+ Documentation Status License: MIT

Installation

pip install pynhc2

Quick Start

from pynhc2 import MQTTConnector, Lamp

# Connect to Niko Home Control
conn = MQTTConnector(
    broker="192.168.1.10",
    jwt="your-jwt-token",
    ca_cert="path/to/ca.pem"
)
conn.connect()

# Control a lamp
lamp = Lamp(mqttconnector=conn, device_uuid="lamp-uuid")
lamp.switch_on()
lamp.set_brightness("75")

Documentation

The Device and Lamp classes are used to easily control individual devices. Using the NHC2FileReader, it is possible to loop through all devices in your home installation and create Device or Lamp objects that are easily human readable.

The MessageHandler and MultiMessageHandler make it possible to use incoming messages for specific devices to trigger certain output actions; this can be methods for existing Device or Lamp objects, but also actions that have nothing to do with NHC, allowing devices like Shelly to be controlled through NHC.

Under the hobby/control/devices/evt topic, the NHC Connected Controller - which also acts as MQTT message broker - does not publish events for button-type devices (e.g. 'button pressed') but it does this for the devices these buttons command (e.g. "Properties":[{"Status":"Off"}, {"Brightness": "50"}] when a button connected to a lamp is pressed).

The MessageHandler and MultiMessageHandler circumvent this setup by using the devices whose properties have changed to trigger the actions.

Full documentation is available at ReadTheDocs.

Changelog

See CHANGELOG.md for version history.

License

MIT License - see LICENSE file for details.

Metadata

Release files for pynhc2 0.1.4

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

Source distribution (sdist)

Source distribution for pynhc2 0.1.4
File Size Uploaded Provenance Actions
pynhc2-0.1.4.tar.gz 19.7 kB Without provenance Details for pynhc2-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pynhc2 0.1.4
File Interpreter ABI Platform Actions
pynhc2-0.1.4-py3-none-any.whl Python 3 none any Details for pynhc2-0.1.4-py3-none-any.whl

Total release size: 32.9 kB

Release files / pynhc2-0.1.4.tar.gz

Download URL pynhc2-0.1.4.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b89d386b4b4f30ff13762eff081f3f0a0d256c350bce9f009d8a9d043e419f95
BLAKE2b-256 checksum
How to use checksums
8a387a0cef6c11f75848aff3afb41f16b44361518536207876fa1be9841ac324
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / pynhc2-0.1.4-py3-none-any.whl

Download URL pynhc2-0.1.4-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b82c7a28dbec2e9a2247cbd33fefb5a67e4c549441592dcd79ee51258f6a5ebe
BLAKE2b-256 checksum
How to use checksums
deb7372528fdd6ff0b726338fdaab0c5408dd890bd35ae97f6307be11e0b2c03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for pynhc2 0.1.4

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