diff --git a/pyproject.toml b/pyproject.toml index c1730bb..dd87a2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore-cli" -version = "1.3.15" +version = "1.3.16" authors = [ { name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, ] diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index fc304a3..fb72812 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -32,7 +32,7 @@ import re from meshcore import MeshCore, EventType, logger # Version -VERSION = "v1.3.15" +VERSION = "v1.3.16" # default ble address is stored in a config file MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/" @@ -3829,6 +3829,13 @@ async def repeater_loop(port, baudrate): print(REPEATER_HELP) continue + if cmd.lower() == "clock sync" or cmd.lower() == "st" or cmd.lower() == "sync_time": + cur_time = int(time.time()) + print(f'{ANSI_GREEN}Syncing clock to' + f' {datetime.datetime.fromtimestamp(cur_time).strftime("%Y-%m-%d %H:%M:%S")}' + f' ({cur_time}){ANSI_END}') + cmd = f"time {cur_time}" + # Send command with CR terminator ser.write(f"{cmd}\r".encode()) await asyncio.sleep(0.3)