A light that has a network only ever rejoins that one, so there was no way to re-pair it or move it to another coordinator without reflashing. Holding the encoder button for 10 seconds now makes the light flash green twice, forget its Zigbee network (saved to flash) and restart, after which it looks for a network with an open pairing window, in ZHA with Add device. The coordinator is not told, so Home Assistant keeps the device and recognises it by its IEEE address when it joins again. While the light is looking for a network the on-board LED blinks fast instead of once a second, so a waiting pairing window can be seen to be picked up, and the change between joined and searching is logged. The README documents the gesture and how pairing works, and notes that the extended PAN ID is broadcast by the network and is not a secret. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
36 lines
1.2 KiB
Rust
36 lines
1.2 KiB
Rust
//! Board wiring and strip geometry.
|
|
//!
|
|
//! Everything that changes when the hardware changes lives here.
|
|
|
|
/// Number of WS2812B pixels on the strip.
|
|
pub const LED_COUNT: usize = 24;
|
|
|
|
/// Ceiling on the duty cycle applied to every channel, as a fraction of 255.
|
|
///
|
|
/// Takes the top off peak current draw. This is a brightness cap, not a
|
|
/// current limit: a strip of this length still needs its own 5V supply.
|
|
pub const MAX_DUTY: u8 = 200;
|
|
|
|
/// Rotary encoder detents per full revolution, used to scale a turn into a
|
|
/// brightness step.
|
|
pub const STEPS_PER_BRIGHTNESS_UNIT: i32 = 1;
|
|
|
|
/// Hold time that separates a click from a long press.
|
|
pub const LONG_PRESS_MS: u64 = 600;
|
|
|
|
/// Hold time that makes the light forget its Zigbee network and go back to
|
|
/// pairing mode.
|
|
pub const RESET_HOLD_MS: u64 = 10_000;
|
|
|
|
/// Contact settle time for the encoder push button.
|
|
pub const DEBOUNCE_MS: u64 = 15;
|
|
|
|
/// Heartbeat blink: a brief pulse, repeated once a second.
|
|
pub const HEARTBEAT_ON_MS: u64 = 50;
|
|
pub const HEARTBEAT_PERIOD_MS: u64 = 1000;
|
|
|
|
/// The faster blink that shows the light is looking for a Zigbee network to
|
|
/// join, so a pairing window can be seen to be waiting for it.
|
|
pub const SEARCHING_ON_MS: u64 = 100;
|
|
pub const SEARCHING_PERIOD_MS: u64 = 300;
|