Rename mqtt_topic to default topic
This commit is contained in:
parent
59f32940f7
commit
53821074d6
|
@ -37,8 +37,8 @@ def main():
|
||||||
client_id = None
|
client_id = None
|
||||||
|
|
||||||
mqtt = MQTTClient(mcfg['host'], mcfg['user'], mcfg['password'], client_id)
|
mqtt = MQTTClient(mcfg['host'], mcfg['user'], mcfg['password'], client_id)
|
||||||
mqtt_topic = mcfg['sensor_topic']
|
default_mqtt_topic = mcfg.get('sensor_topic')
|
||||||
print("Connected to", mqtt.host, "with topic", mqtt_topic)
|
print("Connected to", mqtt.host, "with default topic", default_mqtt_topic)
|
||||||
mqtt.set_callback(sensorlib.Sensor.run_mqtt_callback)
|
mqtt.set_callback(sensorlib.Sensor.run_mqtt_callback)
|
||||||
|
|
||||||
sensors = []
|
sensors = []
|
||||||
|
@ -63,8 +63,8 @@ def main():
|
||||||
if sensor.HAS_SENSOR_DATA:
|
if sensor.HAS_SENSOR_DATA:
|
||||||
data = sensor.gen_datapoint()
|
data = sensor.gen_datapoint()
|
||||||
if debug:
|
if debug:
|
||||||
print(mqtt_topic, data)
|
print(default_mqtt_topic, data)
|
||||||
mqtt.send_data(mqtt_topic, data)
|
mqtt.send_data(default_mqtt_topic, data)
|
||||||
if not mqtt.is_async():
|
if not mqtt.is_async():
|
||||||
mqtt.process_mqtt()
|
mqtt.process_mqtt()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue