diff options
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 9 |
1 files changed, 8 insertions, 1 deletions
| @@ -219,6 +219,7 @@ pub struct SwitchState { | |||
| 219 | pub struct SwitchStorage { | 219 | pub struct SwitchStorage { |
| 220 | pub state: Option<SwitchState>, | 220 | pub state: Option<SwitchState>, |
| 221 | pub command: Option<SwitchCommand>, | 221 | pub command: Option<SwitchCommand>, |
| 222 | pub publish_on_command: bool, | ||
| 222 | } | 223 | } |
| 223 | 224 | ||
| 224 | #[derive(Debug)] | 225 | #[derive(Debug)] |
| @@ -460,7 +461,13 @@ impl<'a> Device<'a> { | |||
| 460 | entity_config.id = id; | 461 | entity_config.id = id; |
| 461 | config.populate(&mut entity_config); | 462 | config.populate(&mut entity_config); |
| 462 | 463 | ||
| 463 | let entity = self.create_entity(entity_config, EntityStorage::Switch(Default::default())); | 464 | let entity = self.create_entity( |
| 465 | entity_config, | ||
| 466 | EntityStorage::Switch(SwitchStorage { | ||
| 467 | publish_on_command: config.publish_on_command, | ||
| 468 | ..Default::default() | ||
| 469 | }), | ||
| 470 | ); | ||
| 464 | Switch::new(entity) | 471 | Switch::new(entity) |
| 465 | } | 472 | } |
| 466 | 473 | ||
