diff --git a/mqtt_sensord/mqtt_sensord.py b/mqtt_sensord/mqtt_sensord.py index 8c32012..ae4efb9 100755 --- a/mqtt_sensord/mqtt_sensord.py +++ b/mqtt_sensord/mqtt_sensord.py @@ -37,8 +37,8 @@ def main(): client_id = None mqtt = MQTTClient(mcfg['host'], mcfg['user'], mcfg['password'], client_id) - mqtt_topic = mcfg['sensor_topic'] - print("Connected to", mqtt.host, "with topic", mqtt_topic) + default_mqtt_topic = mcfg.get('sensor_topic') + print("Connected to", mqtt.host, "with default topic", default_mqtt_topic) mqtt.set_callback(sensorlib.Sensor.run_mqtt_callback) sensors = [] @@ -63,8 +63,8 @@ def main(): if sensor.HAS_SENSOR_DATA: data = sensor.gen_datapoint() if debug: - print(mqtt_topic, data) - mqtt.send_data(mqtt_topic, data) + print(default_mqtt_topic, data) + mqtt.send_data(default_mqtt_topic, data) if not mqtt.is_async(): mqtt.process_mqtt()