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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT config entry #16594

Merged
merged 5 commits into from
Sep 14, 2018
Merged

MQTT config entry #16594

merged 5 commits into from
Sep 14, 2018

Conversation

balloob
Copy link
Member

@balloob balloob commented Sep 13, 2018

Description:

This adds config entry support to MQTT. It's initially just limited to configuring just broker, port, username and password (last 2 are optional). I don't want to expose all advanced features, so this is a good start. Eventually I would want to add discovery, but that is little tricky as discovery requires access to the configuration.yaml.

This config entry takes a different approach than the other config entries: if a manual configuration is available, it will fail to setup the config entry. I'm actually not happy with that and will rework it, hence the WIP tag.

It takes a slight different import to import than other config entries. Instead of absorbing the auth into an entry, it doesn't load anything and keeps loading from configuration.yaml. If the user removes configuration.yaml MQTT entry, the config entry will be removed.

Once this PR is in, we can add support for Hass.io add-ons discovering MQTT config entry 馃憤

Depends on home-assistant/frontend#1662

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

Example entry for configuration.yaml (if applicable):

# None! :-)

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.



@asyncio.coroutine
def test_setup_without_tls_config_uses_tlsv1_under_python36(hass):
async def test_setup_without_tls_config_uses_tlsv1_under_python36(hass, mock_MQTT):

Choose a reason for hiding this comment

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

line too long (83 > 79 characters)



@asyncio.coroutine
def test_setup_uses_certificate_on_certificate_set_to_auto(hass):
async def test_setup_uses_certificate_on_certificate_set_to_auto(hass, mock_MQTT):

Choose a reason for hiding this comment

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

line too long (82 > 79 characters)

certificate = os.path.join(os.path.dirname(__file__),
'addtrustexternalcaroot.crt')
'addtrustexternalcaroot.crt')

Choose a reason for hiding this comment

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

continuation line over-indented for visual indent

@balloob balloob changed the title WIP: MQTT config entry MQTT config entry Sep 13, 2018
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good!

@balloob balloob merged commit 72e746d into dev Sep 14, 2018
@balloob balloob deleted the mqtt-config-entry branch September 14, 2018 09:57
@ghost ghost removed the in progress label Sep 14, 2018
@balloob balloob mentioned this pull request Sep 28, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants