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

added optional node_id to MQTT discovery #8096

Merged

Conversation

AlexMekkering
Copy link
Contributor

@AlexMekkering AlexMekkering commented Jun 18, 2017

Description:

This PR adds support for an optional <node_id> level to MQTT discovery topics. This supports all config topics which match the pattern <prefix_topic>/<component>/[<node_id>/]<object_id>/config.
The purpose is to give other clients more means to only subscribe to their own command topics (e.g. when switches and/or lights are involved) by using one single wildcarded subscription topic like homeassistant/+/<own_node_id>/+/set instead of subscribing to every topic they're interested in.
When multiple MQTT clients are involved, this will minimize the load on them because they'll only get their own topics forwarded by the MQTT server.

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2840

Checklist:

  • Documentation added/updated in home-assistant.github.io
  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@mention-bot
Copy link

@AlexMekkering, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fabaff, @robbiet480 and @pvizeli to be potential reviewers.

@homeassistant
Copy link
Contributor

Hi @AlexMekkering,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

r'(?P<prefix_topic>\w+)/(?P<component>\w+)/(?P<object_id>[a-zA-Z0-9_-]+)'
'/config')
r'(?P<prefix_topic>\w+)/(?P<component>\w+)/(?:(?P<node_id>\w+)/)?'
r'(?P<object_id>[\w-]+)/config')
Copy link
Member

Choose a reason for hiding this comment

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

You've changed the matching algorithm of an object id to no longer match the object id validation that Home Assistant enforces. Please revert.

@AlexMekkering AlexMekkering force-pushed the mqtt_discovery_optional_nodeid branch from 18facb8 to b5425a9 Compare June 19, 2017 15:27
@AlexMekkering
Copy link
Contributor Author

I've reverted the matching algo of the object_id (and treated the node_id alike) but I don't see why it should matter; the object_id isn't used for anything other then checking whether it was already discovered, it isn't passed to async_load_platform.

@balloob
Copy link
Member

balloob commented Jun 24, 2017

It's called object_id and thus has to match our object id validation. Otherwise if we do want to use it in the future, we would have to introduce a breaking change

@balloob balloob merged commit c109566 into home-assistant:dev Jun 24, 2017
@AlexMekkering AlexMekkering deleted the mqtt_discovery_optional_nodeid branch June 24, 2017 10:16
@balloob balloob mentioned this pull request Jul 1, 2017
dethpickle pushed a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Oct 20, 2017
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.

4 participants