Controls for Lightwave Smart Series (second generation) devices
Project description
Lightwave Smart Python Library
A Python library for controlling Lightwave (https://lightwaverf.com) Smart Series (second generation) devices as well as Connect Series (first generation) devices connected to a Link Plus hub. Control and monitor lights (dimmers), power outlets (sockets), smart switches (wirefrees), PIRs, thermostats, TRVs, magnetic switches, relays, energy monitors and other device types.
Supported devices include:
- Link Plus hub (required)
- Light Switches / Dimmers
- Power Outlets
- Smart Switches
- TRVs and Thermostats
- Relays and LED Drivers
- And more...
Updates
Important: The LWLink2Public class has been removed as of version 1.0.0.
Installation
pip install lightwave_smart
Quick Start
import asyncio
from lightwave_smart import lightwave_smart
async def main():
# Create and authenticate
link = lightwave_smart.LWLink2()
link.auth.set_auth_method(auth_method="password", username="your_email@example.com", password="your_password")
await link.async_activate()
# Get devices and feature sets
await link.async_get_hierarchy()
# List feature sets
for featureset in link.featuresets.values():
device = featureset.device
print(f"{featureset.name} (ID: {featureset.featureset_id}), Device Product Code: {device.product_code}")
# Control a light
featureset_id = "your-feature-set-id"
await link.async_turn_on_by_featureset_id(featureset_id)
await link.async_set_brightness_by_featureset_id(featureset_id, 75)
await link.async_deactivate()
asyncio.run(main())
Key Concepts
- Devices: Physical devices (light switches, thermostats, etc.)
- Feature Sets: Logical groupings within a device (e.g. a 2-circuit switch has 2 feature sets)
Device Control
Basic Control
# Lights/Switches
await link.async_turn_on_by_featureset_id(featureset_id)
await link.async_turn_off_by_featureset_id(featureset_id)
await link.async_set_brightness_by_featureset_id(featureset_id, 50)
# Thermostats
await link.async_set_temperature_by_featureset_id(featureset_id, 22.5)
# Covers/Blinds
await link.async_cover_open_by_featureset_id(featureset_id)
await link.async_cover_close_by_featureset_id(featureset_id)
Device Type Detection
device = link.featuresets['featureset-id'].device
print(f"Is light: {device.is_light()}")
print(f"Is climate: {device.is_climate()}")
print(f"Is switch: {device.is_switch()}")
Event Callbacks
def feature_changed(**kwargs):
# example output for a switch:
# {'feature': 'switch', 'feature_id': 'your-feature-set-id', 'prev_value': 0, 'new_value': 1}
print(f"Feature changed: {kwargs}")
# Register callback
await link.async_register_feature_callback(featureset_id, feature_changed)
API Reference
Core Methods
async_activate()- Connect to Lightwave serversasync_get_hierarchy()- Get all devices and feature sets, reads and updates all features states in the background
After calling async_get_hierarchy all feature known at that time will have their states updated as they change based on events received from the websocket.
Device Control
async_turn_on_by_featureset_id(id)- Turn device onasync_turn_off_by_featureset_id(id)- Turn device offasync_set_brightness_by_featureset_id(id, level)- Set brightness (0-100)async_set_temperature_by_featureset_id(id, temp)- Set temperature
Device Information
is_light(),is_climate(),is_switch(),is_cover(),is_energy()- Device type checksis_gen2(),is_hub(),is_trv()- Specific device checks
Examples
example_readme.py- Basic synchronous usageexample_async.py- Advanced async usage with callbacks
Contributing
Contributions welcome! Fork, create a feature branch, commit changes, and submit a PR.
License
MIT License - see LICENSE file.
Thanks
Credit to Bryan Blunt for the original version: https://github.com/bigbadblunt/lightwave2
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 lightwave_smart-2.0.0.tar.gz.
File metadata
- Download URL: lightwave_smart-2.0.0.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fb376b6eb7a6fb99e0c6ee497e0bb2f1e1be3b0b912f4c2c3e439f9a5d78bde
|
|
| MD5 |
161bd1cc5f49845122bccba2a9bf4f36
|
|
| BLAKE2b-256 |
ea1ec76da8c4b71f0636ac3940188601e88afd93981dba5a3233e237524f0762
|
Provenance
The following attestation bundles were made for lightwave_smart-2.0.0.tar.gz:
Publisher:
publish-pypi.yaml on LightwaveSmartHome/lightwave-smart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightwave_smart-2.0.0.tar.gz -
Subject digest:
9fb376b6eb7a6fb99e0c6ee497e0bb2f1e1be3b0b912f4c2c3e439f9a5d78bde - Sigstore transparency entry: 585523553
- Sigstore integration time:
-
Permalink:
LightwaveSmartHome/lightwave-smart@d476139bdf4eb84c3503760de0bd831e6b983eb8 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/LightwaveSmartHome
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yaml@d476139bdf4eb84c3503760de0bd831e6b983eb8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lightwave_smart-2.0.0-py3-none-any.whl.
File metadata
- Download URL: lightwave_smart-2.0.0-py3-none-any.whl
- Upload date:
- Size: 22.0 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 |
55c502e0293ac50fef12fcea90155abbef7b0df15483854573fb0815c9146fdd
|
|
| MD5 |
3bf6653a90009bca5dacfadeb9a59d96
|
|
| BLAKE2b-256 |
50193277e51592d692733b4e87922b133d9963fe4e9a446cac33d58808a12370
|
Provenance
The following attestation bundles were made for lightwave_smart-2.0.0-py3-none-any.whl:
Publisher:
publish-pypi.yaml on LightwaveSmartHome/lightwave-smart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightwave_smart-2.0.0-py3-none-any.whl -
Subject digest:
55c502e0293ac50fef12fcea90155abbef7b0df15483854573fb0815c9146fdd - Sigstore transparency entry: 585523556
- Sigstore integration time:
-
Permalink:
LightwaveSmartHome/lightwave-smart@d476139bdf4eb84c3503760de0bd831e6b983eb8 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/LightwaveSmartHome
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yaml@d476139bdf4eb84c3503760de0bd831e6b983eb8 -
Trigger Event:
release
-
Statement type: