Skip to content

Commit d4854ce

Browse files
committed
Add --time-sync command/parameter
1 parent ad0210d commit d4854ce

3 files changed

Lines changed: 27 additions & 15 deletions

File tree

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ It uses the RS232 serial port of the Resümat controller.
99
Do not set any values if the corresponding readings don't match the displayed data on the control unit itself or if any other readings are not correct! I'm not responsible for any damage!
1010

1111
## Running it
12-
Download the release file (wtkcontrol-1.2.jar) from https://github.com/mwllgr/java-wtkcontrol/releases/tag/v1.2.0 and run it:
12+
Download the release file (wtkcontrol-1.3.jar) from https://github.com/mwllgr/java-wtkcontrol/releases/tag/v1.3.0 and run it:
1313
```bash
14-
java -jar wtkcontrol-1.2.jar
14+
java -jar wtkcontrol-1.3.jar
1515
```
1616

1717
Start by selecting an address file and opening the serial port - you might have enter the device name manually (e.g. `COM1` or `ttyUSB0`).
@@ -26,7 +26,7 @@ Only reading every address value is possible in "read mode" right now. You'd hav
2626
### Reading all values
2727
Example:
2828
```shell
29-
java -jar wtkcontrol-1.2.jar --no-gui --port /dev/ttyUSB0
29+
java -jar wtkcontrol-1.3.jar --no-gui --port /dev/ttyUSB0
3030
```
3131

3232
Output example:
@@ -42,7 +42,7 @@ Unterbrechungen=00000000
4242
### Writing/changing a value
4343
Example:
4444
```shell
45-
java -jar wtkcontrol-1.2.jar --no-gui --port /dev/ttyUSB0 --write Ww-Temp-Soll --value 49.3
45+
java -jar wtkcontrol-1.3.jar --no-gui --port /dev/ttyUSB0 --write Ww-Temp-Soll --value 49.3
4646
```
4747

4848
Output example:
@@ -53,16 +53,17 @@ ACK received!
5353
### Available parameters
5454
The following parameters *do not control any GUI elements* and are only working when the program is started in `--no-gui` mode!
5555

56-
| **Parameter** | **Description** | **Required** | **Default** |
57-
|-------------------------|---------------------------------------------------------------------------------------------------------------------------|--------------|--------------------|
58-
| --no-gui | Prevents starting the application in GUI mode | Yes | - |
59-
| --port \<device\> | Serial port device, e.g. `COM1` or `/dev/ttyUSB0` | Yes | - |
60-
| --address-list \<file\> | Specifies the comma-separated address list | - | `address-list.csv` |
61-
| --logger | *Only used in read mode:* Saves the received values into `wtk logger-dd-MM-yyyy_hh-mm-ss.csv` before the application exits | - | - |
62-
| --write \<name\> | *Enables write mode:* Requires --value, writes <data> to field named <name> from CSV | - | - |
63-
| --value \<data\> | Requires --write, <data> has to be in a valid format/range | With --write | - |
64-
| --wakeup | Sends a wake-up command to the heating controller | - | - |
65-
| --help | Shows the CLI help | - | - |
56+
| **Parameter** | **Description** | **Required** | **Default** |
57+
|-------------------------|----------------------------------------------------------------------------------------------------------------------------|--------------|--------------------|
58+
| --no-gui | Prevents starting the application in GUI mode | Yes | - |
59+
| --port \<device\> | Serial port device, e.g. `COM1` or `/dev/ttyUSB0` | Yes | - |
60+
| --address-list \<file\> | Specifies the comma-separated address list | - | `address-list.csv` |
61+
| --logger | *Only used in read mode:* Saves the received values into `wtk logger-dd-MM-yyyy_hh-mm-ss.csv` before the application exits | - | - |
62+
| --write \<name\> | *Enables write mode:* Requires --value, writes <data> to field named <name> from CSV | - | - |
63+
| --value \<data\> | Requires --write, <data> has to be in a valid format/range | With --write | - |
64+
| --wakeup | Sends a wake-up command to the heating controller | - | - |
65+
| --time-sync | Sends a command to sync the RTC of the controller with the local date and time | - | - |
66+
| --help | Shows the CLI help | - | - |
6667

6768
### Exit codes
6869

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>at.mwllgr</groupId>
88
<artifactId>wtkcontrol</artifactId>
9-
<version>1.2</version>
9+
<version>1.3</version>
1010

1111
<properties>
1212
<maven.compiler.release>11</maven.compiler.release>

src/main/java/at/mwllgr/wtkcontrol/Cli.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ private Cli(String[] args) {
3535
} else if(argList.contains("--wakeup")) {
3636
// Wake-up
3737
sendWakeUpCommand();
38+
} else if(argList.contains("--time-sync")) {
39+
// Date/time sync for RTC
40+
sendTimeSyncCommand();
3841
}
3942

4043
setAddressList();
@@ -58,6 +61,13 @@ private void sendWakeUpCommand() {
5861
System.exit(0);
5962
}
6063

64+
private void sendTimeSyncCommand() {
65+
this.setupSerialPort();
66+
this.repo.getSerialComm().syncTimeDate();
67+
System.out.println("Sent date/time sync command!");
68+
System.exit(0);
69+
}
70+
6171
private void setAddressList() {
6272
String addressList = "address-list.csv";
6373

@@ -196,6 +206,7 @@ private void showHelpAndExit() {
196206
System.out.printf(" %-20s%s%n", "--value <data>", "Requires --write, <data> has to be in a valid format/range");
197207
System.out.printf(" %-20s%s%n", "--logger", "Only used in read mode: Saves the received values into wtk logger-dd-MM-yyyy_hh-mm-ss.csv before the application exits");
198208
System.out.printf(" %-20s%s%n", "--wakeup", "Sends a wake-up command to the heating controller");
209+
System.out.printf(" %-20s%s%n", "--time-sync", "Sends a command to sync the RTC of the controller with the local date and time");
199210
System.out.printf(" %-20s%s%n", "--help, -h", "Shows this help text");
200211
System.out.println();
201212
System.out.println("Exit codes:");

0 commit comments

Comments
 (0)