A Swift Command Line Interface to interact with Elgato Avea light bulbs.
The script currently starts up and looks for the first Bluetooth LE device containing the name "Avea". It then connects and sends the desired bytes to modify the bulb's color or brightness.
The implementation wouldn't be possible without knowing the details of which bytes to send, so kudos to Marmelatze for figuring that out.
Requirements: macOS 10.0, Swift 3
Note: Xcode is required to compile the executable
-
Clone the repo
$ git clone https://github.com/vfuc/avea-cli
$ cd avea-cli
-
Run the
build.sh
script to compile the binary$ ./build.sh
-
Run the binary in the folder
$ ./avea
or if you're feeling fancy you can - Link the binary to `/usr/local/bin` to be able to run it everywhere (replace the link with the path to the compiled binary):
`$ sudo cp [link/to/compiled/avea] /usr/local/bin/`
The color is set using red, green, blue and white values in the range of 0-255 with the set-color-rgbw
command or its short form rgbw
.
$ avea set-color-rgbw [red] [green] [blue] [white]
$ avea rgbw [red] [green] [blue] [white]
Color and brightness are set independently of each other as they are two different commands sent to the bulb. Use values in the range of 0-255 with the command set-brightness
or just b
.
$ avea set-brightness [value]
$ avea b [value]
$ avea off
Because I'm too lazy to type out raw values I added color descriptors, they're pretty self-explanatory.
The data is stored as JSON in the ~/.avea/avea-colors.json
file
$ avea show-colors
Available colors:
[blue] Red: 0, Green: 5, Blue: 255, White: 10
[green] Red: 0, Green: 255, Blue: 0, White: 10
[red] Red: 255, Green: 0, Blue: 0, White: 15
[yellow] Red: 255, Green: 255, Blue: 0, White: 10
[orange] Red: 255, Green: 75, Blue: 0, White: 0
[purple] Red: 200, Green: 0, Blue: 250, White: 0
[pink] Red: 220, Green: 0, Blue: 80, White: 10
[white] Red: 0, Green: 0, Blue: 0, White: 255
[white-warm] Red: 200, Green: 100, Blue: 0, White: 175
[white-cold] Red: 0, Green: 100, Blue: 200, White: 175
[white-pinkish] Red: 100, Green: 0, Blue: 100, White: 200
$ avea set-color [descriptor]
$ avea c [descriptor]
$ avea add-color [descriptor] [red] [green] [blue] [white]
$ avea delete-color [descriptor]
At the moment I only have a single "avea bulb", so I haven't worked on multi-device support yet and don't know if it works with the "sphere" and "flare" products as well.
Occasionally, the bulb is not discoverable and the script will look for it indefinitely. This seems to be an issue with the bulb itself though, as I experience it with the iOS client as well.
Issues and Pull Requests are welcome, of course :)
I included some basic default colors, but please add to them if there's a cool one you found!