ha_lights
Simple python library to control lights and switches in Home Assistant.
Relies on dataclasses and namedtuples to provide auto-completion for interactive environments such as colab.
Requirements
Install the package with pip
pip install 'home-assistant-lights'
Sample use
import homeassistant_api as ha
import ha_lights
from collections import namedtuple
client = ha.Client(URL, TOKEN)
factory = ha_lights.Factory(client)
lights,switches = factory.AllLights(), factory.AllSwitches()
COLORS = {
'chill_evening': [255,220,180],
'pure_white': [255, 255, 255],
'red': [255, 0, 0],
}
Colors = namedtuple('Colors', COLORS)(**COLORS)
# Turn on a specific light with optional brightness and color settings
lights.living_room_tripod.turn_on(brightness=255, rgb_color=Colors.chill_evening)
# Create an entity group and use it to control lights and switches with a single API
living_room = EntityGroup([lights.living_room_tripod, switches.lr_smart_plug])
living_room.toggle()
Optionally (if you have an invalid cert)
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
client = ha.Client(URL, TOKEN, global_request_kwargs={'verify': False})
Metadata
Release files for home-assistant-lights 0.0.5.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| home_assistant_lights-0.0.5.post1-py3-none-any.whl | Python 3 | none | any | Details for home_assistant_lights-0.0.5.post1-py3-none-any.whl |
Release files / home_assistant_lights-0.0.5.post1-py3-none-any.whl
| Download URL | home_assistant_lights-0.0.5.post1-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9cd4ad190ab0f06e9dca541905dac33b9e4cba77ee84f1183e8a79a8f6b01bae
|
|
BLAKE2b-256 checksum How to use checksums |
c1b374fe40a18f6da5d71ac9aed621fc2b1a1f660685e28a83cbd3f812c37cf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for home-assistant-lights 0.0.5.post1
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.