mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-06 09:58:23 +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
|
port: 1883
|
||||||
user: 'username'
|
user: 'username'
|
||||||
password: 'password'
|
password: 'password'
|
||||||
|
useTLS: False
|
||||||
|
insecureTLS: False #set True for e.g. self signed certificates.
|
||||||
|
|
||||||
# Influx2 output
|
# Influx2 output
|
||||||
influxdb:
|
influxdb:
|
||||||
|
|
|
@ -226,6 +226,11 @@ if __name__ == '__main__':
|
||||||
mqtt_config = ahoy_config.get('mqtt', [])
|
mqtt_config = ahoy_config.get('mqtt', [])
|
||||||
if not mqtt_config.get('disabled', False):
|
if not mqtt_config.get('disabled', False):
|
||||||
mqtt_client = paho.mqtt.client.Client()
|
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.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.connect(mqtt_config.get('host', '127.0.0.1'), mqtt_config.get('port', 1883))
|
||||||
mqtt_client.loop_start()
|
mqtt_client.loop_start()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue