Betree / magicblue

💡 Unofficial Python API to control Magic Blue bulbs over Bluetooth
MIT License
100 stars 23 forks source link

Add support for functions (strobe, colors crossfade...etc) #19

Closed Betree closed 7 years ago

Betree commented 7 years ago

The MagicBlue app has a tab for a number of special functions, such as a strobe and a given color crossfade. Fortunelaty, these keep repeating after started. Unfortunately, the bulb only recognizes a static set, so we can't use this to crossfade specific colors.

To set one of these cycles, you can craft a handle as following:

[bb] - RUN PRESET PROGRAM. A code that tells the bulb to start a program
[..] - PROGRAM TYPE. A 2 digit hex that tells what program to run. See the list below
[..] - SPEED. A 2 digit hex from 01 and up that sets the speed for the program
[44] - Uncertain, seems static. Can be changed but does not change bulb reaction
[0x] - Uncertain, first digit is static. Can be changed but does not change bulb reaction
[xxxxxx] - Uncertain, seems random, could be a time stamp. Can be changed but does not change bulb reaction.

A sample: char-write-req 0x000c BB2603440A150722 will run a program that fades the bulb from off to red and back again.

Some PROGRAM TYPEs:

25: Seven color cross fade
26: Red gradual change
27: Green gradual change
28: Blue gradual change
29: Yellow gradual change
2a: Cyan gradual change
2b: Purple gradual change
2c: White gradual change
2d: Red, Green cross fade
2e: Red blue cross fade
2f: Green blue cross fade
30: Seven color stobe flash
31: Red strobe flash
32: Green strobe flash
33: Blue strobe flash
34: Yellow strobe flash
35: Cyan strobe flash
36: Purple strobe flash
37: White strobe flash
38: Seven color jumping change

SPEED

01 - fastest
20 - very slow (and goes slower still)
Betree commented 7 years ago

Done by @StevenLooman and implemented in magicblueshell 0.4