##Installation
- Prerequisites:
- Windows (Windows 7+ thought to work, Windows 10 tested).
- WMR-100 or compatible device plugged in via USB to the Windows computer.
- MQTT broker running and network accessible.
- Java JRE 8 (1.8) or later.
- Copy WMRService.jar and WMRService.properties to a folder.
- The provided WMRService.jar file includes the JAR dependencies, nothing else to copy/install.
- Edit WMRService.properties to provide MQTT broker connection information:
MQTTbroker
tcp address for the MQTT broker, e.g.tcp://mybroker:1883
MQTTuser
username if MQTT broker is using username/password authentication, blank otherwiseMQTTpassword
password for MQTT broker authentication
- Edit WMRService.properties to provide optional values for:
MQTTrootTopic
root topic for MQTT messages from the WMRService, default value isWMR100
MQTTclientId
MQTT client ID for publisher, default value isWMR100
monitoringInterval
number of seconds between device monitoring output written to the console. This is also used to detect if the WMR has gone dead. Default value is30
minCommandsInInterval
minimum number of commands expecting in a monitoring interval, used to determine if the WMR device is still alive and sending. Default is5
(empirically appropriate for a monitoringInternval value of 30)maxReportingRate
number of seconds between sensor value messages (implements throttling). Default is 60, which means sensor values are sent no more frequently than every 60 seconds for each sensor. Setting to 0 removes throttling, meaning that as soon as the WMR reports a sensor value it is sent. There is no guarantee on when the WMR sends sensor values.tempUnits
units for temperature sensors, either F or C (case insensitive). Default isC
windSpeedUnits
units for wind speed sensors, either mph, kt, or mps (case insensitive). Default ismps
pressureUnits
units for pressure sensors, either mmhg, inhg, or mbar (case insensitive). Default ismbar
rainUnits
units for rain sensors, either in or mm (case insensitive). Default isin
- Start the service
- Run the JAR file from the command line:
java -jar WMRService.jar
- Or install as a service using the NSSM utility to create a Windows service that runs automatically on startup
- From the command line:
nssm.exe install WMRService
- In the installation dialog:
- set Application path to the java.exe from the installed JRE
- set Startup directory to the directory with WMRService.jar
- set _Arguments to
-jar WMRservice.jar
- on the Details tab provide a nice Display name and Description
- on the I/O tab specify a file for Output and Error redirection (e.g. WMRService.out and WMRService.err)
- on the File rotation tab check Rotate Files and Rotate while service is running and use 86400 secs for rotation 1x per day
- From the command line:
- Run the JAR file from the command line:
##Building
- The 3 dependent JARs must be on the classpath
- hid4java.jar- hid4java supports USB HID devices through a cross-platform API
- jna-4.0.0.jar - Java Native Access library required by hid4java
- org.eclipse.paho.client.mqttv3_1.1.0.jar - Eclipse Paho MQTT client