diff options
| author | diogo464 <[email protected]> | 2025-12-05 19:29:44 +0000 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-12-05 19:29:44 +0000 |
| commit | b609a315e7921dcc712da6955890f4dc7c2c4b9f (patch) | |
| tree | 1f2b120b1beaf36c91fb74aba876f1812313307a /src/lib.rs | |
| parent | 52705a80a5012aa48cec9ddf61898596e96c9dfd (diff) | |
added publish_on_command option to switch
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 | ||
