Increase timeout for coolmaster with swing (#87573)

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
amitfin 2023-03-14 10:47:26 +02:00 committed by GitHub
parent 2cb673db04
commit cbee1ba496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,8 +21,20 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Coolmaster from a config entry.""" """Set up Coolmaster from a config entry."""
host = entry.data[CONF_HOST] host = entry.data[CONF_HOST]
port = entry.data[CONF_PORT] port = entry.data[CONF_PORT]
if not entry.data.get(CONF_SWING_SUPPORT):
coolmaster = CoolMasterNet( coolmaster = CoolMasterNet(
host, port, swing_support=entry.data.get(CONF_SWING_SUPPORT, False) host,
port,
)
else:
# Swing support adds an additional request per unit. The requests are
# done in parallel, which can cause delays on the server. Therefore,
# we increase the request timeout to 5 seconds instead of 1.
coolmaster = CoolMasterNet(
host,
port,
read_timeout=5,
swing_support=True,
) )
try: try:
info = await coolmaster.info() info = await coolmaster.info()