Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions homeassistant/components/gios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from aiohttp.client_exceptions import ClientConnectorError
from async_timeout import timeout
from gios import ApiError, Gios, NoStationError
from gios import ApiError, Gios, InvalidSensorsData, NoStationError

from homeassistant.core import Config, HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
Expand Down Expand Up @@ -63,7 +63,12 @@ async def _async_update_data(self):
try:
with timeout(30):
await self.gios.update()
except (ApiError, NoStationError, ClientConnectorError) as error:
except (
ApiError,
NoStationError,
ClientConnectorError,
InvalidSensorsData,
) as error:
raise UpdateFailed(error)
if not self.gios.data:
raise UpdateFailed("Invalid sensors data")
Expand Down
11 changes: 2 additions & 9 deletions homeassistant/components/gios/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

from aiohttp.client_exceptions import ClientConnectorError
from async_timeout import timeout
from gios import ApiError, Gios, NoStationError
from gios import ApiError, Gios, InvalidSensorsData, NoStationError
import voluptuous as vol

from homeassistant import config_entries, exceptions
from homeassistant import config_entries
from homeassistant.const import CONF_NAME
from homeassistant.helpers.aiohttp_client import async_get_clientsession

Expand Down Expand Up @@ -43,9 +43,6 @@ async def async_step_user(self, user_input=None):
gios = Gios(user_input[CONF_STATION_ID], websession)
await gios.update()

if not gios.available:
raise InvalidSensorsData()

return self.async_create_entry(
title=user_input[CONF_STATION_ID], data=user_input,
)
Expand All @@ -59,7 +56,3 @@ async def async_step_user(self, user_input=None):
return self.async_show_form(
step_id="user", data_schema=DATA_SCHEMA, errors=errors
)


class InvalidSensorsData(exceptions.HomeAssistantError):
"""Error to indicate invalid sensors data."""
2 changes: 1 addition & 1 deletion homeassistant/components/gios/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"documentation": "https://www.home-assistant.io/integrations/gios",
"dependencies": [],
"codeowners": ["@bieniu"],
"requirements": ["gios==0.0.5"],
"requirements": ["gios==0.1.1"],
"config_flow": true
}
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ georss_qld_bushfire_alert_client==0.3
getmac==0.8.1

# homeassistant.components.gios
gios==0.0.5
gios==0.1.1

# homeassistant.components.gitter
gitterpy==0.1.7
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ georss_qld_bushfire_alert_client==0.3
getmac==0.8.1

# homeassistant.components.gios
gios==0.0.5
gios==0.1.1

# homeassistant.components.glances
glances_api==0.2.0
Expand Down