diff options
Diffstat (limited to 'src/entity_number.rs')
| -rw-r--r-- | src/entity_number.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/entity_number.rs b/src/entity_number.rs index e2a89c1..1573000 100644 --- a/src/entity_number.rs +++ b/src/entity_number.rs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | use crate::{ | 1 | use crate::{ |
| 2 | Entity, EntityCommonConfig, EntityConfig, NumberCommand, NumberState, NumberUnit, constants, | 2 | CommandPolicy, Entity, EntityCommonConfig, EntityConfig, NumberCommand, NumberState, |
| 3 | NumberUnit, constants, | ||
| 3 | }; | 4 | }; |
| 4 | 5 | ||
| 5 | #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] | 6 | #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] |
| @@ -61,6 +62,9 @@ pub enum NumberClass { | |||
| 61 | WindSpeed, | 62 | WindSpeed, |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 65 | /// Configuration for a number entity. | ||
| 66 | /// | ||
| 67 | /// See [`CommandPolicy`] for details on how commands are handled. | ||
| 64 | #[derive(Debug)] | 68 | #[derive(Debug)] |
| 65 | pub struct NumberConfig { | 69 | pub struct NumberConfig { |
| 66 | pub common: EntityCommonConfig, | 70 | pub common: EntityCommonConfig, |
| @@ -70,7 +74,7 @@ pub struct NumberConfig { | |||
| 70 | pub step: Option<f32>, | 74 | pub step: Option<f32>, |
| 71 | pub mode: NumberMode, | 75 | pub mode: NumberMode, |
| 72 | pub class: NumberClass, | 76 | pub class: NumberClass, |
| 73 | pub publish_on_command: bool, | 77 | pub command_policy: CommandPolicy, |
| 74 | } | 78 | } |
| 75 | 79 | ||
| 76 | impl Default for NumberConfig { | 80 | impl Default for NumberConfig { |
| @@ -83,7 +87,7 @@ impl Default for NumberConfig { | |||
| 83 | step: None, | 87 | step: None, |
| 84 | mode: NumberMode::Auto, | 88 | mode: NumberMode::Auto, |
| 85 | class: NumberClass::Generic, | 89 | class: NumberClass::Generic, |
| 86 | publish_on_command: true, | 90 | command_policy: CommandPolicy::default(), |
| 87 | } | 91 | } |
| 88 | } | 92 | } |
| 89 | } | 93 | } |
