/WMRService

WMR weather station data service

Primary LanguageJavaMIT LicenseMIT

WMRService

##Installation

  1. 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.
  2. Copy WMRService.jar and WMRService.properties to a folder.
    • The provided WMRService.jar file includes the JAR dependencies, nothing else to copy/install.
  3. 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 otherwise
    • MQTTpassword password for MQTT broker authentication
  4. Edit WMRService.properties to provide optional values for:
    • MQTTrootTopic root topic for MQTT messages from the WMRService, default value is WMR100
    • MQTTclientId MQTT client ID for publisher, default value is WMR100
    • 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 is 30
    • minCommandsInInterval minimum number of commands expecting in a monitoring interval, used to determine if the WMR device is still alive and sending. Default is 5 (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 is C
    • windSpeedUnits units for wind speed sensors, either mph, kt, or mps (case insensitive). Default is mps
    • pressureUnits units for pressure sensors, either mmhg, inhg, or mbar (case insensitive). Default is mbar
    • rainUnits units for rain sensors, either in or mm (case insensitive). Default is in
  5. 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

##Building

  1. The 3 dependent JARs must be on the classpath