Async API for controlling Hue Lights
Project description
Hue API
Async API for controlling Hue Lights
Installation
This is an async client for interacting with the Hue Bridge API, to control Hue Lights.
The minimum Python version required to run this is 3.9
Install the package using pip:
pip install hue-api
Create a .env
file in your project root, with variables:
HUE_BRIDGE_IP=192.168.x.x
HUE_BRIDGE_USER=xxxxxxxxxx
- Go to discovery.meethue.com to get the Hue bridge IP address.
- Follow this link to create a Hue API user if not already known, and set the env variable
HUE_BRIDGE_USER
(API reference).
Usage
from hue import api
# Set the light id to control
light = 1
# from an async function
async def main():
await api.switch_on(light)
# or from a sync context
import asyncio
asyncio.run(api.switch_on(light))
Available methods
-
switch_on(light: int) -> bool
Turn
light
on -
switch_off(light: int) -> bool
Turn
light
off -
get_light(light: int) -> dict[Any]
Get all the information about
light
-
get_state(light: int) -> dict[Any]
Get the current state of
light
-
set_state(light: int, state: dict[Any]) -> tuple[bool, dict[Any]]
Set the state of
light
Input values of "bri", "hue", "sat", "xy", "ct" in
state
Returns the success value and the current state
-
save_state(light: int) -> dict[Any]
Save the current state of
light
-
restore_state(light: int) -> dict[Any]
Restore the last saved state of
light
Changelog
All notable changes to this project will be documented in this file. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
0.1.1 (2021-04-15)
Added
- Add documentation
Fixed
- Fix minimum python version required 3.9
- Fix tox tests
0.1.0 (2021-04-15)
- First release
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
Hashes for hue_api-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dcb80e4dd7de14123c929286f1a8b2dd4b53b89e5e6d18b9441660b37d20188 |
|
MD5 | 70d43709cba90b0b7c2def8087f10896 |
|
BLAKE2b-256 | 1fbdaa7182bf78a6b90bc0b2dfff2a00184a8b7e88e4c3bb406292d59a472508 |