Python module to talk to Philips Hue.
Project description
# Async Hue
An async library for Python 3.5+ to control Philips Hue.
```python
import asyncio
from pprint import pprint
from aiohue.discovery import discover_nupnp
async def main():
bridges = await discover_nupnp()
bridge = bridges[0]
await bridge.create_user('aiophue-example')
print('Your username is', bridge.username)
await bridge.initialize()
print('Name', bridge.config.name)
print('Mac', bridge.config.mac)
print()
print('Lights:')
for id in bridge.lights:
light = bridge.lights[id]
print('{}: {}'.format(light.name, 'on' if light.state['on'] else 'off'))
# Change state of a light.
await light.set_state(on=not light.state['on'])
print()
print('Groups:')
for id in bridge.groups:
group = bridge.groups[id]
print('{}: {}'.format(group.name, 'on' if group.action['on'] else 'off'))
# Change state of a group.
await group.set_action(on=not group.state['on'])
asyncio.get_event_loop().run_until_complete(main())
```
An async library for Python 3.5+ to control Philips Hue.
```python
import asyncio
from pprint import pprint
from aiohue.discovery import discover_nupnp
async def main():
bridges = await discover_nupnp()
bridge = bridges[0]
await bridge.create_user('aiophue-example')
print('Your username is', bridge.username)
await bridge.initialize()
print('Name', bridge.config.name)
print('Mac', bridge.config.mac)
print()
print('Lights:')
for id in bridge.lights:
light = bridge.lights[id]
print('{}: {}'.format(light.name, 'on' if light.state['on'] else 'off'))
# Change state of a light.
await light.set_state(on=not light.state['on'])
print()
print('Groups:')
for id in bridge.groups:
group = bridge.groups[id]
print('{}: {}'.format(group.name, 'on' if group.action['on'] else 'off'))
# Change state of a group.
await group.set_action(on=not group.state['on'])
asyncio.get_event_loop().run_until_complete(main())
```
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
aiohue-0.1.0.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file aiohue-0.1.0.tar.gz
.
File metadata
- Download URL: aiohue-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d7d2e59812b53b320a8646127d163c05352bdf5784e4c90f2a3624d4b3c6971 |
|
MD5 | f6d8a17d320ed520eb91c0ac7398f66f |
|
BLAKE2b-256 | 308e5d268422e970b785eb069cc290eee49a6efe518bbaf858702f9772952c0d |
File details
Details for the file aiohue-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: aiohue-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10625a0f8abcd88e136d0ea83378fa62da41cf5098ad44d0aca09f5526974d11 |
|
MD5 | 6aff2c3281b8a873aaa6c1bfc34802f2 |
|
BLAKE2b-256 | c933ae5c02109a577ea19cd891e2978f9084ba20aa527d3009ca9f8e7a42325b |