Lunatone REST API Client
lunatone-rest-api-client is a Python package providing access to the Lunatone REST API.
It includes async clients for Lunatones REST API endpoints.
The following devices are supported:
- DALI-2 IoT Gateway (v1.14.1 or later)
- DALI-2 IoT4 Gateway (v1.14.1 or later)
- DALI-2 Display 4'' (v1.14.1 or later)
- DALI-2 Display 7'' (v1.14.1 or later)
Installation
Use pip to install the latest stable version of lunatone-rest-api-client
pip install --upgrade lunatone-rest-api-client
The current development version is available on [GitLab.com] (https://gitlab.com/lunatone-public/lunatone-rest-api-client) and can be installed directly from the git repository:
pip install git+https://gitlab.com/lunatone-public/lunatone-rest-api-client.git
Usage
import asyncio
import aiohttp
from lunatone_rest_api_client import Auth, Devices
async def main() -> None:
"""Show example of fetching devices."""
async with aiohttp.ClientSession() as session:
auth = Auth(session, "http://10.0.0.31")
devices = Devices(auth)
await devices.async_update()
print(devices.data)
if __name__ == "__main__":
asyncio.run(main())
WebSocket events
Register callbacks on the websocket client before opening the connection, then
close the connection when event updates are no longer needed. Use this inside
your async application after creating an Auth instance:
import asyncio
import aiohttp
from lunatone_rest_api_client import Auth, Devices
async def main() -> None:
"""Show example of controlling a device combined with websocket push updates."""
async with aiohttp.ClientSession() as session:
auth = Auth(session, "http://10.0.0.31")
devices = Devices(auth)
def on_devices_update(device_id: int) -> None:
print(devices.devices[device_id])
devices.register_update_callback(on_devices_update)
await auth.websocket.open()
try:
device = devices.devices[0]
await device.fade_to_brightness(100.0)
finally:
await auth.websocket.close()
print(devices.data)
if __name__ == "__main__":
asyncio.run(main())
Setting up development environment
This Python project is fully managed using the uv dependency manager.
Requirements:
To install all packages, including all development requirements:
uv sync
To run just the Python tests:
uv run pytest
Scripts
API tests:
This script sends a POST request and right after two GET requests to check if the status is changed immediately.
uv run ./scripts/api_tests.py --ip <ip-address>
Metadata
Release files for lunatone-rest-api-client 0.11.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lunatone_rest_api_client-0.11.1.tar.gz | 84.2 kB | Without provenance | Details for lunatone_rest_api_client-0.11.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lunatone_rest_api_client-0.11.1-py3-none-any.whl | Python 3 | none | any | Details for lunatone_rest_api_client-0.11.1-py3-none-any.whl |
Total release size: 117.9 kB
Release files / lunatone_rest_api_client-0.11.1.tar.gz
| Download URL | lunatone_rest_api_client-0.11.1.tar.gz |
|---|---|
| Size | 84.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d639f463130a3de7e1b17177e2aa1fd73f717fbd9f5f17713fc28fc337331749
|
|
BLAKE2b-256 checksum How to use checksums |
07466619cea0c80e5276b892b77d3aab0a1df50628c8faec26bec386ab28f3e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / lunatone_rest_api_client-0.11.1-py3-none-any.whl
| Download URL | lunatone_rest_api_client-0.11.1-py3-none-any.whl |
|---|---|
| Size | 33.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0d40b7a099c11f5e6190853ae8ffd0beb759107457e31a6abc8a34f82fddd8a
|
|
BLAKE2b-256 checksum How to use checksums |
7682a6147ea3334a36bb8496ec380529a7cb599a054625d39634b517ee429eb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for lunatone-rest-api-client 0.11.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.