https://github.com/nirantak/hue-api
Async API for controlling Hue Lights
https://github.com/nirantak/hue-api
api async hue hue-api hue-bridge hue-lights python
Last synced: 5 months ago
JSON representation
Async API for controlling Hue Lights
- Host: GitHub
- URL: https://github.com/nirantak/hue-api
- Owner: nirantak
- License: mit
- Created: 2021-04-15T10:10:03.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-25T21:01:54.000Z (about 2 years ago)
- Last Synced: 2024-08-09T13:27:49.509Z (about 1 year ago)
- Topics: api, async, hue, hue-api, hue-bridge, hue-lights, python
- Language: Python
- Homepage: https://hue-api.nirantak.com
- Size: 217 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: docs/security.txt
Awesome Lists containing this project
README
# Hue API
> _Async API and CLI tools for interacting with Hue Lights_
[](https://github.com/nirantak/hue-api/actions/workflows/python-test.yml)
[](https://github.com/nirantak/hue-api/actions/workflows/python-publish.yml)

[](https://pypi.org/project/hue-api/)Documentation: [hue-api.nirantak.com](https://hue-api.nirantak.com/)
Source: [github.com/nirantak/hue-api](https://github.com/nirantak/hue-api)
## Installation
This is an async client to interact with the Hue Bridge API.
The minimum Python version required to run this is 3.8
Install the package using pip:
```bash
pip install hue-api
```## Usage
Follow [this link](https://developers.meethue.com/develop/get-started-2/#so-lets-get-started) to create a Hue API user if not already known ([API reference](https://developers.meethue.com/develop/hue-api/7-configuration-api/#create-user))
### Using the CLI
```bash
hue --help# Get the version of hue-api installed
hue version# To find your Hue Bridge IP address go to discovery.meethue.com, or run:
hue bridge discover
```### Using the API
```python
from hue import Bridge, Light# Create a light object with the light id (number), Bridge IP and user
light = Light(1, ip="your-hue-bridge-ip", user="hue-api-user")# from an async function
async def main():
await Bridge.discover()
await light.power_on()# or from a sync context
import asyncio
asyncio.run(Bridge.discover())
asyncio.run(light.power_on())
```## Changelog
See the file [CHANGELOG.md](CHANGELOG.md)
## License
This project is licensed under the terms of the [MIT license](https://github.com/nirantak/hue-api/blob/main/LICENSE)