Fix missing default reconnect interval in dsmr (#53760)

This commit is contained in:
Emilv2
2021-08-02 14:54:33 +02:00
committed by Paulus Schoutsen
parent 1c30967f6f
commit 1a1efecdba

View File

@@ -157,7 +157,9 @@ async def async_setup_entry(
update_entities_telegram({})
# throttle reconnect attempts
await asyncio.sleep(entry.data[CONF_RECONNECT_INTERVAL])
await asyncio.sleep(
entry.data.get(CONF_RECONNECT_INTERVAL, DEFAULT_RECONNECT_INTERVAL)
)
except (serial.serialutil.SerialException, OSError):
# Log any error while establishing connection and drop to retry
@@ -167,7 +169,9 @@ async def async_setup_entry(
protocol = None
# throttle reconnect attempts
await asyncio.sleep(entry.data[CONF_RECONNECT_INTERVAL])
await asyncio.sleep(
entry.data.get(CONF_RECONNECT_INTERVAL, DEFAULT_RECONNECT_INTERVAL)
)
except CancelledError:
if stop_listener:
stop_listener() # pylint: disable=not-callable