Skip to content

Commit f66feab

Browse files
frenckthecodeallenporterMartinHjelmaretl-sl
authored
Co-authored-by: Shay Levy <[email protected]> Co-authored-by: Allen Porter <[email protected]> Co-authored-by: Franck Nijhof <[email protected]> Co-authored-by: Martin Hjelmare <[email protected]> Co-authored-by: TimL <[email protected]> Co-authored-by: Seweryn Zeman <[email protected]> Co-authored-by: hahn-th <[email protected]> Co-authored-by: Luke Lashley <[email protected]> Co-authored-by: starkillerOG <[email protected]> Co-authored-by: J. Nick Koston <[email protected]> Co-authored-by: Arie Catsman <[email protected]> Co-authored-by: Josef Zweck <[email protected]> Co-authored-by: Simon Lamon <[email protected]> Co-authored-by: Ruben van Dijk <[email protected]> Co-authored-by: G Johansson <[email protected]> Co-authored-by: Simone Chemelli <[email protected]> Co-authored-by: Thomas55555 <[email protected]> Co-authored-by: Øyvind Matheson Wergeland <[email protected]> Co-authored-by: Joost Lekkerkerker <[email protected]> Co-authored-by: Jan Bouwhuis <[email protected]> Co-authored-by: Brett Adams <[email protected]> Co-authored-by: rjblake <[email protected]> Co-authored-by: Daniel Hjelseth Høyer <[email protected]> Co-authored-by: Matthias Alphart <[email protected]> Co-authored-by: Erik Montnemery <[email protected]> Co-authored-by: Robert Resch <[email protected]> Co-authored-by: Odd Stråbø <[email protected]> Co-authored-by: puddly <[email protected]> Co-authored-by: Bram Kragten <[email protected]> fix privacy mode availability for NVR IPC cams (home-assistant#144569) fix enphase_envoy diagnostics home endpoint name (home-assistant#144634) Close Octoprint aiohttp session on unload (home-assistant#144670) Fix strings typo for Comelit (home-assistant#144672) Fix wrong state in Husqvarna Automower (home-assistant#144684) Fix Netgear handeling of missing MAC in device registry (home-assistant#144722) Fix blocking call in azure storage (home-assistant#144803) Fix Z-Wave unique id after controller reset (home-assistant#144813) Fix blocking call in azure_storage config flow (home-assistant#144818) Fix wall connector states in Teslemetry (home-assistant#144855) Fix Reolink setup when ONVIF push is unsupported (home-assistant#144869) Fix some Home Connect translation strings (home-assistant#144905) Fix unknown Pure AQI in Sensibo (home-assistant#144924) Fix Home Assistant Yellow config entry data (home-assistant#144948) Fix ESPHome entities unavailable if deep sleep enabled after entry setup (home-assistant#144970) fix from ZHA event `unique_id` (home-assistant#145006) Fix climate idle state for Comelit (home-assistant#145059) Fix fan AC mode in SmartThings AC (home-assistant#145064) Fix Ecovacs mower area sensors (home-assistant#145071)
2 parents 00627b8 + 0ef098a commit f66feab

File tree

97 files changed

+1490
-300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1490
-300
lines changed

homeassistant/components/azure_storage/__init__.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,20 @@ async def async_setup_entry(
3939
session = async_create_clientsession(
4040
hass, timeout=ClientTimeout(connect=10, total=12 * 60 * 60)
4141
)
42-
container_client = ContainerClient(
43-
account_url=f"https://{entry.data[CONF_ACCOUNT_NAME]}.blob.core.windows.net/",
44-
container_name=entry.data[CONF_CONTAINER_NAME],
45-
credential=entry.data[CONF_STORAGE_ACCOUNT_KEY],
46-
transport=AioHttpTransport(session=session),
42+
43+
def create_container_client() -> ContainerClient:
44+
"""Create a ContainerClient."""
45+
46+
return ContainerClient(
47+
account_url=f"https://{entry.data[CONF_ACCOUNT_NAME]}.blob.core.windows.net/",
48+
container_name=entry.data[CONF_CONTAINER_NAME],
49+
credential=entry.data[CONF_STORAGE_ACCOUNT_KEY],
50+
transport=AioHttpTransport(session=session),
51+
)
52+
53+
# has a blocking call to open in cpython
54+
container_client: ContainerClient = await hass.async_add_executor_job(
55+
create_container_client
4756
)
4857

4958
try:

homeassistant/components/azure_storage/config_flow.py

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,25 @@
2727
class AzureStorageConfigFlow(ConfigFlow, domain=DOMAIN):
2828
"""Handle a config flow for azure storage."""
2929

30-
def get_account_url(self, account_name: str) -> str:
31-
"""Get the account URL."""
32-
return f"https://{account_name}.blob.core.windows.net/"
30+
async def get_container_client(
31+
self, account_name: str, container_name: str, storage_account_key: str
32+
) -> ContainerClient:
33+
"""Get the container client.
34+
35+
ContainerClient has a blocking call to open in cpython
36+
"""
37+
38+
session = async_get_clientsession(self.hass)
39+
40+
def create_container_client() -> ContainerClient:
41+
return ContainerClient(
42+
account_url=f"https://{account_name}.blob.core.windows.net/",
43+
container_name=container_name,
44+
credential=storage_account_key,
45+
transport=AioHttpTransport(session=session),
46+
)
47+
48+
return await self.hass.async_add_executor_job(create_container_client)
3349

3450
async def validate_config(
3551
self, container_client: ContainerClient
@@ -58,11 +74,10 @@ async def async_step_user(
5874
self._async_abort_entries_match(
5975
{CONF_ACCOUNT_NAME: user_input[CONF_ACCOUNT_NAME]}
6076
)
61-
container_client = ContainerClient(
62-
account_url=self.get_account_url(user_input[CONF_ACCOUNT_NAME]),
77+
container_client = await self.get_container_client(
78+
account_name=user_input[CONF_ACCOUNT_NAME],
6379
container_name=user_input[CONF_CONTAINER_NAME],
64-
credential=user_input[CONF_STORAGE_ACCOUNT_KEY],
65-
transport=AioHttpTransport(session=async_get_clientsession(self.hass)),
80+
storage_account_key=user_input[CONF_STORAGE_ACCOUNT_KEY],
6681
)
6782
errors = await self.validate_config(container_client)
6883

@@ -99,12 +114,12 @@ async def async_step_reauth_confirm(
99114
reauth_entry = self._get_reauth_entry()
100115

101116
if user_input is not None:
102-
container_client = ContainerClient(
103-
account_url=self.get_account_url(reauth_entry.data[CONF_ACCOUNT_NAME]),
117+
container_client = await self.get_container_client(
118+
account_name=reauth_entry.data[CONF_ACCOUNT_NAME],
104119
container_name=reauth_entry.data[CONF_CONTAINER_NAME],
105-
credential=user_input[CONF_STORAGE_ACCOUNT_KEY],
106-
transport=AioHttpTransport(session=async_get_clientsession(self.hass)),
120+
storage_account_key=user_input[CONF_STORAGE_ACCOUNT_KEY],
107121
)
122+
108123
errors = await self.validate_config(container_client)
109124
if not errors:
110125
return self.async_update_reload_and_abort(
@@ -129,13 +144,10 @@ async def async_step_reconfigure(
129144
reconfigure_entry = self._get_reconfigure_entry()
130145

131146
if user_input is not None:
132-
container_client = ContainerClient(
133-
account_url=self.get_account_url(
134-
reconfigure_entry.data[CONF_ACCOUNT_NAME]
135-
),
147+
container_client = await self.get_container_client(
148+
account_name=reconfigure_entry.data[CONF_ACCOUNT_NAME],
136149
container_name=user_input[CONF_CONTAINER_NAME],
137-
credential=user_input[CONF_STORAGE_ACCOUNT_KEY],
138-
transport=AioHttpTransport(session=async_get_clientsession(self.hass)),
150+
storage_account_key=user_input[CONF_STORAGE_ACCOUNT_KEY],
139151
)
140152
errors = await self.validate_config(container_client)
141153
if not errors:

homeassistant/components/comelit/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,5 @@ async def async_unload_entry(hass: HomeAssistant, entry: ComelitConfigEntry) ->
7777
coordinator = entry.runtime_data
7878
if unload_ok := await hass.config_entries.async_unload_platforms(entry, platforms):
7979
await coordinator.api.logout()
80-
await coordinator.api.close()
8180

8281
return unload_ok

homeassistant/components/comelit/climate.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,9 @@ def _update_attributes(self) -> None:
134134
self._attr_current_temperature = values[0] / 10
135135

136136
self._attr_hvac_action = None
137-
if _mode == ClimaComelitMode.OFF:
138-
self._attr_hvac_action = HVACAction.OFF
139137
if not _active:
140138
self._attr_hvac_action = HVACAction.IDLE
141-
if _mode in API_STATUS:
139+
elif _mode in API_STATUS:
142140
self._attr_hvac_action = API_STATUS[_mode]["hvac_action"]
143141

144142
self._attr_hvac_mode = None

homeassistant/components/comelit/config_flow.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str,
7373
) from err
7474
finally:
7575
await api.logout()
76-
await api.close()
7776

7877
return {"title": data[CONF_HOST]}
7978

homeassistant/components/comelit/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"iot_class": "local_polling",
99
"loggers": ["aiocomelit"],
1010
"quality_scale": "bronze",
11-
"requirements": ["aiocomelit==0.12.0"]
11+
"requirements": ["aiocomelit==0.12.1"]
1212
}

homeassistant/components/comelit/strings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"cannot_authenticate": {
7777
"message": "Error authenticating"
7878
},
79-
"updated_failed": {
79+
"update_failed": {
8080
"message": "Failed to update data: {error}"
8181
}
8282
}

homeassistant/components/dhcp/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"quality_scale": "internal",
1616
"requirements": [
1717
"aiodhcpwatcher==1.1.1",
18-
"aiodiscover==2.6.1",
18+
"aiodiscover==2.7.0",
1919
"cached-ipaddress==0.10.0"
2020
]
2121
}

homeassistant/components/ecovacs/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"documentation": "https://www.home-assistant.io/integrations/ecovacs",
77
"iot_class": "cloud_push",
88
"loggers": ["sleekxmppfs", "sucks", "deebot_client"],
9-
"requirements": ["py-sucks==0.9.10", "deebot-client==13.1.0"]
9+
"requirements": ["py-sucks==0.9.10", "deebot-client==13.2.0"]
1010
}

homeassistant/components/ecovacs/sensor.py

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from dataclasses import dataclass
77
from typing import Any, Generic
88

9-
from deebot_client.capabilities import CapabilityEvent, CapabilityLifeSpan
9+
from deebot_client.capabilities import CapabilityEvent, CapabilityLifeSpan, DeviceType
10+
from deebot_client.device import Device
1011
from deebot_client.events import (
1112
BatteryEvent,
1213
ErrorEvent,
@@ -34,7 +35,7 @@
3435
UnitOfArea,
3536
UnitOfTime,
3637
)
37-
from homeassistant.core import HomeAssistant
38+
from homeassistant.core import HomeAssistant, callback
3839
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
3940
from homeassistant.helpers.typing import StateType
4041

@@ -59,6 +60,15 @@ class EcovacsSensorEntityDescription(
5960
"""Ecovacs sensor entity description."""
6061

6162
value_fn: Callable[[EventT], StateType]
63+
native_unit_of_measurement_fn: Callable[[DeviceType], str | None] | None = None
64+
65+
66+
@callback
67+
def get_area_native_unit_of_measurement(device_type: DeviceType) -> str | None:
68+
"""Get the area native unit of measurement based on device type."""
69+
if device_type is DeviceType.MOWER:
70+
return UnitOfArea.SQUARE_CENTIMETERS
71+
return UnitOfArea.SQUARE_METERS
6272

6373

6474
ENTITY_DESCRIPTIONS: tuple[EcovacsSensorEntityDescription, ...] = (
@@ -68,7 +78,7 @@ class EcovacsSensorEntityDescription(
6878
capability_fn=lambda caps: caps.stats.clean,
6979
value_fn=lambda e: e.area,
7080
translation_key="stats_area",
71-
native_unit_of_measurement=UnitOfArea.SQUARE_METERS,
81+
native_unit_of_measurement_fn=get_area_native_unit_of_measurement,
7282
),
7383
EcovacsSensorEntityDescription[StatsEvent](
7484
key="stats_time",
@@ -85,7 +95,7 @@ class EcovacsSensorEntityDescription(
8595
value_fn=lambda e: e.area,
8696
key="total_stats_area",
8797
translation_key="total_stats_area",
88-
native_unit_of_measurement=UnitOfArea.SQUARE_METERS,
98+
native_unit_of_measurement_fn=get_area_native_unit_of_measurement,
8999
state_class=SensorStateClass.TOTAL_INCREASING,
90100
),
91101
EcovacsSensorEntityDescription[TotalStatsEvent](
@@ -249,6 +259,27 @@ class EcovacsSensor(
249259

250260
entity_description: EcovacsSensorEntityDescription
251261

262+
def __init__(
263+
self,
264+
device: Device,
265+
capability: CapabilityEvent,
266+
entity_description: EcovacsSensorEntityDescription,
267+
**kwargs: Any,
268+
) -> None:
269+
"""Initialize entity."""
270+
super().__init__(device, capability, entity_description, **kwargs)
271+
if (
272+
entity_description.native_unit_of_measurement_fn
273+
and (
274+
native_unit_of_measurement
275+
:= entity_description.native_unit_of_measurement_fn(
276+
device.capabilities.device_type
277+
)
278+
)
279+
is not None
280+
):
281+
self._attr_native_unit_of_measurement = native_unit_of_measurement
282+
252283
async def async_added_to_hass(self) -> None:
253284
"""Set up the event listeners now that hass is ready."""
254285
await super().async_added_to_hass()

0 commit comments

Comments
 (0)