1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import asyncio from bleak import BleakClient # Device address of your LEDVANCE bulb DEVICE_ADDRESS = "asfasdfasd-asfafdas-asdfasf-asdfadsf-adfasdf" # UUID for the characteristic that controls the light state CHARACTERISTIC_UUID = "00010203-0405-0607-0809-0a0b0c0d2b12" async def test_turn_off_light(): async with BleakClient(DEVICE_ADDRESS) as client: print(f"Connected to {client.address}") # Iterate through all possible values from 0x01 to 0xFF for value in range(0x01, 0x100): command = bytearray([value]) await client.write_gatt_char(CHARACTERISTIC_UUID, command) print(f"Sent command {command.hex()} - observe the light") # Small delay to observe the effect of each command await asyncio.sleep(1) # Adjust this delay if necessary print("Completed testing all values.") async def main(): await test_turn_off_light() if __name__ == "__main__": asyncio.run(main()) |