From 4661ce23547237c997299ff46c41f34c179b4276 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Tue, 16 Dec 2025 13:37:52 -0800 Subject: [PATCH] check every 5 seconds rather than a full 20 --- src/main.zig | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main.zig b/src/main.zig index e89851f..df49d65 100644 --- a/src/main.zig +++ b/src/main.zig @@ -526,18 +526,26 @@ pub fn main() !void { }; try stdout.print("āœ“ Recirculation command sent\n", .{}); - try stdout.print("ā³ Waiting 20 seconds for device to respond...\n", .{}); + try stdout.print("ā³ Waiting up to 20 seconds for device to respond...\n", .{}); try stdout.flush(); - std.Thread.sleep(20 * std.time.ns_per_s); + for (0..4) |i| { + std.Thread.sleep(5 * std.time.ns_per_s); - var post_command_state = try getRecirculationStatus( - allocator, - auth.id_token, - sid, - ); - defer post_command_state.deinit(); - try stdout.print("\n{f}", .{post_command_state}); + var post_command_state = try getRecirculationStatus( + allocator, + auth.id_token, + sid, + ); + defer post_command_state.deinit(); + const enabled = post_command_state.recirculation_enabled != null and post_command_state.recirculation_enabled.?; + if (i == 4 or enabled) { + try stdout.print("\n{f}", .{post_command_state}); + if (enabled) + try stdout.writeAll("\nšŸ‘ Recirculation enabled!\n"); + break; + } + } } try stdout.flush(); },