check every 5 seconds rather than a full 20
This commit is contained in:
parent
4c54ef29e3
commit
4661ce2354
1 changed files with 17 additions and 9 deletions
26
src/main.zig
26
src/main.zig
|
|
@ -526,18 +526,26 @@ pub fn main() !void {
|
||||||
};
|
};
|
||||||
|
|
||||||
try stdout.print("✓ Recirculation command sent\n", .{});
|
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();
|
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(
|
var post_command_state = try getRecirculationStatus(
|
||||||
allocator,
|
allocator,
|
||||||
auth.id_token,
|
auth.id_token,
|
||||||
sid,
|
sid,
|
||||||
);
|
);
|
||||||
defer post_command_state.deinit();
|
defer post_command_state.deinit();
|
||||||
try stdout.print("\n{f}", .{post_command_state});
|
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();
|
try stdout.flush();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue