Skip to content

Use SSL by default for MQTT #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions adafruit_funhouse/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,19 @@ def init_io_mqtt(self):
"Adafruit IO secrets are kept in secrets.py, please add them there!\n\n"
) from KeyError

return self.init_mqtt(IO_MQTT_BROKER, 1883, aio_username, aio_key, True)
return self.init_mqtt(
IO_MQTT_BROKER, MQTT.MQTT_TLS_PORT, aio_username, aio_key, True
)

# pylint: disable=too-many-arguments
def init_mqtt(self, broker, port=1883, username=None, password=None, use_io=False):
def init_mqtt(
self,
broker,
port=MQTT.MQTT_TLS_PORT,
Copy link
Member

@brentru brentru Apr 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I advise using a numeric '8883' instead of the TLS_PORT const, which reads nicer and less confusing to new users (don't have to dig into MQTT lib. code if they're trying to set a port for mosquito or home assistant).

Rest looks OK!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks.

username=None,
password=None,
use_io=False,
):
"""Initialize MQTT"""
self.connect()
self._mqtt_client = MQTT.MQTT(
Expand Down