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.20.4.tar.gz (49.5 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.20.4-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pysrdaligateway-0.20.4.tar.gz
Algorithm Hash digest
SHA256 467fa7b3aedd301237cb81459ae8d15c75093c08f610b2a01e71b6499b986844
MD5 2111d440d4bd79cba1ebb480c58c464e
BLAKE2b-256 91be775b99f8cc04c2927c11d2bec7c42c7c334b5814b6467d5f4fd17e7b8a23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrdaligateway-0.20.4-py3-none-any.whl
Algorithm Hash digest
SHA256 36e41d983330db8b7bc654fc454213f892e342234c8a737dd4f68ff62be3a026
MD5 fa0cc39f7e3141e28cee66be3ed9f9d3
BLAKE2b-256 4fa244cb73cf0f838cdd551e57fe0409790cc17aa037a075870113f9c6ea5ca1

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