Skip to content
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

Add configuration key for MQTT client ID #220

Merged
merged 1 commit into from
Aug 15, 2020
Merged
Changes from all commits
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
8 changes: 7 additions & 1 deletion insteon_mqtt/network/Mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def load_config(self, config):
- broker (str): The broker host to connect to.
- port (int): The broker port to connect to.
- username (str): Optional user name to log in with.
- passord (str): Optional password to log in with.
- password (str): Optional password to log in with.
- id (str): Optional MQTT client id (max 23 characters)

Args:
config (dict): Configuration data to load.
Expand All @@ -87,6 +88,11 @@ def load_config(self, config):
self.port = config['port']
self.keep_alive = config.get("keep_alive", self.keep_alive)

id = config.get("id")
if id is not None:
self.id = id
self.client.reinitialise(client_id=self.id, clean_session=False)

username = config.get('username', None)
if username is not None:
password = config.get('password', None)
Expand Down