diff options
| author | diogo464 <[email protected]> | 2025-12-14 14:51:08 +0000 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-12-14 14:51:08 +0000 |
| commit | f6331eec208b2160dce93a6e2d95162d19273cc1 (patch) | |
| tree | db309557c5b5d3b260ef869f7eec444e0eb31b78 /src/entity_switch.rs | |
| parent | c4f74c992b93f6fbcf8d41f77752942225e97457 (diff) | |
| parent | a16dbf1d55a6f5b28236eef566eea0f44524840c (diff) | |
Merge branch 'main' into embassy-git
Diffstat (limited to 'src/entity_switch.rs')
| -rw-r--r-- | src/entity_switch.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/entity_switch.rs b/src/entity_switch.rs index 299d299..c1531eb 100644 --- a/src/entity_switch.rs +++ b/src/entity_switch.rs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | use crate::{ | 1 | use crate::{ |
| 2 | BinaryState, Entity, EntityCommonConfig, EntityConfig, SwitchCommand, SwitchState, constants, | 2 | BinaryState, CommandPolicy, Entity, EntityCommonConfig, EntityConfig, SwitchCommand, |
| 3 | SwitchState, constants, | ||
| 3 | }; | 4 | }; |
| 4 | 5 | ||
| 5 | #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] | 6 | #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] |
| @@ -10,11 +11,14 @@ pub enum SwitchClass { | |||
| 10 | Switch, | 11 | Switch, |
| 11 | } | 12 | } |
| 12 | 13 | ||
| 14 | /// Configuration for a switch entity. | ||
| 15 | /// | ||
| 16 | /// See [`CommandPolicy`] for details on how commands are handled. | ||
| 13 | #[derive(Debug)] | 17 | #[derive(Debug)] |
| 14 | pub struct SwitchConfig { | 18 | pub struct SwitchConfig { |
| 15 | pub common: EntityCommonConfig, | 19 | pub common: EntityCommonConfig, |
| 16 | pub class: SwitchClass, | 20 | pub class: SwitchClass, |
| 17 | pub publish_on_command: bool, | 21 | pub command_policy: CommandPolicy, |
| 18 | } | 22 | } |
| 19 | 23 | ||
| 20 | impl Default for SwitchConfig { | 24 | impl Default for SwitchConfig { |
| @@ -22,7 +26,7 @@ impl Default for SwitchConfig { | |||
| 22 | Self { | 26 | Self { |
| 23 | common: Default::default(), | 27 | common: Default::default(), |
| 24 | class: Default::default(), | 28 | class: Default::default(), |
| 25 | publish_on_command: true, | 29 | command_policy: CommandPolicy::default(), |
| 26 | } | 30 | } |
| 27 | } | 31 | } |
| 28 | } | 32 | } |
