Fix various Daikin issues (#34249)

* various Daikin fixes

* make timeout a constant
pull/34260/head
Fredrik Erlandsson 2020-04-15 15:12:10 +02:00 committed by Paulus Schoutsen
parent 1b36a34ae4
commit 632d44c7b7
7 changed files with 11 additions and 9 deletions

View File

@ -77,7 +77,7 @@ homeassistant/components/counter/* @fabaff
homeassistant/components/cover/* @home-assistant/core homeassistant/components/cover/* @home-assistant/core
homeassistant/components/cpuspeed/* @fabaff homeassistant/components/cpuspeed/* @fabaff
homeassistant/components/cups/* @fabaff homeassistant/components/cups/* @fabaff
homeassistant/components/daikin/* @fredrike @rofrantz homeassistant/components/daikin/* @fredrike
homeassistant/components/darksky/* @fabaff homeassistant/components/darksky/* @fabaff
homeassistant/components/deconz/* @kane610 homeassistant/components/deconz/* @kane610
homeassistant/components/delijn/* @bollewolle homeassistant/components/delijn/* @bollewolle

View File

@ -17,6 +17,7 @@ from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.util import Throttle from homeassistant.util import Throttle
from . import config_flow # noqa: F401 from . import config_flow # noqa: F401
from .const import TIMEOUT
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -91,7 +92,7 @@ async def daikin_api_setup(hass, host):
session = hass.helpers.aiohttp_client.async_get_clientsession() session = hass.helpers.aiohttp_client.async_get_clientsession()
try: try:
with timeout(10): with timeout(TIMEOUT):
device = Appliance(host, session) device = Appliance(host, session)
await device.init() await device.init()
except asyncio.TimeoutError: except asyncio.TimeoutError:

View File

@ -10,7 +10,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.const import CONF_HOST from homeassistant.const import CONF_HOST
from .const import KEY_IP, KEY_MAC from .const import KEY_IP, KEY_MAC, TIMEOUT
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -38,7 +38,7 @@ class FlowHandler(config_entries.ConfigFlow):
device = Appliance( device = Appliance(
host, self.hass.helpers.aiohttp_client.async_get_clientsession() host, self.hass.helpers.aiohttp_client.async_get_clientsession()
) )
with timeout(10): with timeout(TIMEOUT):
await device.init() await device.init()
except asyncio.TimeoutError: except asyncio.TimeoutError:
return self.async_abort(reason="device_timeout") return self.async_abort(reason="device_timeout")

View File

@ -25,3 +25,5 @@ SENSOR_TYPES = {
KEY_MAC = "mac" KEY_MAC = "mac"
KEY_IP = "ip" KEY_IP = "ip"
TIMEOUT = 60

View File

@ -3,8 +3,7 @@
"name": "Daikin AC", "name": "Daikin AC",
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/daikin", "documentation": "https://www.home-assistant.io/integrations/daikin",
"requirements": ["pydaikin==1.6.2"], "requirements": ["pydaikin==1.6.3"],
"dependencies": [], "codeowners": ["@fredrike"],
"codeowners": ["@fredrike", "@rofrantz"],
"quality_scale": "platinum" "quality_scale": "platinum"
} }

View File

@ -1218,7 +1218,7 @@ pycsspeechtts==1.0.3
# pycups==1.9.73 # pycups==1.9.73
# homeassistant.components.daikin # homeassistant.components.daikin
pydaikin==1.6.2 pydaikin==1.6.3
# homeassistant.components.danfoss_air # homeassistant.components.danfoss_air
pydanfossair==0.1.0 pydanfossair==0.1.0

View File

@ -479,7 +479,7 @@ pychromecast==4.2.0
pycoolmasternet==0.0.4 pycoolmasternet==0.0.4
# homeassistant.components.daikin # homeassistant.components.daikin
pydaikin==1.6.2 pydaikin==1.6.3
# homeassistant.components.deconz # homeassistant.components.deconz
pydeconz==70 pydeconz==70