Bump `gios` library to version 3.1.0 (#89044)
parent
b407227d4a
commit
1538f639ae
|
@ -7,7 +7,8 @@ from typing import Any, cast
|
|||
from aiohttp import ClientSession
|
||||
from aiohttp.client_exceptions import ClientConnectorError
|
||||
from async_timeout import timeout
|
||||
from gios import ApiError, Gios, InvalidSensorsData, NoStationError
|
||||
from gios import Gios
|
||||
from gios.exceptions import GiosError
|
||||
|
||||
from homeassistant.components.air_quality import DOMAIN as AIR_QUALITY_PLATFORM
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -89,10 +90,5 @@ class GiosDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
try:
|
||||
async with timeout(API_TIMEOUT):
|
||||
return cast(dict[str, Any], await self.gios.async_update())
|
||||
except (
|
||||
ApiError,
|
||||
NoStationError,
|
||||
ClientConnectorError,
|
||||
InvalidSensorsData,
|
||||
) as error:
|
||||
except (GiosError, ClientConnectorError) as error:
|
||||
raise UpdateFailed(error) from error
|
||||
|
|
|
@ -6,7 +6,7 @@ from typing import Any
|
|||
|
||||
from aiohttp.client_exceptions import ClientConnectorError
|
||||
from async_timeout import timeout
|
||||
from gios import ApiError, Gios, InvalidSensorsData, NoStationError
|
||||
from gios import ApiError, Gios, InvalidSensorsDataError, NoStationError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
|
@ -50,7 +50,7 @@ class GiosFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
errors["base"] = "cannot_connect"
|
||||
except NoStationError:
|
||||
errors[CONF_STATION_ID] = "wrong_station_id"
|
||||
except InvalidSensorsData:
|
||||
except InvalidSensorsDataError:
|
||||
errors[CONF_STATION_ID] = "invalid_sensors_data"
|
||||
|
||||
return self.async_show_form(
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
"iot_class": "cloud_polling",
|
||||
"loggers": ["dacite", "gios"],
|
||||
"quality_scale": "platinum",
|
||||
"requirements": ["gios==2.3.0"]
|
||||
"requirements": ["gios==3.1.0"]
|
||||
}
|
||||
|
|
|
@ -60,6 +60,10 @@ SENSOR_TYPES: tuple[GiosSensorEntityDescription, ...] = (
|
|||
key=ATTR_AQI,
|
||||
name="AQI",
|
||||
value=None,
|
||||
icon="mdi:air-filter",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=["very_bad", "bad", "sufficient", "moderate", "good", "very_good"],
|
||||
translation_key="aqi",
|
||||
),
|
||||
GiosSensorEntityDescription(
|
||||
key=ATTR_C6H6,
|
||||
|
|
|
@ -22,5 +22,19 @@
|
|||
"info": {
|
||||
"can_reach_server": "Reach GIO\u015a server"
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"aqi": {
|
||||
"state": {
|
||||
"very_bad": "Very bad",
|
||||
"bad": "Bad",
|
||||
"sufficient": "Sufficient",
|
||||
"moderate": "Moderate",
|
||||
"good": "Good",
|
||||
"very_good": "Very good"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -786,7 +786,7 @@ georss_qld_bushfire_alert_client==0.5
|
|||
getmac==0.8.2
|
||||
|
||||
# homeassistant.components.gios
|
||||
gios==2.3.0
|
||||
gios==3.1.0
|
||||
|
||||
# homeassistant.components.gitter
|
||||
gitterpy==0.1.7
|
||||
|
|
|
@ -602,7 +602,7 @@ georss_qld_bushfire_alert_client==0.5
|
|||
getmac==0.8.2
|
||||
|
||||
# homeassistant.components.gios
|
||||
gios==2.3.0
|
||||
gios==3.1.0
|
||||
|
||||
# homeassistant.components.glances
|
||||
glances_api==0.4.1
|
||||
|
|
|
@ -3,48 +3,48 @@
|
|||
"name": "AQI",
|
||||
"id": null,
|
||||
"index": null,
|
||||
"value": "dobry"
|
||||
"value": "good"
|
||||
},
|
||||
"c6h6": {
|
||||
"name": "benzen",
|
||||
"name": "benzene",
|
||||
"id": 658,
|
||||
"index": "bardzo dobry",
|
||||
"index": "very_good",
|
||||
"value": 0.23789
|
||||
},
|
||||
"co": {
|
||||
"name": "tlenek węgla",
|
||||
"name": "carbon monoxide",
|
||||
"id": 660,
|
||||
"index": "dobry",
|
||||
"index": "good",
|
||||
"value": 251.874
|
||||
},
|
||||
"no2": {
|
||||
"name": "dwutlenek azotu",
|
||||
"name": "nitrogen dioxide",
|
||||
"id": 665,
|
||||
"index": "dobry",
|
||||
"index": "good",
|
||||
"value": 7.13411
|
||||
},
|
||||
"o3": {
|
||||
"name": "ozon",
|
||||
"name": "ozone",
|
||||
"id": 667,
|
||||
"index": "dobry",
|
||||
"index": "good",
|
||||
"value": 95.7768
|
||||
},
|
||||
"pm10": {
|
||||
"name": "py\u0142 zawieszony PM10",
|
||||
"name": "particulate matter 10",
|
||||
"id": 14395,
|
||||
"index": "dobry",
|
||||
"index": "good",
|
||||
"value": 16.8344
|
||||
},
|
||||
"pm25": {
|
||||
"name": "py\u0142 zawieszony PM2.5",
|
||||
"name": "particulate matter 2.5",
|
||||
"id": 670,
|
||||
"index": "dobry",
|
||||
"index": "good",
|
||||
"value": 4
|
||||
},
|
||||
"so2": {
|
||||
"name": "dwutlenek siarki",
|
||||
"name": "sulfur dioxide",
|
||||
"id": 672,
|
||||
"index": "bardzo dobry",
|
||||
"index": "very_good",
|
||||
"value": 4.35478
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
{
|
||||
"id": 123,
|
||||
"stCalcDate": "2020-07-31 15:10:17",
|
||||
"stIndexLevel": { "id": 1, "indexLevelName": "dobry" },
|
||||
"stIndexLevel": { "id": 1, "indexLevelName": "Dobry" },
|
||||
"stSourceDataDate": "2020-07-31 14:00:00",
|
||||
"so2CalcDate": "2020-07-31 15:10:17",
|
||||
"so2IndexLevel": { "id": 0, "indexLevelName": "bardzo dobry" },
|
||||
"so2IndexLevel": { "id": 0, "indexLevelName": "Bardzo dobry" },
|
||||
"so2SourceDataDate": "2020-07-31 14:00:00",
|
||||
"no2CalcDate": 1596201017000,
|
||||
"no2IndexLevel": { "id": 0, "indexLevelName": "dobry" },
|
||||
"no2IndexLevel": { "id": 0, "indexLevelName": "Dobry" },
|
||||
"no2SourceDataDate": "2020-07-31 14:00:00",
|
||||
"coCalcDate": "2020-07-31 15:10:17",
|
||||
"coIndexLevel": { "id": 0, "indexLevelName": "dobry" },
|
||||
"coIndexLevel": { "id": 0, "indexLevelName": "Dobry" },
|
||||
"coSourceDataDate": "2020-07-31 14:00:00",
|
||||
"pm10CalcDate": "2020-07-31 15:10:17",
|
||||
"pm10IndexLevel": { "id": 0, "indexLevelName": "dobry" },
|
||||
"pm10IndexLevel": { "id": 0, "indexLevelName": "Dobry" },
|
||||
"pm10SourceDataDate": "2020-07-31 14:00:00",
|
||||
"pm25CalcDate": "2020-07-31 15:10:17",
|
||||
"pm25IndexLevel": { "id": 0, "indexLevelName": "dobry" },
|
||||
"pm25IndexLevel": { "id": 0, "indexLevelName": "Dobry" },
|
||||
"pm25SourceDataDate": "2020-07-31 14:00:00",
|
||||
"o3CalcDate": "2020-07-31 15:10:17",
|
||||
"o3IndexLevel": { "id": 1, "indexLevelName": "dobry" },
|
||||
"o3IndexLevel": { "id": 1, "indexLevelName": "Dobry" },
|
||||
"o3SourceDataDate": "2020-07-31 14:00:00",
|
||||
"c6h6CalcDate": "2020-07-31 15:10:17",
|
||||
"c6h6IndexLevel": { "id": 0, "indexLevelName": "bardzo dobry" },
|
||||
"c6h6IndexLevel": { "id": 0, "indexLevelName": "Bardzo dobry" },
|
||||
"c6h6SourceDataDate": "2020-07-31 14:00:00",
|
||||
"stIndexStatus": true,
|
||||
"stIndexCrParam": "OZON"
|
||||
|
|
|
@ -12,6 +12,7 @@ from homeassistant.components.gios.const import (
|
|||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.sensor import (
|
||||
ATTR_OPTIONS,
|
||||
ATTR_STATE_CLASS,
|
||||
DOMAIN as PLATFORM,
|
||||
SensorDeviceClass,
|
||||
|
@ -50,7 +51,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:molecule"
|
||||
assert state.attributes.get(ATTR_INDEX) == "bardzo dobry"
|
||||
assert state.attributes.get(ATTR_INDEX) == "very_good"
|
||||
|
||||
entry = registry.async_get("sensor.home_c6h6")
|
||||
assert entry
|
||||
|
@ -67,7 +68,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
assert state.attributes.get(ATTR_INDEX) == "dobry"
|
||||
assert state.attributes.get(ATTR_INDEX) == "good"
|
||||
|
||||
entry = registry.async_get("sensor.home_co")
|
||||
assert entry
|
||||
|
@ -84,7 +85,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
assert state.attributes.get(ATTR_INDEX) == "dobry"
|
||||
assert state.attributes.get(ATTR_INDEX) == "good"
|
||||
|
||||
entry = registry.async_get("sensor.home_no2")
|
||||
assert entry
|
||||
|
@ -101,7 +102,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
assert state.attributes.get(ATTR_INDEX) == "dobry"
|
||||
assert state.attributes.get(ATTR_INDEX) == "good"
|
||||
|
||||
entry = registry.async_get("sensor.home_o3")
|
||||
assert entry
|
||||
|
@ -118,7 +119,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
assert state.attributes.get(ATTR_INDEX) == "dobry"
|
||||
assert state.attributes.get(ATTR_INDEX) == "good"
|
||||
|
||||
entry = registry.async_get("sensor.home_pm10")
|
||||
assert entry
|
||||
|
@ -135,7 +136,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
assert state.attributes.get(ATTR_INDEX) == "dobry"
|
||||
assert state.attributes.get(ATTR_INDEX) == "good"
|
||||
|
||||
entry = registry.async_get("sensor.home_pm2_5")
|
||||
assert entry
|
||||
|
@ -152,7 +153,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
assert state.attributes.get(ATTR_INDEX) == "bardzo dobry"
|
||||
assert state.attributes.get(ATTR_INDEX) == "very_good"
|
||||
|
||||
entry = registry.async_get("sensor.home_so2")
|
||||
assert entry
|
||||
|
@ -160,11 +161,19 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
|
||||
state = hass.states.get("sensor.home_aqi")
|
||||
assert state
|
||||
assert state.state == "dobry"
|
||||
assert state.state == "good"
|
||||
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
||||
assert state.attributes.get(ATTR_STATION) == "Test Name 1"
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||
assert state.attributes.get(ATTR_OPTIONS) == [
|
||||
"very_bad",
|
||||
"bad",
|
||||
"sufficient",
|
||||
"moderate",
|
||||
"good",
|
||||
"very_good",
|
||||
]
|
||||
|
||||
entry = registry.async_get("sensor.home_aqi")
|
||||
assert entry
|
||||
|
@ -342,7 +351,7 @@ async def test_aqi_sensor_availability(hass: HomeAssistant) -> None:
|
|||
state = hass.states.get("sensor.home_aqi")
|
||||
assert state
|
||||
assert state.state != STATE_UNAVAILABLE
|
||||
assert state.state == "dobry"
|
||||
assert state.state == "good"
|
||||
|
||||
future = utcnow() + timedelta(minutes=60)
|
||||
with patch(
|
||||
|
|
Loading…
Reference in New Issue