Interacting with Govee Lights via Python
Project description
Govee API 2.0 Python Library (2023)
This is a super simple interface for interacting with Govee smart lights via Python.
There are three primary functions to control the lights:
-
Toggle power
-
Set brightness
-
Set color
Initializing a Client
To interact with Govee devices on your network, you'll need a Govee API key. You can request one from in-app or browser on the Govee platform.
from govee import GoveeClient
client = GoveeClient("API KEY")
A client is initialized with 3 key values:
from govee import GoveeClient
client = GoveeClient("API KEY")
# Access the client device list:
client.devices
# Access the client network SSID
client.ssid
# Access the client API key
client.key
All device interaction revolves around actual device objects. All available devices at the time of client initialization are stored in GoveeClient.devices
Toggle Power
@param mode = "on", "off", or None
from govee import GoveeClient
client = GoveeClient("API KEY")
# Get the first device object
wall_lights = client.devices[0]
# Toggle Power (if on -> off | if off -> on)
wall_lights.toggle()
# Turn on
wall_lights.toggle(mode="on")
# Turn off
wall_lights.toggle(mode="off")
Set Brightness
@param int brightness = 0-100
Note that setting the brightness to 0 will power off the device.
from govee import GoveeClient
client = GoveeClient("API KEY")
# Get the first device object
wall_lights = client.devices[0]
# Set the brightness to 50%
wall_lights.set_brightness(50)
Set Color
@param tuple colors = ((0-255), (0-255), (0-255))
@colors is in the format: (R, G, B)
from govee import GoveeClient
client = GoveeClient("API KEY")
# Get the first device object
wall_lights = client.devices[0]
# Set the lights red
wall_lights.set_color(255, 0, 0)
# Set the lights green
wall_lights.set_color(0, 255, 0)
# Set the lights blue
wall_lights.set_color(0, 0, 255)
This functionality is dependent upon Govee's API which is not my creation. All rights and credit reserved to Govee 2023 ©.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file govee-py2-0.0.6.tar.gz.
File metadata
- Download URL: govee-py2-0.0.6.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c824b0c74df99db14ccb7a0b39e6e2da8e38e89036caf4c05c9561a51130d369
|
|
| MD5 |
251e024a28db7846d96bb389b5f3d3a3
|
|
| BLAKE2b-256 |
b0f3075d22392761442555dabeb0f9cd41138a578c6f27f8d6bc1d7e13c61b76
|
File details
Details for the file govee_py2-0.0.6-py3-none-any.whl.
File metadata
- Download URL: govee_py2-0.0.6-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6ba6252acfcdf3defca63573e72a96d6fb05ecc0f610ebd1333e79aff90ac6a
|
|
| MD5 |
4fb2d9781818a1b78a460bd4c706e9ce
|
|
| BLAKE2b-256 |
a705d78fd7a12e7a32b529603db0bd0351a930cfa8010471c9717a03241b8f2b
|