Merge pull request #585 from home-assistant/dev

Release 117
This commit is contained in:
Pascal Vizeli 2018-07-21 20:21:18 +02:00 committed by GitHub
commit f2bf8dea93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 30 deletions

View File

@ -2,7 +2,7 @@
from pathlib import Path
from ipaddress import ip_network
HASSIO_VERSION = '116'
HASSIO_VERSION = '117'
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
URL_HASSIO_VERSION = \

View File

@ -6,8 +6,7 @@ import logging
from .coresys import CoreSysAttributes
from .const import (
STARTUP_SYSTEM, STARTUP_SERVICES, STARTUP_APPLICATION, STARTUP_INITIALIZE)
from .exceptions import HassioError
from .utils.dt import fetch_timezone
from .exceptions import HassioError, HomeAssistantError
_LOGGER = logging.getLogger(__name__)
@ -21,11 +20,6 @@ class HassIO(CoreSysAttributes):
async def setup(self):
"""Setup HassIO orchestration."""
# update timezone
if self.sys_config.timezone == 'UTC':
self.sys_config.timezone = \
await fetch_timezone(self.sys_websession)
# Load Supervisor
await self.sys_supervisor.load()
@ -93,7 +87,8 @@ class HassIO(CoreSysAttributes):
# run HomeAssistant
if self.sys_homeassistant.boot:
await self.sys_homeassistant.start()
with suppress(HomeAssistantError):
await self.sys_homeassistant.start()
# start addon mark as application
await self.sys_addons.boot(STARTUP_APPLICATION)

View File

@ -1,4 +1,5 @@
"""HassOS support on supervisor."""
import asyncio
import logging
from pathlib import Path
@ -92,7 +93,7 @@ class HassOS(CoreSysAttributes):
_LOGGER.info("OTA update is downloaded on %s", raucb)
return raucb
except aiohttp.ClientError as err:
except (aiohttp.ClientError, asyncio.TimeoutError) as err:
_LOGGER.warning("Can't fetch versions from %s: %s", url, err)
except OSError as err:

View File

@ -393,7 +393,7 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
headers[hdrs.AUTHORIZATION] = f'Bearer {self.access_token}'
async with getattr(self.sys_websession_ssl, method)(
url, timeout=timeout, json=json
url, timeout=timeout, json=json, headers=headers
) as resp:
# Access token expired
if resp.status == 401 and self.refresh_token:

View File

@ -1,4 +1,5 @@
"""HomeAssistant control object."""
import asyncio
import logging
from pathlib import Path
from tempfile import TemporaryDirectory
@ -60,7 +61,7 @@ class Supervisor(CoreSysAttributes):
async with self.sys_websession.get(url, timeout=10) as request:
data = await request.text()
except aiohttp.ClientError as err:
except (aiohttp.ClientError, asyncio.TimeoutError) as err:
_LOGGER.warning("Can't fetch AppArmor profile: %s", err)
return

View File

@ -1,4 +1,5 @@
"""Fetch last versions from webserver."""
import asyncio
from contextlib import suppress
from datetime import timedelta
import json
@ -81,7 +82,7 @@ class Updater(JsonConfig, CoreSysAttributes):
async with self.sys_websession.get(url, timeout=10) as request:
data = await request.json(content_type=None)
except aiohttp.ClientError as err:
except (aiohttp.ClientError, asyncio.TimeoutError) as err:
_LOGGER.warning("Can't fetch versions from %s: %s", url, err)
raise HassioUpdaterError() from None

View File

@ -3,7 +3,6 @@ from datetime import datetime, timedelta, timezone
import logging
import re
import aiohttp
import pytz
UTC = pytz.utc
@ -23,22 +22,6 @@ DATETIME_RE = re.compile(
)
async def fetch_timezone(websession):
"""Read timezone from freegeoip."""
data = {}
try:
async with websession.get(FREEGEOIP_URL, timeout=10) as request:
data = await request.json()
except aiohttp.ClientError as err:
_LOGGER.warning("Can't fetch freegeoip data: %s", err)
except ValueError as err:
_LOGGER.warning("Error on parse freegeoip data: %s", err)
return data.get('time_zone', 'UTC')
# Copyright (c) Django Software Foundation and individual contributors.
# All rights reserved.
# https://github.com/django/django/blob/master/LICENSE