Skip to main content

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:

  1. Run tests and linting
  2. Bump version in pyproject.toml and sn2/__init__.py
  3. Create a git commit and tag
  4. Push to GitHub
  5. 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

Release files for python-sn2 0.4.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 python-sn2 0.4.0
File Size Uploaded
python_sn2-0.4.0.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-sn2 0.4.0
File Interpreter ABI Platform
python_sn2-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.6 kB

Release files / python_sn2-0.4.0.tar.gz

Download URL python_sn2-0.4.0.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e2a93f128ea621297099ed4d73b8e943446411b87a9ebe0c845a9f40afddaf81
BLAKE2b-256 checksum
How to use checksums
8db21f2ca79abf420ea31cbc6f296fe8fe2981cbc0cd096562379a0f331f1d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 29, 2025.

Transparency log

Release files / python_sn2-0.4.0-py3-none-any.whl

Download URL python_sn2-0.4.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
902307cc616c84c659f394a91842b474375dbd0b8e948032c30da5df22e916fa
BLAKE2b-256 checksum
How to use checksums
aebe66accd833724711d393a975b532d16a82c25596856f7f0c91dbb8d9c2848
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 29, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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