check every 5 seconds rather than a full 20

This commit is contained in:
Emil Lerch 2025-12-16 13:37:52 -08:00
parent 4c54ef29e3
commit 4661ce2354
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -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();
},