Fix RFLink TCP KeepAlive error log (#47395)
parent
35d5522e79
commit
a1faba29f0
|
@ -203,25 +203,28 @@ async def async_setup(hass, config):
|
|||
# TCP port when host configured, otherwise serial port
|
||||
port = config[DOMAIN][CONF_PORT]
|
||||
|
||||
# TCP KEEPALIVE will be enabled if value > 0
|
||||
keepalive_idle_timer = config[DOMAIN][CONF_KEEPALIVE_IDLE]
|
||||
if keepalive_idle_timer < 0:
|
||||
_LOGGER.error(
|
||||
"A bogus TCP Keepalive IDLE timer was provided (%d secs), "
|
||||
"default value will be used. "
|
||||
"Recommended values: 60-3600 (seconds)",
|
||||
keepalive_idle_timer,
|
||||
)
|
||||
keepalive_idle_timer = DEFAULT_TCP_KEEPALIVE_IDLE_TIMER
|
||||
elif keepalive_idle_timer == 0:
|
||||
keepalive_idle_timer = None
|
||||
elif keepalive_idle_timer <= 30:
|
||||
_LOGGER.warning(
|
||||
"A very short TCP Keepalive IDLE timer was provided (%d secs), "
|
||||
"and may produce unexpected disconnections from RFlink device."
|
||||
" Recommended values: 60-3600 (seconds)",
|
||||
keepalive_idle_timer,
|
||||
)
|
||||
keepalive_idle_timer = None
|
||||
# TCP KeepAlive only if this is TCP based connection (not serial)
|
||||
if host is not None:
|
||||
# TCP KEEPALIVE will be enabled if value > 0
|
||||
keepalive_idle_timer = config[DOMAIN][CONF_KEEPALIVE_IDLE]
|
||||
if keepalive_idle_timer < 0:
|
||||
_LOGGER.error(
|
||||
"A bogus TCP Keepalive IDLE timer was provided (%d secs), "
|
||||
"it will be disabled. "
|
||||
"Recommended values: 60-3600 (seconds)",
|
||||
keepalive_idle_timer,
|
||||
)
|
||||
keepalive_idle_timer = None
|
||||
elif keepalive_idle_timer == 0:
|
||||
keepalive_idle_timer = None
|
||||
elif keepalive_idle_timer <= 30:
|
||||
_LOGGER.warning(
|
||||
"A very short TCP Keepalive IDLE timer was provided (%d secs) "
|
||||
"and may produce unexpected disconnections from RFlink device."
|
||||
" Recommended values: 60-3600 (seconds)",
|
||||
keepalive_idle_timer,
|
||||
)
|
||||
|
||||
@callback
|
||||
def reconnect(exc=None):
|
||||
|
|
Loading…
Reference in New Issue