-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Auto detection of local ip #184
Conversation
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.
It looks good :) I have some stylistic comments, but i am happy to discuss if you think I'm wrong ..
self.xknx.logger.debug( | ||
"No interface on same subnet as gateway found. Falling back to default gateway.") | ||
default_gateway = _find_default_gateway() | ||
local_ip = _scan_interfaces(default_gateway) |
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.
Shall we try: except:
and raise
here?
xknx/core/config.py
Outdated
self._parse_connection_prefs(ConnectionType.AUTOMATIC, prefs) | ||
elif conn.startswith("tunneling"): | ||
elif conn == "tunneling": | ||
self._parse_connection_prefs(ConnectionType.TUNNELING, prefs) |
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.
Shall we raise if tunneling:
is used without gateway_ip:
? Or maybe just logger.warning
and fall back to ConnectionType.AUTOMATIC ?
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.
I think we should raise ...
scan_filter.tunnelling = True | ||
elif connection_type == ConnectionType.ROUTING: | ||
scan_filter.routing = True | ||
self.scan_filter = scan_filter |
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.
GatewayScanFilter now accounting ConnectionType on initialization. I was thinking it wouldn't make sense to scan for routers if a tunneling connection shall be made (and vice versa).
Make
local_ip
optional for tunneling and routing ConnectionConfig.Tunnelling
Routing
local_ip
is configured KNXIPInterface is started like Automatic with a GatewayScanFilter searching only routing devices. If the filter is set only routing connections will be made.