diff --git a/README.md b/README.md index 6843706..8cd51f5 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Messages with missing `tags` or `annotation` will be ignored. The `annotation` k - the `-H`, `-U` and MQTT broker hostname/port arguments are required - the file can look like this (no double quotes): ``` -ARGS=-U http://localhost:3000 -t "foo/bar" -c /srv/mq2anno/config.json -l debug localhost 1883 +ARGS=-U http://localhost:3000 -c /srv/mq2anno/config.json -l debug localhost 1883 ``` - setup the service (assumes the `pi` user) ``` diff --git a/mq2anno.py b/mq2anno.py index 102cc64..d3d6126 100755 --- a/mq2anno.py +++ b/mq2anno.py @@ -151,13 +151,6 @@ def main(): topic_config = json.load(file_handle) logger.debug(f"Got config: {topic_config}") - # Check that each specific topic has a payload template in the configuration. - # The contents of the template are not checked. - logger.debug(f"Checking configuration for topics {args.topic}") - for topic in args.topic: - if topic not in topic_config.keys(): - raise FatalError(f"no configuration for topic '{topic}'") - client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2) user_data = Userdata(topic_config, args.grafana_url, headers) client.user_data_set(user_data) @@ -172,7 +165,7 @@ def main(): except OSError as exc: raise FatalError("MQTT connect error") from exc - for topic in args.topic: + for topic in topic_config.keys(): logger.info(f"Subscribing to topic {topic}") client.subscribe(topic) @@ -208,13 +201,6 @@ def handle_args(): required=True, help="base URL for the Grafana server", ) - parser.add_argument( - "-t", - "--topic", - required=True, - action="append", - help="MQTT topic to subscribe to", - ) parser.add_argument( "-c", "--config",