feat!: Improve device type registration
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:
@@ -89,7 +89,10 @@ pub struct Outlet<T: OutletState> {
|
||||
}
|
||||
|
||||
pub type OutletOnOff = Outlet<StateOnOff>;
|
||||
crate::register_device!(OutletOnOff);
|
||||
|
||||
pub type OutletPower = Outlet<StatePower>;
|
||||
crate::register_device!(OutletPower);
|
||||
|
||||
impl<T: OutletState> Outlet<T> {
|
||||
async fn state(&self) -> RwLockReadGuard<'_, T> {
|
||||
|
||||
Reference in New Issue
Block a user