mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-01 23:48:24 +02:00
Added options for TLS usage for MQTT client and insecure certificate handling
This commit is contained in:
parent
e1c713fb00
commit
616e889e94
2 changed files with 7 additions and 0 deletions
|
@ -16,6 +16,8 @@ ahoy:
|
|||
port: 1883
|
||||
user: 'username'
|
||||
password: 'password'
|
||||
useTLS: False
|
||||
insecureTLS: False #set True for e.g. self signed certificates.
|
||||
|
||||
# Influx2 output
|
||||
influxdb:
|
||||
|
|
|
@ -226,6 +226,11 @@ if __name__ == '__main__':
|
|||
mqtt_config = ahoy_config.get('mqtt', [])
|
||||
if not mqtt_config.get('disabled', False):
|
||||
mqtt_client = paho.mqtt.client.Client()
|
||||
|
||||
if mqtt_config.get('useTLS',False):
|
||||
mqtt_client.tls_set()
|
||||
mqtt_client.tls_insecure_set(mqtt_config.get('insecureTLS',False))
|
||||
|
||||
mqtt_client.username_pw_set(mqtt_config.get('user', None), mqtt_config.get('password', None))
|
||||
mqtt_client.connect(mqtt_config.get('host', '127.0.0.1'), mqtt_config.get('port', 1883))
|
||||
mqtt_client.loop_start()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue