From b609a315e7921dcc712da6955890f4dc7c2c4b9f Mon Sep 17 00:00:00 2001 From: diogo464 Date: Fri, 5 Dec 2025 19:29:44 +0000 Subject: added publish_on_command option to switch --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 4fae2ba..036ae12 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -219,6 +219,7 @@ pub struct SwitchState { pub struct SwitchStorage { pub state: Option, pub command: Option, + pub publish_on_command: bool, } #[derive(Debug)] @@ -460,7 +461,13 @@ impl<'a> Device<'a> { entity_config.id = id; config.populate(&mut entity_config); - let entity = self.create_entity(entity_config, EntityStorage::Switch(Default::default())); + let entity = self.create_entity( + entity_config, + EntityStorage::Switch(SwitchStorage { + publish_on_command: config.publish_on_command, + ..Default::default() + }), + ); Switch::new(entity) } -- cgit