Browse Source

default username to None

Jan-Piet Mens 7 years ago
parent
commit
8b75c9dc05
2 changed files with 4 additions and 1 deletions
  1. 2 0
      launcher.conf.example
  2. 2 1
      mqtt-launcher.py

+ 2 - 0
launcher.conf.example

@@ -3,6 +3,8 @@ logfile = 'logfile'
 mqtt_broker = 'localhost'       # default: 'localhost'
 mqtt_port = 1883                # default: 1883
 mqtt_clientid = 'mqtt-launcher-1'
+mqtt_username = None
+mqtt_password = None
 # mqtt_username = 'jane'
 # mqtt_password = 'secret'
 

+ 2 - 1
mqtt-launcher.py

@@ -143,7 +143,8 @@ if __name__ == '__main__':
     # Delays will be: 3, 6, 12, 24, 30, 30, ...
     #mqttc.reconnect_delay_set(delay=3, delay_max=30, exponential_backoff=True)
 
-    mqttc.username_pw_set(cf.get('mqtt_username'), cf.get('mqtt_password'))
+    if cf.get('mqtt_username') is not None:
+        mqttc.username_pw_set(cf.get('mqtt_username'), cf.get('mqtt_password'))
 
     mqttc.connect(cf.get('mqtt_broker', 'localhost'), int(cf.get('mqtt_port', '1883')), 60)