Skip to content

Commit

Permalink
Merge pull request #220 from kpfleming/add-mqtt-client-id-config
Browse files Browse the repository at this point in the history
Add configuration key for MQTT client ID
  • Loading branch information
TD22057 authored Aug 15, 2020
2 parents dd966fb + a8a0854 commit cdc0099
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit cdc0099

Please sign in to comment.