!! This fork is no longer maintaned. If you are looking for alternative check exeQute !!
A modular background service that makes Windows remotely controllable through MQTT. For home automation and Internet of Things.
Java SE 8 or Java SE 11 is required on your local machine. Other Java versions untested.
Maven is required to build Java application. For convenience the Maven build file contains execution to produce a Windows executable.
mvn clean package
mvn package
Download the Windows executable and run it:
winthing-1.3.0.exe
or you can execute the Java file:
java -jar winthing-1.3.0.jar
1.3.0 represents the application version and is changing with each update. Feel free to rename the file to winthing.exe to keep the same name.
After launching a tray icon will appear on the taskbar. You can click on the icon to open console log or you can quit WinThing.
Configuration parameters can be passed from command line or they can be placed in configuration files in the working directory from where you launch WinThing.
Property | Description | Default |
---|---|---|
broker | URL of the MQTT broker to use | 127.0.0.1:1883 |
username | Username used when connecting to MQTT broker | mqtt |
password | Password used when connecting to MQTT broker | mqtt |
clientid | Client ID to present to the broker | WinThing |
reconnect | Time interval between connection attempts in seconds | 5 |
prefix | Topic prefix to use with the MQTT broker | winthing |
Example how to pass parameters from command line:
java -Dbroker="127.0.0.1:1883" -jar winthing-1.3.0.jar
WinThing will look for this file in the current working directory (directory from where you launched WinThing). Create this file and put desired parameters into it.
Example file:
broker = "127.0.0.1:1883"
username = "mqtt"
password = "somesecret"
By default WinThing executes any command it receives in the system/commands/run topic. Create this file in the current working directory to whitelist only specific commands. The file contains an unique string identifier (used as payload in the MQTT message, see below) and path to executable.
Example file:
notepad = "c:/windows/system32/notepad.exe"
adobe = "c:\\program files\\adobe\\reader.exe"
Note you can use slash ' / ' or double backslash ' \\ ' as path separator.
You can open application log by clicking on the tray icon. To log into winthing.log file in the current working directory run WinThing with the -debug parameter.
winthing.exe -debug
If you intend to run WinThing on multiple devices, make sure you set the prefix parameter for each device. The default value is "winthing", eg. the topic for status is "winthing/system/online", your other computer would be "kitchenpc/system/online", your laptop "mylaptop/system/online" etc.
The payload of all messages is either empty or a valid JSON element (possibly a primitive, like a single integer). This means, specifically, that if an argument is supposed to be a single string, it should be sent in double quotes.
Example valid message payloads:
123
true
"notepad.exe"
[1024, 768]
["notepad.exe", "C:\\file.txt", "C:\\"]
(note that JSON string requires escaped backslash)
Topic: winthing/system/online
Payload: state:boolean
QoS: 2
Persistent: yes
True when WinThing is running, false otherwise. WinThing registers a "last will" message with the broker to notify clients when WinThing disconnects.
Topic: winthing/system/commands/shutdown
Payload: -
Trigger immediate system shutdown.
Topic: winthing/system/commands/reboot
Payload: -
Trigger immediate system reboot.
Topic: winthing/system/commands/suspend
Payload: -
Trigger immediate system suspend.
Topic: winthing/system/commands/hibernate
Payload: -
Trigger immediate system hibernate.
Topic: winthing/system/commands/run
Payload: [command:string, arguments:string, workingDirectory:string]
Run a command. Arguments and working directory are optional (empty string and null by default).
If whitelist is enabled, only the command as unique identifier is required. The identifier is checked against the whitelist file (see whitelist.ini above).
Topic: winthing/system/commands/open
Payload: uri:string
Opens an URI, like a website in a browser or a disk location in a file browser.
Topic: winthing/desktop/commands/close_active_window
Payload: -
Closes currently active window.
Topic: winthing/desktop/commands/set_display_sleep
Payload: displaySleep:boolean
Puts the display to sleep (on true) or wakes it up (on false).
Topic: winthing/keyboard/commands/press_keys
Payload: [key:string...]
Simulates pressing of given set of keyboard keys. Keys are specified by name. List of available key names and aliases can be found here.
Topic: winthing/radeon/commands/set_best_resolution
Payload: -
Sets the screen to the best available resolution.
Topic: winthing/radeon/commands/set_resolution
Payload: [widthInPixels:integer, heightInPixels:integer]
Sets the screen to the given resolution.
Copyright 2015-2016 Mikołaj Siedlarek <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.