Bump `gios` to version 6.0.0 (#139832)

* Fix the code

* Fix tests

* Bump version

* Use https for configuration URL
pull/139846/head
Maciej Bieniek 2025-03-05 15:04:56 +01:00 committed by GitHub
parent 61e0b938ae
commit c69cec28fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 17 additions and 10 deletions

View File

@ -4,9 +4,14 @@ from __future__ import annotations
import logging
from aiohttp.client_exceptions import ClientConnectorError
from gios import Gios
from gios.exceptions import GiosError
from homeassistant.components.air_quality import DOMAIN as AIR_QUALITY_PLATFORM
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -36,8 +41,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: GiosConfigEntry) -> bool
device_registry.async_update_device(device_entry.id, new_identifiers={new_ids})
websession = async_get_clientsession(hass)
try:
gios = await Gios.create(websession, station_id)
except (GiosError, ConnectionError, ClientConnectorError) as err:
raise ConfigEntryNotReady from err
coordinator = GiosDataUpdateCoordinator(hass, entry, websession, station_id)
coordinator = GiosDataUpdateCoordinator(hass, entry, gios)
await coordinator.async_config_entry_first_refresh()
entry.runtime_data = GiosData(coordinator)

View File

@ -37,7 +37,7 @@ class GiosFlowHandler(ConfigFlow, domain=DOMAIN):
websession = async_get_clientsession(self.hass)
async with asyncio.timeout(API_TIMEOUT):
gios = Gios(user_input[CONF_STATION_ID], websession)
gios = await Gios.create(websession, user_input[CONF_STATION_ID])
await gios.async_update()
assert gios.station_name is not None

View File

@ -13,7 +13,7 @@ SCAN_INTERVAL: Final = timedelta(minutes=30)
DOMAIN: Final = "gios"
MANUFACTURER: Final = "Główny Inspektorat Ochrony Środowiska"
URL = "http://powietrze.gios.gov.pl/pjp/current/station_details/info/{station_id}"
URL = "https://powietrze.gios.gov.pl/pjp/current/station_details/info/{station_id}"
API_TIMEOUT: Final = 30

View File

@ -6,7 +6,6 @@ import asyncio
from dataclasses import dataclass
import logging
from aiohttp import ClientSession
from aiohttp.client_exceptions import ClientConnectorError
from gios import Gios
from gios.exceptions import GiosError
@ -39,11 +38,10 @@ class GiosDataUpdateCoordinator(DataUpdateCoordinator[GiosSensors]):
self,
hass: HomeAssistant,
config_entry: GiosConfigEntry,
session: ClientSession,
station_id: int,
gios: Gios,
) -> None:
"""Class to manage fetching GIOS data API."""
self.gios = Gios(station_id, session)
self.gios = gios
super().__init__(
hass,

View File

@ -7,5 +7,5 @@
"integration_type": "service",
"iot_class": "cloud_polling",
"loggers": ["dacite", "gios"],
"requirements": ["gios==5.0.0"]
"requirements": ["gios==6.0.0"]
}

2
requirements_all.txt generated
View File

@ -1008,7 +1008,7 @@ georss-qld-bushfire-alert-client==0.8
getmac==0.9.5
# homeassistant.components.gios
gios==5.0.0
gios==6.0.0
# homeassistant.components.gitter
gitterpy==0.1.7

View File

@ -861,7 +861,7 @@ georss-qld-bushfire-alert-client==0.8
getmac==0.9.5
# homeassistant.components.gios
gios==5.0.0
gios==6.0.0
# homeassistant.components.glances
glances-api==0.8.0