# ๐ก GoveeLights
[](https://hex.pm/packages/govee_lights)
[](https://hexdocs.pm/govee_lights)
[](LICENSE)
[](https://github.com/adia-dev/govee-lights-ex/actions)
Control your Govee smart lights directly from **Elixir**.
This project provides a clean and simple wrapper for the Govee Developer API, allowing you to list devices, control power, adjust brightness, and modify color temperature, all with straightforward, minimal function calls.
> โ ๏ธ This library is **unofficial** and not affiliated with Govee.
> It simply gives Elixir developers a nice, ergonomic way to talk to the Govee API.
---
## ๐ Installation
Add to your `mix.exs` dependencies:
```elixir
def deps do
[
{:govee_lights, "~> 0.1.0"}
]
end
```
Fetch deps:
```bash
mix deps.get
```
---
## ๐ API Key
You must export your Govee API key before usage:
```bash
export GOVEE_API_KEY="YOUR_KEY"
```
You can request a key here:
[https://developer.govee.com/reference/apply-you-govee-api-key](https://developer.govee.com/reference/apply-you-govee-api-key)
---
## ๐ Usage Examples
### List devices
```elixir
iex> GoveeLights.devices()
[
%{
"device" => "AA:BB:CC:DD:EE:FF:11:22",
"deviceName" => "Bedroom Lightbulb",
"model" => "H6008",
"controllable" => true,
"retrievable" => true,
"supportCmds" => ["turn", "brightness", "color", "colorTem"]
}
]
```
---
### Power Control
```elixir
GoveeLights.turn_on("AA:BB:CC:DD:EE:FF:11:22", "H6008")
GoveeLights.turn_off("AA:BB:CC:DD:EE:FF:11:22", "H6008")
```
---
### Brightness (0โ100)
```elixir
GoveeLights.set_brightness("AA:BB:CC:DD:EE:FF:11:22", "H6008", 50)
```
---
### Color Temperature
```elixir
# values differ per model โ check devices/0 properties
GoveeLights.set_temperature("AA:BB:CC:DD:EE:FF:11:22", "H6008", 3000)
```
---
## ๐ง Notes & Tips
| Feature | Status |
| ---------------------- | -------------- |
| Device listing | โ๏ธ `devices/0` |
| Power control | โ๏ธ on/off |
| Brightness | โ๏ธ 0โ100 |
| Temperature | โ๏ธ Kelvin |
| RGB color support | planned |
| Scene / effect control | planned |
---
## ๐ Development
```bash
mix test # run test suite
mix docs # generate documentation
```
---
## ๐ Planned Improvements / TODO
### Internal Enhancements
- **Device caching layer**
- reduces API calls dramatically
- TTL-based refresh or manual invalidation
- **Better error messages**
- contextual failures (`device not found`, `brightness out of range`, etc.)
- include Govee error metadata
- Improved fault-tolerance
- automatic retries for transient network errors
- optional backoff mechanism
### Feature Expansion
- Add full RGB color control
- Scene / Dynamic effect control
- Presets & automation helpers
- More test coverage + mock API adapter
Create an issue if you'd like to help or suggest something.
---
## โค๏ธ Contributing
Pull requests are welcome!
Issues, ideas, feedback, all appreciated.
If you enjoy this library, leave a โญ on the repo โขอกหใโขอกห