Python client for DayBetter devices and services
Project description
DayBetter Services Python Client
Asynchronous client library used by the Home Assistant DayBetter Services integration.
It handles authentication, device discovery, status polling, PID metadata and device control against the DayBetter cloud API.
Features
- Fully async
DayBetterClientwith context-manager support - Automatic environment selection (test/prod) based on
hass_code - Convenience helpers for common API endpoints (devices, statuses, MQTT config)
- Sensor-focused workflow
fetch_sensor_data()that merges devices, statuses and PID filters - Type hints +
py.typedfor first-class editor / mypy support - Published on PyPI for Home Assistant and other integrations
Installation
pip install daybetter-services-python
Quick Start
import asyncio
from daybetter_python import DayBetterClient
async def main() -> None:
async with DayBetterClient(token="YOUR_TOKEN", hass_code="db-xxxx") as client:
# Fetch merged sensor payloads (used by Home Assistant)
sensors = await client.fetch_sensor_data()
for item in sensors:
print(item["deviceName"], item.get("temp"), item.get("humi"))
# Control a device (brightness example)
await client.control_device(
device_name="device_001",
action=True,
brightness=180,
)
if __name__ == "__main__":
asyncio.run(main())
Home Assistant Integration
The official integration PR can be followed here: home-assistant/core#154677.
The integration imports this library and simply calls client.fetch_sensor_data() inside a data coordinator, so all business logic lives in this package.
See docs/homeassistant.md for:
- Installation instructions (pip, custom component)
- How to obtain the DayBetter token and
hass_code - Sample
configuration.yamlsnippets - Known limitations and future roadmap
Development
git clone https://github.com/THDayBetter/daybetter-services-python.git
cd daybetter-services-python
python3 -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
# Quality checks
flake8 daybetter_python
mypy daybetter_python
pytest
Pull requests are welcome! Please open an issue if you encounter problems with the DayBetter cloud API.
Release Process
- Update
pyproject.tomlanddaybetter_python/__init__.pywith the new version. - Document changes in
CHANGELOG.md. - Build and upload:
rm -rf dist build *.egg-info python -m build twine check dist/* twine upload dist/*
- Create a Git tag (e.g.,
git tag v1.0.7 && git push origin v1.0.7).
License
This project is licensed under the MIT License.
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 daybetter_services_python-1.0.9.tar.gz.
File metadata
- Download URL: daybetter_services_python-1.0.9.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5fd4effa851b9967933fb9f6383795f13991c48e7aaff48dc224bd2bce07c35
|
|
| MD5 |
4f208382515b839012b8b2d341c246d8
|
|
| BLAKE2b-256 |
6a68adaa7705c49074be1b53f0d9ccc3f9211370829a933882e4fcec10246151
|
Provenance
The following attestation bundles were made for daybetter_services_python-1.0.9.tar.gz:
Publisher:
publish-pypi.yml on THDayBetter/daybetter-services-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
daybetter_services_python-1.0.9.tar.gz -
Subject digest:
f5fd4effa851b9967933fb9f6383795f13991c48e7aaff48dc224bd2bce07c35 - Sigstore transparency entry: 1001708965
- Sigstore integration time:
-
Permalink:
THDayBetter/daybetter-services-python@148e19319e92dbdfb0e8adc493debdb438ebfe28 -
Branch / Tag:
refs/tags/v1.0.9 - Owner: https://github.com/THDayBetter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@148e19319e92dbdfb0e8adc493debdb438ebfe28 -
Trigger Event:
release
-
Statement type:
File details
Details for the file daybetter_services_python-1.0.9-py3-none-any.whl.
File metadata
- Download URL: daybetter_services_python-1.0.9-py3-none-any.whl
- Upload date:
- Size: 7.9 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 |
40fe835aea8c559a931f00654bbde4a2193fe05f4e97ab5d98aafe9d8e927055
|
|
| MD5 |
e05b2f98bc3aaba29e99776a9c7df4da
|
|
| BLAKE2b-256 |
69efe2e38b99feb0d4de21eb57f268c22511de9e51e932f31f2ef9d9dcaab6e9
|
Provenance
The following attestation bundles were made for daybetter_services_python-1.0.9-py3-none-any.whl:
Publisher:
publish-pypi.yml on THDayBetter/daybetter-services-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
daybetter_services_python-1.0.9-py3-none-any.whl -
Subject digest:
40fe835aea8c559a931f00654bbde4a2193fe05f4e97ab5d98aafe9d8e927055 - Sigstore transparency entry: 1001708977
- Sigstore integration time:
-
Permalink:
THDayBetter/daybetter-services-python@148e19319e92dbdfb0e8adc493debdb438ebfe28 -
Branch / Tag:
refs/tags/v1.0.9 - Owner: https://github.com/THDayBetter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@148e19319e92dbdfb0e8adc493debdb438ebfe28 -
Trigger Event:
release
-
Statement type: