mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Bump aiohasupervisor to version 0.2.1 (#129574)
This commit is contained in:
parent
df2506bfbb
commit
76f9a93ed7
@ -5,6 +5,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from aiohasupervisor import SupervisorError
|
||||
from aiohasupervisor.models import Discovery
|
||||
@ -86,7 +87,7 @@ class HassIODiscovery(HomeAssistantView):
|
||||
"""Handle new discovery requests."""
|
||||
# Fetch discovery data and prevent injections
|
||||
try:
|
||||
data = await self._supervisor_client.discovery.get(uuid)
|
||||
data = await self._supervisor_client.discovery.get(UUID(uuid))
|
||||
except SupervisorError as err:
|
||||
_LOGGER.error("Can't read discovery data: %s", err)
|
||||
raise HTTPServiceUnavailable from None
|
||||
@ -104,7 +105,7 @@ class HassIODiscovery(HomeAssistantView):
|
||||
async def async_rediscover(self, uuid: str) -> None:
|
||||
"""Rediscover add-on when config entry is removed."""
|
||||
try:
|
||||
data = await self._supervisor_client.discovery.get(uuid)
|
||||
data = await self._supervisor_client.discovery.get(UUID(uuid))
|
||||
except SupervisorError as err:
|
||||
_LOGGER.debug("Can't read discovery data: %s", err)
|
||||
else:
|
||||
@ -146,7 +147,7 @@ class HassIODiscovery(HomeAssistantView):
|
||||
|
||||
# Check if really deletet / prevent injections
|
||||
try:
|
||||
data = await self._supervisor_client.discovery.get(uuid)
|
||||
await self._supervisor_client.discovery.get(UUID(uuid))
|
||||
except SupervisorError:
|
||||
pass
|
||||
else:
|
||||
|
@ -382,7 +382,7 @@ def get_supervisor_client(hass: HomeAssistant) -> SupervisorClient:
|
||||
"""Return supervisor client."""
|
||||
hassio: HassIO = hass.data[DOMAIN]
|
||||
return SupervisorClient(
|
||||
hassio.base_url,
|
||||
str(hassio.base_url),
|
||||
os.environ.get("SUPERVISOR_TOKEN", ""),
|
||||
session=hassio.websession,
|
||||
)
|
||||
|
@ -6,6 +6,6 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/hassio",
|
||||
"iot_class": "local_polling",
|
||||
"quality_scale": "internal",
|
||||
"requirements": ["aiohasupervisor==0.2.0"],
|
||||
"requirements": ["aiohasupervisor==0.2.1"],
|
||||
"single_config_entry": true
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
aiodhcpwatcher==1.0.2
|
||||
aiodiscover==2.1.0
|
||||
aiodns==3.2.0
|
||||
aiohasupervisor==0.2.0
|
||||
aiohasupervisor==0.2.1
|
||||
aiohttp-fast-zlib==0.1.1
|
||||
aiohttp==3.10.10
|
||||
aiohttp_cors==0.7.0
|
||||
|
@ -27,7 +27,7 @@ dependencies = [
|
||||
# Integrations may depend on hassio integration without listing it to
|
||||
# change behavior based on presence of supervisor. Deprecated with #127228
|
||||
# Lib can be removed with 2025.11
|
||||
"aiohasupervisor==0.2.0",
|
||||
"aiohasupervisor==0.2.1",
|
||||
"aiohttp==3.10.10",
|
||||
"aiohttp_cors==0.7.0",
|
||||
"aiohttp-fast-zlib==0.1.1",
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
# Home Assistant Core
|
||||
aiodns==3.2.0
|
||||
aiohasupervisor==0.2.0
|
||||
aiohasupervisor==0.2.1
|
||||
aiohttp==3.10.10
|
||||
aiohttp_cors==0.7.0
|
||||
aiohttp-fast-zlib==0.1.1
|
||||
|
@ -259,7 +259,7 @@ aioguardian==2022.07.0
|
||||
aioharmony==0.2.10
|
||||
|
||||
# homeassistant.components.hassio
|
||||
aiohasupervisor==0.2.0
|
||||
aiohasupervisor==0.2.1
|
||||
|
||||
# homeassistant.components.homekit_controller
|
||||
aiohomekit==3.2.5
|
||||
|
@ -244,7 +244,7 @@ aioguardian==2022.07.0
|
||||
aioharmony==0.2.10
|
||||
|
||||
# homeassistant.components.hassio
|
||||
aiohasupervisor==0.2.0
|
||||
aiohasupervisor==0.2.1
|
||||
|
||||
# homeassistant.components.homekit_controller
|
||||
aiohomekit==3.2.5
|
||||
|
@ -181,8 +181,8 @@ async def test_hassio_discovery_webhook(
|
||||
addon_installed.return_value.name = "Mosquitto Test"
|
||||
|
||||
resp = await hassio_client.post(
|
||||
"/api/hassio_push/discovery/testuuid",
|
||||
json={"addon": "mosquitto", "service": "mqtt", "uuid": "testuuid"},
|
||||
f"/api/hassio_push/discovery/{uuid!s}",
|
||||
json={"addon": "mosquitto", "service": "mqtt", "uuid": str(uuid)},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED)
|
||||
@ -208,6 +208,9 @@ async def test_hassio_discovery_webhook(
|
||||
)
|
||||
|
||||
|
||||
TEST_UUID = str(uuid4())
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
(
|
||||
"entry_domain",
|
||||
@ -217,13 +220,13 @@ async def test_hassio_discovery_webhook(
|
||||
# Matching discovery key
|
||||
(
|
||||
"mock-domain",
|
||||
{"hassio": (DiscoveryKey(domain="hassio", key="test", version=1),)},
|
||||
{"hassio": (DiscoveryKey(domain="hassio", key=TEST_UUID, version=1),)},
|
||||
),
|
||||
# Matching discovery key
|
||||
(
|
||||
"mock-domain",
|
||||
{
|
||||
"hassio": (DiscoveryKey(domain="hassio", key="test", version=1),),
|
||||
"hassio": (DiscoveryKey(domain="hassio", key=TEST_UUID, version=1),),
|
||||
"other": (DiscoveryKey(domain="other", key="blah", version=1),),
|
||||
},
|
||||
),
|
||||
@ -232,7 +235,7 @@ async def test_hassio_discovery_webhook(
|
||||
# entry. Such a check can be added if needed.
|
||||
(
|
||||
"comp",
|
||||
{"hassio": (DiscoveryKey(domain="hassio", key="test", version=1),)},
|
||||
{"hassio": (DiscoveryKey(domain="hassio", key=TEST_UUID, version=1),)},
|
||||
),
|
||||
],
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user