|
|
|
@ -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()
|
|
|
|
|
|
|
|
|
|