Skip to content

v0.2.0 — Typed API, Safe Errors, Structured State (Breaking Change)

Latest

Choose a tag to compare

@adia-dev adia-dev released this 20 Dec 14:34

🚨 Breaking change

This release introduces a new, typed API surface and deprecates the previous
map-based interface.

If you are upgrading from v0.1.x, please read BREAKING_CHANGES.md before
upgrading.


✨ What’s new

Typed API

  • Devices are now returned as %GoveeLights.Device{} structs
  • Device state is normalized into %GoveeLights.Device.State{}
  • All fields are validated at construction time

Explicit error handling

  • All public API calls return {:ok, value} | {:error, reason}
  • Bang variants (devices!/0, etc.) raise GoveeLights.Api.Error
  • Errors carry structured reasons (transport, decode, validation)

Safer command execution

  • Command helpers validate inputs before sending requests
  • Transport errors are consistently tagged as {:http_error, reason}

🆕 New API entrypoint

All interactions now go through:

GoveeLights.Api

The old top-level functions remain deprecated and will be removed in a
future release.


🔄 Migration example

Before (v0.1.x)

devices = GoveeLights.devices()
device = hd(devices)

GoveeLights.turn_on(device["device"], device["model"])

After (v0.2.0)

{:ok, devices} = GoveeLights.Api.devices()

%Device{id: id, model: model} = hd(devices)

:ok = GoveeLights.Api.turn_on(id, model)

📚 Documentation


Thanks to everyone using and testing the library ❤️