diff --git a/gamutrf/mqtt_reporter.py b/gamutrf/mqtt_reporter.py index 1e21e7aa..c364ba06 100644 --- a/gamutrf/mqtt_reporter.py +++ b/gamutrf/mqtt_reporter.py @@ -72,7 +72,17 @@ def get_heading(self): logging.error("could not update heading: %s", err) def add_gps(self, publish_args): - if not self.gps_server or not self.use_external_gps: + if not self.gps_server and not self.external_gps_server: + logging.error("no gps_server or external_gps_server found") + return publish_args + if ( + self.external_gps_server + and not self.use_external_gps + and not self.gps_server + ): + logging.error( + "only external_gps_server found, but no use_external_gps flag" + ) return publish_args publish_args.update( { diff --git a/gamutrf/worker.py b/gamutrf/worker.py index b53e9b49..8082a4f1 100644 --- a/gamutrf/worker.py +++ b/gamutrf/worker.py @@ -95,6 +95,12 @@ def argument_parser(): default=ORCHESTRATOR, type=str, ) + parser.add_argument( + "--gps_server", + help="GPS Server to get lat,long, and heading", + default=ORCHESTRATOR, + type=str, + ) parser.add_argument( "--rssi_interval", help="rate limit in seconds for RSSI updates to MQTT", @@ -252,7 +258,7 @@ def __init__(self, arguments): self.mqtt_reporter = MQTTReporter( name=self.arguments.name, mqtt_server=self.arguments.mqtt_server, - gps_server=ORCHESTRATOR, + gps_server=self.arguments.gps_server, compass=True, use_external_gps=self.arguments.use_external_gps, use_external_heading=self.arguments.use_external_heading, diff --git a/tests/test_api.py b/tests/test_api.py index 04c8385b..a24a79ce 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -9,6 +9,7 @@ class FakeArgs: def __init__(self): self.name = "test" self.mqtt_server = "" + self.gps_server = "" self.use_external_gps = False self.use_external_heading = False self.external_gps_server = ""