Quick fix for: Initial discovery of Gateways works fine, but when starting the integration with all gateways configured it can't find any gateway#27
Open
uschindler wants to merge 1 commit intoPlusPlus-ua:mainfrom
Conversation
…rting the integration with all gateways configured it can't find any gateway
b16526b to
e7b9856
Compare
Contributor
|
if I have time in the evening, I will add it to mine. Sorry I just got to it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This closes #26
Hi @Iminet72, this is the "quick fix" to make at least the configuration of the discovered gateway on startup using the same source address like the initial discovery.
It works for me, but the fix here is not working well if a user has multiple interfaces enabled in HASS network configuration. Basically for every enabled network interface (enabled in HASS config), the code needs to send a separate discovery or update request to the corresponding broadcast address of the network interface.
For this both code parts need to be a loop:
I will check tomorrow and possibly open another PR to fix the discovery "correctly" - like it is done in HASS core code (for discovery of several device types like shelly components, yeelight). They use always the same pattern, e.g. here for shelly devices:
https://github.com/home-assistant/core/blob/94534f714cf4f2e5cecc6c1d569609325a1d08da/homeassistant/components/shelly/utils.py#L225-L241
So basically the code must look like this - for discovery and also for configuring a single gateway (as we do not know where is it connected at and communication to gateway only works via broadcast).