Skip to content
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
6 changes: 5 additions & 1 deletion homeassistant/components/mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ def async_setup(hass, config):
if conf is None:
conf = CONFIG_SCHEMA({DOMAIN: {}})[DOMAIN]

client_id = conf.get(CONF_CLIENT_ID)
# Remove the generation of the client_id after it's fixed in HBMQTT
import random
client_id = conf.get(
CONF_CLIENT_ID, 'home-assistant-{}'.format(random.randrange(0, 1000)))

@karlw00t karlw00t Jul 4, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we check to make sure the protocol is 3.1.1? I think with 3.1, zero length clientIds are supported by the pano-mqtt client. That being said, it just generates a random clientId for you, but who knows if someone depends on that.

Another option is to set the protocol to 3.1.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we check to make sure the protocol is 3.1.1?

We could but I see no benefit. Isn't it highly unlikely that somebody depends on a random generated ID? My assumption was that if you depend on the client ID then it's configured already.

Another option is to set the protocol to 3.1.

As far as I remember is HBMQTT only supporting MQTT 3.1.1.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes HBMQTT support only 3.1.1

#client_id = conf.get(CONF_CLIENT_ID)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

block comment should start with '# '

keepalive = conf.get(CONF_KEEPALIVE)

# Only setup if embedded config passed in or no broker specified
Expand Down