mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
Merge pull request #746 from adebrouvier/main
Some checks are pending
docker / docker_dev (push) Waiting to run
Some checks are pending
docker / docker_dev (push) Waiting to run
Add MQTT TLS support by @adebrouvier 🙏
This commit is contained in:
@@ -499,6 +499,38 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "TLS",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "MQTT TLS"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Enable TLS support."
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Habilitar soporte TLS."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "USER",
|
||||
"type": {
|
||||
|
||||
@@ -295,9 +295,11 @@ def mqtt_create_client():
|
||||
if get_setting_value('MQTT_VERSION') == 1:
|
||||
mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1)
|
||||
else:
|
||||
mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
|
||||
mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
|
||||
|
||||
if get_setting_value('MQTT_TLS'):
|
||||
mqtt_client.tls_set()
|
||||
|
||||
|
||||
mqtt_client.username_pw_set(get_setting_value('MQTT_USER'), get_setting_value('MQTT_PASSWORD'))
|
||||
mqtt_client.on_connect = on_connect
|
||||
mqtt_client.on_disconnect = on_disconnect
|
||||
|
||||
Reference in New Issue
Block a user