Python library for SystemNexa2 device integration
Project description
python-sn2
Python library for SystemNexa2 device integration.
This package provides a client library for communicating with SystemNexa2 smart home devices over WebSocket and REST APIs. It supports device discovery, real-time state updates, brightness control, and configuration management.
Supported Devices
- Switches: WBR-01
- Plugs: WPR-01, WPO-01
- Lights: WBD-01, WPD-01
Key Features
- Asynchronous communication via WebSocket and REST
- Real-time device state updates
- Brightness control for dimmable devices
- Device settings management (433MHz, LED, DIY mode, etc.)
- Automatic reconnection handling
- Error handling and logging
Installation
pip install python-sn2
Usage
"""Example usage of the python-sn2 library."""
import asyncio
import logging
from sn2.device import Device
logger = logging.getLogger(__name__)
async def main() -> None:
"""Demonstrate device usage."""
# Create a device instance
device = await Device.initiate_device(host="192.168.1.144")
# Connect to the device
await device.connect()
# Set brightness
await device.set_brightness(0.75)
# Get device information
info = await device.get_info()
logger.info("Device: %s", info.information.name)
# Disconnect
await device.disconnect()
await device.close()
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
asyncio.run(main())
Development
This project uses uv for dependency management.
Setup the development environment:
./scripts/test-setup
Or manually:
# Create virtual environment and install package
uv venv
uv pip install -e ".[dev]"
Run tests:
uv run pytest
Run linting:
uv run ruff check .
uv run ruff format .
Release Process
This project uses automated versioning and releases. To create a new release:
Automated (Recommended)
# Bump patch version (0.1.0 -> 0.1.1)
./scripts/release.sh patch
# Bump minor version (0.1.0 -> 0.2.0)
./scripts/release.sh minor
# Bump major version (0.1.0 -> 1.0.0)
./scripts/release.sh major
This will:
- Run tests and linting
- Bump version in
pyproject.tomlandsn2/__init__.py - Create a git commit and tag
- Push to GitHub
- Trigger GitHub Actions to build and publish to PyPI
Manual
# Install bump-my-version
uv pip install bump-my-version
# Bump version
bump-my-version bump patch # or minor/major
# Push changes and tags
git push origin main --tags
The GitHub Actions workflow will automatically:
- Create a GitHub release with release notes
- Build the package
- Publish to PyPI (via Trusted Publishing)
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_sn2-0.4.0.tar.gz.
File metadata
- Download URL: python_sn2-0.4.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2a93f128ea621297099ed4d73b8e943446411b87a9ebe0c845a9f40afddaf81
|
|
| MD5 |
8c7790f57c00741b39f0a2fc59b7c484
|
|
| BLAKE2b-256 |
8db21f2ca79abf420ea31cbc6f296fe8fe2981cbc0cd096562379a0f331f1d81
|
Provenance
The following attestation bundles were made for python_sn2-0.4.0.tar.gz:
Publisher:
release.yml on konsulten/python-sn2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_sn2-0.4.0.tar.gz -
Subject digest:
e2a93f128ea621297099ed4d73b8e943446411b87a9ebe0c845a9f40afddaf81 - Sigstore transparency entry: 781294199
- Sigstore integration time:
-
Permalink:
konsulten/python-sn2@7860cbf87844d26e82b101223aaa912f8050e719 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/konsulten
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7860cbf87844d26e82b101223aaa912f8050e719 -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_sn2-0.4.0-py3-none-any.whl.
File metadata
- Download URL: python_sn2-0.4.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
902307cc616c84c659f394a91842b474375dbd0b8e948032c30da5df22e916fa
|
|
| MD5 |
70689986e130c121d5422a6f5f386d15
|
|
| BLAKE2b-256 |
aebe66accd833724711d393a975b532d16a82c25596856f7f0c91dbb8d9c2848
|
Provenance
The following attestation bundles were made for python_sn2-0.4.0-py3-none-any.whl:
Publisher:
release.yml on konsulten/python-sn2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_sn2-0.4.0-py3-none-any.whl -
Subject digest:
902307cc616c84c659f394a91842b474375dbd0b8e948032c30da5df22e916fa - Sigstore transparency entry: 781294202
- Sigstore integration time:
-
Permalink:
konsulten/python-sn2@7860cbf87844d26e82b101223aaa912f8050e719 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/konsulten
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7860cbf87844d26e82b101223aaa912f8050e719 -
Trigger Event:
push
-
Statement type: