softgrass / govee-api-ble Goto Github PK
View Code? Open in Web Editor NEWPython API for Govee H6127 RGB lighting strips
License: MIT License
Python API for Govee H6127 RGB lighting strips
License: MIT License
Following the steps in the readme:
from govee_api_ble import GoveeDevice
my_device = GoveeDevice('D4:AD:FC:33:0A:D9')
my_device.setPower(False)
Characteristic Write Request failed: Attribute can't be written
(False, False, b'')
Some diagnostic info from gatttool
Characteristics:
handle: 0x0002, char properties: 0x08, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, char properties: 0x02, char value handle: 0x0007, uuid: 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x0009, char properties: 0x12, char value handle: 0x000a, uuid: 00010203-0405-0607-0809-0a0b0c0d2b10
handle: 0x000d, char properties: 0x06, char value handle: 0x000e, uuid: 00010203-0405-0607-0809-0a0b0c0d2b11
handle: 0x0012, char properties: 0x1c, char value handle: 0x0013, uuid: f000ffc1-0451-4000-b000-000000000000
handle: 0x0016, char properties: 0x1c, char value handle: 0x0017, uuid: f000ffc2-0451-4000-b000-000000000000
Hi, thanks for building and documenting this!
Just commenting to say the H6139 model is also working, you may want to add this to the README - At least the power on/off, setColor, setBrightness, setScene and setBrightness abilities. The setColorMusic might not be working for this specific model, haven't fully tested it.
import asyncio
import weatherbug_spark
from govee_api_ble import GoveeDevice
async def main():
#South Pool
data1 = await weatherbug_spark.get_data(39.5842042, -104.9077378)
roundeddata1 = round(data1.closestPulseDistance,2)
print("South Pool Strike Distance= ",roundeddata1);
my_device = GoveeDevice(7C:A6:B0:1F:8E:63)
my_device.setPower(True) # Turns device on
#Middle of Centennnial
data3 = await weatherbug_spark.get_data(39.579231, -104.876694)
roundeddata3 = round(data3.closestPulseDistance,2)
print("Middle Of Centennial Strike Distance= ",roundeddata3)
#Centennial Airport
data2 = await weatherbug_spark.get_data(39.5795, -104.8463)
roundeddata2 = round(data2.closestPulseDistance,2)
print("Centennial Airport Strike Distance= ",roundeddata2)
print(" ")
print("Pool Status: ")
if roundeddata1 >= 30:
print("Not even Close")
elif roundeddata1 >= 10:
print("Its getting there")
elif roundeddata1 > 6:
print("Nearly there")
elif roundeddata1 > 5:
print("Close the pool")
elif roundeddata1 < 3:
print("Kick everyone out")
if __name__ == "__main__":
asyncio.run(main())
I ran this script on a Raspberry Pi 5
from govee_api_ble import GoveeDevice
my_device = GoveeDevice("CA:39:32:35:48:4D")
my_device.setPower(False)
connect to CA:39:32:35:48:4D: Connection refused (111)
Traceback (most recent call last):
File "/home/pandadev/Scripts/test/main.py", line 5, in <module>
my_device.setPower(False)
File "/home/pandadev/Scripts/test/venv/lib/python3.11/site-packages/govee_api_ble/device.py", line 39, in setPower
output = subprocess.check_output("gatttool -i hci0 -b {} --char-write-req -a 0x0015 -n 3301000000000000000000000000000000000032".format(self.mac), shell=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'gatttool -i hci0 -b CA:39:32:35:48:4D --char-write-req -a 0x0015 -n 3301000000000000000000000000000000000032' returned non-zero exit status 1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.