From b456db36b7d973154f0a10bc1adca235de2c5c12 Mon Sep 17 00:00:00 2001 From: diogo464 Date: Sat, 13 Dec 2025 20:09:33 +0000 Subject: publish values on first iteration of run if the connection fails its possible some value that needed to be published did not get published so this should fix that. --- src/lib.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index f28d2bd..64057a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -863,6 +863,7 @@ pub async fn run(device: &mut Device<'_>, transport: &mut T) -> Re } } + let mut first_iteration_push = true; 'outer_loop: loop { use core::fmt::Write; @@ -874,7 +875,7 @@ pub async fn run(device: &mut Device<'_>, transport: &mut T) -> Re None => break, }; - if !entity.publish { + if !entity.publish && !first_iteration_push { continue; } @@ -920,10 +921,12 @@ pub async fn run(device: &mut Device<'_>, transport: &mut T) -> Re device.publish_buffer.truncate(n); } _ => { - crate::log::warn!( - "entity '{}' requested state publish but its storage does not support it", - entity.config.id - ); + if !first_iteration_push { + crate::log::warn!( + "entity '{}' requested state publish but its storage does not support it", + entity.config.id + ); + } continue; } } @@ -970,6 +973,7 @@ pub async fn run(device: &mut Device<'_>, transport: &mut T) -> Re } } } + first_iteration_push = false; let receive = client.receive(); let waker = wait_on_atomic_waker(device.waker); -- cgit