Bump airly library to version 1.1.0 (#47163)
This commit is contained in:
parent
eb7220ff26
commit
66027bcef5
7 changed files with 36 additions and 9 deletions
|
@ -144,6 +144,12 @@ class AirlyDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
except (AirlyError, ClientConnectorError) as error:
|
||||
raise UpdateFailed(error) from error
|
||||
|
||||
_LOGGER.debug(
|
||||
"Requests remaining: %s/%s",
|
||||
self.airly.requests_remaining,
|
||||
self.airly.requests_per_day,
|
||||
)
|
||||
|
||||
values = measurements.current["values"]
|
||||
index = measurements.current["indexes"][0]
|
||||
standards = measurements.current["standards"]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Airly",
|
||||
"documentation": "https://www.home-assistant.io/integrations/airly",
|
||||
"codeowners": ["@bieniu"],
|
||||
"requirements": ["airly==1.0.0"],
|
||||
"requirements": ["airly==1.1.0"],
|
||||
"config_flow": true,
|
||||
"quality_scale": "platinum"
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
},
|
||||
"system_health": {
|
||||
"info": {
|
||||
"can_reach_server": "Reach Airly server"
|
||||
"can_reach_server": "Reach Airly server",
|
||||
"requests_remaining": "Remaining allowed requests",
|
||||
"requests_per_day": "Allowed requests per day"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ from airly import Airly
|
|||
from homeassistant.components import system_health
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
@callback
|
||||
def async_register(
|
||||
|
@ -15,8 +17,13 @@ def async_register(
|
|||
|
||||
async def system_health_info(hass):
|
||||
"""Get info for the info page."""
|
||||
requests_remaining = list(hass.data[DOMAIN].values())[0].airly.requests_remaining
|
||||
requests_per_day = list(hass.data[DOMAIN].values())[0].airly.requests_per_day
|
||||
|
||||
return {
|
||||
"can_reach_server": system_health.async_check_can_reach_url(
|
||||
hass, Airly.AIRLY_API_URL
|
||||
)
|
||||
),
|
||||
"requests_remaining": requests_remaining,
|
||||
"requests_per_day": requests_per_day,
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ aiounifi==26
|
|||
aioymaps==1.1.0
|
||||
|
||||
# homeassistant.components.airly
|
||||
airly==1.0.0
|
||||
airly==1.1.0
|
||||
|
||||
# homeassistant.components.aladdin_connect
|
||||
aladdin_connect==0.3
|
||||
|
|
|
@ -152,7 +152,7 @@ aiounifi==26
|
|||
aioymaps==1.1.0
|
||||
|
||||
# homeassistant.components.airly
|
||||
airly==1.0.0
|
||||
airly==1.1.0
|
||||
|
||||
# homeassistant.components.ambiclimate
|
||||
ambiclimate==0.2.1
|
||||
|
|
|
@ -18,7 +18,11 @@ async def test_airly_system_health(hass, aioclient_mock):
|
|||
|
||||
hass.data[DOMAIN] = {}
|
||||
hass.data[DOMAIN]["0123xyz"] = Mock(
|
||||
airly=Mock(AIRLY_API_URL="https://airapi.airly.eu/v2/")
|
||||
airly=Mock(
|
||||
AIRLY_API_URL="https://airapi.airly.eu/v2/",
|
||||
requests_remaining=42,
|
||||
requests_per_day=100,
|
||||
)
|
||||
)
|
||||
|
||||
info = await get_system_health_info(hass, DOMAIN)
|
||||
|
@ -27,7 +31,9 @@ async def test_airly_system_health(hass, aioclient_mock):
|
|||
if asyncio.iscoroutine(val):
|
||||
info[key] = await val
|
||||
|
||||
assert info == {"can_reach_server": "ok"}
|
||||
assert info["can_reach_server"] == "ok"
|
||||
assert info["requests_remaining"] == 42
|
||||
assert info["requests_per_day"] == 100
|
||||
|
||||
|
||||
async def test_airly_system_health_fail(hass, aioclient_mock):
|
||||
|
@ -38,7 +44,11 @@ async def test_airly_system_health_fail(hass, aioclient_mock):
|
|||
|
||||
hass.data[DOMAIN] = {}
|
||||
hass.data[DOMAIN]["0123xyz"] = Mock(
|
||||
airly=Mock(AIRLY_API_URL="https://airapi.airly.eu/v2/")
|
||||
airly=Mock(
|
||||
AIRLY_API_URL="https://airapi.airly.eu/v2/",
|
||||
requests_remaining=0,
|
||||
requests_per_day=1000,
|
||||
)
|
||||
)
|
||||
|
||||
info = await get_system_health_info(hass, DOMAIN)
|
||||
|
@ -47,4 +57,6 @@ async def test_airly_system_health_fail(hass, aioclient_mock):
|
|||
if asyncio.iscoroutine(val):
|
||||
info[key] = await val
|
||||
|
||||
assert info == {"can_reach_server": {"type": "failed", "error": "unreachable"}}
|
||||
assert info["can_reach_server"] == {"type": "failed", "error": "unreachable"}
|
||||
assert info["requests_remaining"] == 0
|
||||
assert info["requests_per_day"] == 1000
|
||||
|
|
Loading…
Add table
Reference in a new issue