Open Nailik opened 3 years ago
I'll take a look at it. I will need to first setup an MQTT server that requires TLS.
Would be awesome.
Script stacktrace:
2020-12-31 15:25:11 DEBUG (MainThread) [homeassistant.components.shell_command] Stderr of command: `python3 /config/python_scripts/meater_reader_v2.py`, return code: 1:
b'Traceback (most recent call last):\n File "/config/python_scripts/meater_reader_v2.py", line 198, in <module>\n mqttc.connect(MQTT_HOSTNAME, MQTT_PORT, MQTT_TIMEOUT)\n File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 941, in connect\n return self.reconnect()\n File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1104, in reconnect\n sock.do_handshake()\n File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake\n self._sslobj.do_handshake()\nConnectionResetError: [Errno 104] Connection reset by peer\n'
2020-12-31 15:25:11 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `python3 /config/python_scripts/meater_reader_v2.py`, return code: 1
NoneType: None
MQTT Log
1609424710: New connection from 192.168.178.87 on port 1883.
1609424710: Socket error on client <unknown>, disconnecting.
MQTT Setup (i use the hass addon)
logins:
- username: '!secret mqtt_account'
password: '!secret mqtt_password'
anonymous: false
customize:
active: false
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: true
It also fails wenn i add mqttc.tls_set
and set require_certificate: false
mqtt user auth has been added, although not tested.
Hello,
please add support when MQTT is set to require certificate and doesn't allow anonymous users. The thing with the user is pretty easy and i got it to work but the certificate just wont work.
I tried:
mqttc.tls_set("/ssl/fullchain.pem", tls_version=ssl.PROTOCOL_TLSv1_2)