This release is a pre-release and may not be stable for production use.
Python3 Module for controlling Philips Hue lights.
Quick Start Guide:
Installation:
without VirtualENV:
python3 -m pip install py3-PyHue
with VirtualENV:
Windows:
.\<envname>\Scripts\python.exe -m pip install py3-PyHue
Linux:
./<envname>/bin/python3 -m pip install py3-PyHue
Setup:
Here you have 2 options: Either the Auto-Discovery or the manual setting!
Auto-Discovery:
from PyHue import *
bridge = Bridge()
Manual:
from PyHue import *
bridge = Bridge(ip='<your ip address>')
Now a new instance of the Hue class is created. If you already used this package, you will notice, that the package will automagicaly connect to the Hue bridge. To restart the discovery process, stop the Python3 script and delete the file '.cached_ip_important' from the root directory (i.e. There, where the main script is located).
After a bridge was discovered, the authentication process will start. You will have to press the button on the front of the Bridge. After that, press the enter key to proceed. After this process you will have a new file '.cached_username_important' in the root directory.
Now you can start coding!
Usage:
All of the available methods are described in the documentation! (It's linked above! You should really check it out!)
To list all lights, you can use this!:
from PyHue import *
bridge = Bridge()
print(bridge.get_all_lights())
But for example, to toggle the light with the id '1', you can use the following code:
from PyHue import *
bridge = Bridge()
light = Lights(bridge, 1)
light.toggle_power()
To turn the light on, use this: (In this case using light-id '1' again)
from PyHue import *
bridge = Bridge()
light = Lights(bridge, 1)
light.power = True
# or to turn it off:
light.power = False
Finally, if you want to make custom API-Requests, you should use this:
from PyHue import *
bridge = Bridge()
print(bridge.api_request('<METHOD>', '<ENDPOINT>', <body (dict)>))
Happy Coding!
More information is in the Docs linked above!
Metadata
Release files for py3-PyHue 0.2a0
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 |
|---|---|---|---|---|
| py3_PyHue-0.2a0-py3-none-any.whl | Python 3 | none | any | Details for py3_PyHue-0.2a0-py3-none-any.whl |
Release files / py3_PyHue-0.2a0-py3-none-any.whl
| Download URL | py3_PyHue-0.2a0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
218087adb182200fbdac05e88da361001eeb666093b0abdafbff46214778abde
|
|
BLAKE2b-256 checksum How to use checksums |
d2e08e1371456fa994eb53932ebc59617629ecd3a315686a73a1acc743af96e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.7
|
Security for py3-PyHue 0.2a0
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.