# π‘ 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.3"}
]
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()
[
%{
"controllable" => true,
"device" => "0A:0A:0A:0A:0A:0A:0A:0A",
"deviceName" => "Userβs room",
"model" => "H6008",
"properties" => %{
"colorTem" => %{"range" => %{"max" => 6500, "min" => 2700}}
},
"retrievable" => true,
"supportCmds" => ["turn", "brightness", "color", "colorTem"]
}
]
```
### Device State
```elixir
iex> GoveeLights.device_state("AA:BB:CC:DD:EE:FF:11:22", "H6008")
%{
"device" => "AA:BB:CC:DD:EE:FF:11:22",
"model" => "H6008",
"properties" => [
%{"online" => true},
%{"powerState" => "on"},
%{"brightness" => 10},
%{"color" => %{"b" => 156, "g" => 242, "r" => 36}}
]
}
```
---
### 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
mix docs
```
---
## π 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 β’Ν‘Λγβ’Ν‘Λ