Skip to main content

Python library for Sunricher DALI Gateway (EDA)

Project description

PySrDaliGateway

License

Python library for Sunricher DALI Gateway (EDA) integration with Home Assistant.

Features

  • Async/await support for non-blocking operations
  • Device discovery and control (lights, sensors, panels)
  • Group and scene management
  • Real-time status updates via MQTT
  • Energy monitoring support
  • Full Type Support: Complete type hints for mypy, Pylance, and pyright
  • IDE integration with auto-completion and error checking

Installation

pip install PySrDaliGateway

Device Types Supported

  • Lighting: Dimmer, CCT, RGB, RGBW, RGBWA
  • Sensors: Motion, Illuminance
  • Panels: 2-Key, 4-Key, 6-Key, 8-Key

Requirements

  • Python 3.8+
  • paho-mqtt>=1.6.0

Testing

Hardware integration tests use pytest with real DALI gateway hardware.

Setup

pip install -e ".[dev]"

Running Tests

# Run default tests (excludes destructive and slow tests)
pytest tests/

# Run all tests including slow (bus scan) tests
pytest tests/ -m ""

# Run only bus scan tests
pytest tests/ -m slow

# Run only destructive tests (e.g. gateway restart)
pytest tests/ -m destructive

# Run a specific test file
pytest tests/test_devices.py -v

# Limit device iterations for faster testing
pytest tests/ --device-limit 3

Gateway Connection

Tests connect to a real gateway using one of three methods (in priority order):

  1. CLI parameters — provide credentials directly:

    pytest tests/ --direct-sn GW123456 --direct-ip 192.168.1.100 \
      --direct-username admin --direct-passwd password123
    
  2. Credential cache — reuses credentials from a previous session, stored in tests/.gateway_cache.json

  3. UDP discovery — auto-discovers gateways on the local network

Test Markers

Marker Default Description
destructive skip Tests that disrupt gateway state (e.g. restart)
slow skip Long-running tests (e.g. bus scan >30s)

Test Files

File Coverage
test_connection.py Discovery, connect, disconnect, reconnection
test_gateway.py Version, status sync, restart (destructive)
test_devices.py Device discovery, read, control, CCT range, sensor params
test_groups.py Group discovery, read, control, brightness
test_scenes.py Scene discovery, read, scene devices
test_callbacks.py Real-time device status callbacks
test_bus_scan.py Bus scan, stop scan (slow)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysrdaligateway-0.21.0.tar.gz (50.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysrdaligateway-0.21.0-py3-none-any.whl (40.0 kB view details)

Uploaded Python 3

File details

Details for the file pysrdaligateway-0.21.0.tar.gz.

File metadata

  • Download URL: pysrdaligateway-0.21.0.tar.gz
  • Upload date:
  • Size: 50.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for pysrdaligateway-0.21.0.tar.gz
Algorithm Hash digest
SHA256 9a89a817b06a8408e83933c01cbc67354fc18ce52ae58c713872afbcc7b8a10b
MD5 ac74462630aeeec87bda115cd81605b0
BLAKE2b-256 5bfbbc43906817e83c979e0c968cb89b31e33ca1c74a8242da12fb4872d62ea3

See more details on using hashes here.

File details

Details for the file pysrdaligateway-0.21.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pysrdaligateway-0.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eba918d8334ce7314421913fb25d4221a646ef5a288243a9ce08e7fbb31033be
MD5 c06d5cb24ed24579352ae62deba8abdf
BLAKE2b-256 ad45aa213f9cc6021792a4170744c6a060788c508ad896d9bacc8caa24825fff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page