-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
added optional node_id to MQTT discovery #8096
Conversation
@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. |
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') |
There was a problem hiding this comment.
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.
18facb8
to
b5425a9
Compare
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. |
It's called |
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:
tox
run successfully. Your PR cannot be merged unless tests pass