aboutsummaryrefslogtreecommitdiff
path: root/src/entity_switch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/entity_switch.rs')
-rw-r--r--src/entity_switch.rs10
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 @@
1use crate::{ 1use 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)]
14pub struct SwitchConfig { 18pub 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
20impl Default for SwitchConfig { 24impl 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}