# huesmith-core
Platform-agnostic core for Philips Hue–compatible Zigbee lights.
This crate holds everything that does **not** depend on a specific MCU or HAL, so it
builds and tests on any host (Linux, macOS):
- **Color math** — CIE 1931 XY ↔ RGB, mireds/Kelvin ↔ RGB, HSV, CCT channel mixing.
- **`LightState`** — a ZCL-accurate light state machine (on/off, level, color modes,
smooth transitions, identify blink, scene snapshots).
- **`LightOutput`** — the trait a hardware backend implements to drive real LEDs.
- **Scene parsing** — defensive parsing/encoding of Zigbee scene extension fields.
- **Device identity** — Hue device types and ready-made Philips model presets.
The hardware/Zigbee-stack side lives in the companion crate
[`huesmith`](https://crates.io/crates/huesmith), which implements `LightOutput` on
ESP32-C6/H2 via ESP-IDF.
```rust
use huesmith_core::color::xy_to_rgb;
// CIE XY (ZCL 0–65535 range) + brightness (0–254) → 8-bit RGB
let (r, g, b) = xy_to_rgb(20495, 21561, 254);
```
## Testing
`huesmith-core` is pure Rust and runs on the host:
```bash
cargo test -p huesmith-core --target x86_64-unknown-linux-gnu # Linux
cargo test -p huesmith-core --target aarch64-apple-darwin # macOS
```
See the [project repository](https://github.com/canack/huesmith) for the full guide.
## Trademark & affiliation
This is an independent interoperability project and is **not affiliated with,
authorized, or endorsed by Signify** (Philips Hue). "Philips Hue" and "Signify"
are trademarks of Signify Netherlands B.V.; the bundled Philips model presets
exist only so a self-built device can interoperate with a Hue Bridge. For
educational and hobby use.
## License
MIT