Skip to content

Commit

Permalink
local_ip for routing optional (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio committed Feb 20, 2021
1 parent a2bf05d commit 2d7a7f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions home-assistant-plugin/custom_components/xknx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,12 @@ def connection_config(self):

def connection_config_routing(self):
"""Return the connection_config if routing is configured."""
local_ip = self.config[DOMAIN][CONF_XKNX_ROUTING].get(
ConnectionSchema.CONF_XKNX_LOCAL_IP
)
local_ip = None
# all configuration variables for routing are optional
if self.config[DOMAIN][CONF_XKNX_ROUTING] is not None:
local_ip = self.config[DOMAIN][CONF_XKNX_ROUTING].get(
ConnectionSchema.CONF_XKNX_LOCAL_IP
)
return ConnectionConfig(
connection_type=ConnectionType.ROUTING, local_ip=local_ip
)
Expand Down
4 changes: 3 additions & 1 deletion home-assistant-plugin/custom_components/xknx/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class ConnectionSchema:
}
)

ROUTING_SCHEMA = vol.Schema({vol.Optional(CONF_XKNX_LOCAL_IP): cv.string})
ROUTING_SCHEMA = vol.Maybe(
vol.Schema({vol.Optional(CONF_XKNX_LOCAL_IP): cv.string})
)


class CoverSchema:
Expand Down

0 comments on commit 2d7a7f8

Please sign in to comment.