Browse Source

Added options for TLS usage for MQTT client and insecure certificate handling

pull/152/head
ngt-github 3 years ago
parent
commit
616e889e94
  1. 2
      tools/rpi/ahoy.yml.example
  2. 5
      tools/rpi/hoymiles/__main__.py

2
tools/rpi/ahoy.yml.example

@ -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:

5
tools/rpi/hoymiles/__main__.py

@ -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…
Cancel
Save