mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Fix mysensors gateway windows setup (#6500)
This commit is contained in:
parent
44da43065f
commit
13dd17b2ab
@ -164,6 +164,13 @@ def setup(hass, config):
|
|||||||
protocol_version=version, in_prefix=in_prefix,
|
protocol_version=version, in_prefix=in_prefix,
|
||||||
out_prefix=out_prefix, retain=retain)
|
out_prefix=out_prefix, retain=retain)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
is_serial_port(device)
|
||||||
|
gateway = mysensors.SerialGateway(
|
||||||
|
device, event_callback=None, persistence=persistence,
|
||||||
|
persistence_file=persistence_file,
|
||||||
|
protocol_version=version, baud=baud_rate)
|
||||||
|
except vol.Invalid:
|
||||||
try:
|
try:
|
||||||
socket.getaddrinfo(device, None)
|
socket.getaddrinfo(device, None)
|
||||||
# valid ip address
|
# valid ip address
|
||||||
@ -173,10 +180,7 @@ def setup(hass, config):
|
|||||||
protocol_version=version, port=tcp_port)
|
protocol_version=version, port=tcp_port)
|
||||||
except OSError:
|
except OSError:
|
||||||
# invalid ip address
|
# invalid ip address
|
||||||
gateway = mysensors.SerialGateway(
|
return
|
||||||
device, event_callback=None, persistence=persistence,
|
|
||||||
persistence_file=persistence_file,
|
|
||||||
protocol_version=version, baud=baud_rate)
|
|
||||||
gateway.metric = hass.config.units.is_metric
|
gateway.metric = hass.config.units.is_metric
|
||||||
gateway.debug = config[DOMAIN].get(CONF_DEBUG)
|
gateway.debug = config[DOMAIN].get(CONF_DEBUG)
|
||||||
optimistic = config[DOMAIN].get(CONF_OPTIMISTIC)
|
optimistic = config[DOMAIN].get(CONF_OPTIMISTIC)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user