feat!: Improve device type registration
All checks were successful
Build and deploy / build (push) Successful in 10m37s
Build and deploy / Deploy container (push) Successful in 38s

Instead of one function that contains all the device types available in
`automation_devices` a global registry is used were each device can
register itself.
This commit is contained in:
2025-09-10 02:59:32 +02:00
parent f0e4c9dd21
commit 4e28ad0f85
16 changed files with 58 additions and 36 deletions

View File

@@ -99,8 +99,13 @@ pub struct Light<T: LightState> {
}
pub type LightOnOff = Light<StateOnOff>;
crate::register_device!(LightOnOff);
pub type LightBrightness = Light<StateBrightness>;
crate::register_device!(LightBrightness);
pub type LightColorTemperature = Light<StateColorTemperature>;
crate::register_device!(LightColorTemperature);
impl<T: LightState> Light<T> {
async fn state(&self) -> RwLockReadGuard<'_, T> {