Skip to content

[pull] dev from home-assistant:dev #643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
70133da
Use freezer.tick once more in SamsungTV (#143970)
epenet Apr 30, 2025
6c0e46f
Bump intents to 2025.4.30 (#143969)
synesthesiam Apr 30, 2025
daf143f
Fix broken URL in MQTT translation strings (#143973)
jbouwh Apr 30, 2025
f1b8c88
Push country config to Supervisor (#143871)
agners Apr 30, 2025
5c58f97
Add Google Gemini virtual integration (#143753)
tronikos Apr 30, 2025
1ef04a8
Add National Grid US virtual integration (#143756)
tronikos Apr 30, 2025
949225f
Bump openai to 1.76.2 (#143902)
Shulyaka Apr 30, 2025
2c118d4
Bump yt-dlp to 2025.03.31 (#143733)
andreimoraru Apr 30, 2025
02bd8d6
Use google-maps-routing in google_travel_time (#140691)
eifinger Apr 30, 2025
6a514ac
Update frontend to 20250430.2 (#143974)
piitaya Apr 30, 2025
e53f380
Migrate climate attributes to own entities in AVM Fritz!SmartHome (#1…
mib1185 Apr 30, 2025
4d9ab42
Add detergent select entities to smartthings (#143666)
joostlek Apr 30, 2025
fc440f3
Add door binary sensor to Whirlpool (#143947)
abmantis Apr 30, 2025
a6d5891
Add more sensors to Teslemetry (#143386)
Bre77 Apr 30, 2025
5ccb948
switchbot_cloud: Add battery sensor for Bot and Smart Locks (#143689)
mrueg Apr 30, 2025
30656a4
Add mediabrowser search to music assistant (#143851)
jozefKruszynski Apr 30, 2025
e05f7a9
Expose LitterHopper status for LR4 (#143684)
f3ndot Apr 30, 2025
0f5d5ab
Add return energy and compensation to Opower (#135258)
parkerbxyz Apr 30, 2025
8760a82
Bump ZHA to 0.0.57 (#143963)
puddly Apr 30, 2025
1626b3b
Add absolute humidity sensor to homematicip_cloud (#143709)
hahn-th Apr 30, 2025
9732b8c
Add switchbot circulator fan support (#142980)
zerzhang Apr 30, 2025
24803b1
Add SmartThings water consumption sensor (#142765)
wilbiev Apr 30, 2025
5816d49
Linkplay: add entity_picture attribute (media image url) for media pl…
vingerha Apr 30, 2025
2cede8f
Record Switcher quality scale (#141065)
thecode Apr 30, 2025
a3a1d42
Implement data coordinator for Adax-integration (#139514)
LazyTarget Apr 30, 2025
3f7cae8
Spelling fixes to user-facing strings of `tplink` (#143649)
NoRi2909 Apr 30, 2025
102d55e
Jewish Calendar - support omer count after sunset (#143332)
yohaybn Apr 30, 2025
dbc38cd
Add switch platform to eheimdigital (#142412)
autinerd Apr 30, 2025
53df69e
Encourage to use UID instead of name for update and delete todos (#14…
TimoPtr Apr 30, 2025
0752807
Improve device action config entry lookup in NUT (#142133)
tdfountain Apr 30, 2025
83e0ed7
Improve config flow of devolo Home Network (#131911)
Shutgun Apr 30, 2025
621cf6c
Fix broken references in `teslemetry` (#143981)
NoRi2909 Apr 30, 2025
c3abf5a
Add support for WMS roller shutters and blinds (#132645)
mback2k Apr 30, 2025
d23d25c
Add units of measurement for Home Connect counter entities (#143982)
Diegorro98 Apr 30, 2025
ad0209a
Bump version to 2025.6.0dev0 (#143983)
frenck Apr 30, 2025
b92f718
Matter Cooktop fixture (#143984)
lboue Apr 30, 2025
7d89804
Bump pylamarzocco to 2.0.0b7 (#143989)
zweckj Apr 30, 2025
c4eddc8
Ensure legacy TTS providers are hidden if entity exists (#143992)
balloob Apr 30, 2025
b0345cc
Bump pushover-complete to 1.2.0 (#143966)
TheMegamind Apr 30, 2025
6e76ca0
Add translations for "energy_distance" and "wind_direction" in `rando…
NoRi2909 Apr 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ env:
CACHE_VERSION: 12
UV_CACHE_VERSION: 1
MYPY_CACHE_VERSION: 9
HA_SHORT_VERSION: "2025.5"
HA_SHORT_VERSION: "2025.6"
DEFAULT_PYTHON: "3.13"
ALL_PYTHON_VERSIONS: "['3.13']"
# 10.3 is the oldest supported version
Expand Down
1 change: 1 addition & 0 deletions homeassistant/brands/google.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"google_assistant_sdk",
"google_cloud",
"google_drive",
"google_gemini",
"google_generative_ai_conversation",
"google_mail",
"google_maps",
Expand Down
21 changes: 17 additions & 4 deletions homeassistant/components/adax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,38 @@

from __future__ import annotations

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant

from .const import CONNECTION_TYPE, LOCAL
from .coordinator import AdaxCloudCoordinator, AdaxConfigEntry, AdaxLocalCoordinator

PLATFORMS = [Platform.CLIMATE]


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_setup_entry(hass: HomeAssistant, entry: AdaxConfigEntry) -> bool:
"""Set up Adax from a config entry."""
if entry.data.get(CONNECTION_TYPE) == LOCAL:
local_coordinator = AdaxLocalCoordinator(hass, entry)
entry.runtime_data = local_coordinator
else:
cloud_coordinator = AdaxCloudCoordinator(hass, entry)
entry.runtime_data = cloud_coordinator

await entry.runtime_data.async_config_entry_first_refresh()

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True


async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: AdaxConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)


async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
async def async_migrate_entry(
hass: HomeAssistant, config_entry: AdaxConfigEntry
) -> bool:
"""Migrate old entry."""
# convert title and unique_id to string
if config_entry.version == 1:
Expand Down
147 changes: 79 additions & 68 deletions homeassistant/components/adax/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,42 @@
ClimateEntityFeature,
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_TEMPERATURE,
CONF_IP_ADDRESS,
CONF_PASSWORD,
CONF_TOKEN,
CONF_UNIQUE_ID,
PRECISION_WHOLE,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from .const import ACCOUNT_ID, CONNECTION_TYPE, DOMAIN, LOCAL
from . import AdaxConfigEntry
from .const import CONNECTION_TYPE, DOMAIN, LOCAL
from .coordinator import AdaxCloudCoordinator, AdaxLocalCoordinator


async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: AdaxConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up the Adax thermostat with config flow."""
if entry.data.get(CONNECTION_TYPE) == LOCAL:
adax_data_handler = AdaxLocal(
entry.data[CONF_IP_ADDRESS],
entry.data[CONF_TOKEN],
websession=async_get_clientsession(hass, verify_ssl=False),
local_coordinator = cast(AdaxLocalCoordinator, entry.runtime_data)
async_add_entities(
[LocalAdaxDevice(local_coordinator, entry.data[CONF_UNIQUE_ID])],
)
else:
cloud_coordinator = cast(AdaxCloudCoordinator, entry.runtime_data)
async_add_entities(
[LocalAdaxDevice(adax_data_handler, entry.data[CONF_UNIQUE_ID])], True
AdaxDevice(cloud_coordinator, device_id)
for device_id in cloud_coordinator.data
)
return

adax_data_handler = Adax(
entry.data[ACCOUNT_ID],
entry.data[CONF_PASSWORD],
websession=async_get_clientsession(hass),
)

async_add_entities(
(
AdaxDevice(room, adax_data_handler)
for room in await adax_data_handler.get_rooms()
),
True,
)


class AdaxDevice(ClimateEntity):
class AdaxDevice(CoordinatorEntity[AdaxCloudCoordinator], ClimateEntity):
"""Representation of a heater."""

_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
Expand All @@ -76,20 +61,37 @@ class AdaxDevice(ClimateEntity):
_attr_target_temperature_step = PRECISION_WHOLE
_attr_temperature_unit = UnitOfTemperature.CELSIUS

def __init__(self, heater_data: dict[str, Any], adax_data_handler: Adax) -> None:
def __init__(
self,
coordinator: AdaxCloudCoordinator,
device_id: str,
) -> None:
"""Initialize the heater."""
self._device_id = heater_data["id"]
self._adax_data_handler = adax_data_handler
super().__init__(coordinator)
self._adax_data_handler: Adax = coordinator.adax_data_handler
self._device_id = device_id

self._attr_unique_id = f"{heater_data['homeId']}_{heater_data['id']}"
self._attr_name = self.room["name"]
self._attr_unique_id = f"{self.room['homeId']}_{self._device_id}"
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, heater_data["id"])},
identifiers={(DOMAIN, device_id)},
# Instead of setting the device name to the entity name, adax
# should be updated to set has_entity_name = True, and set the entity
# name to None
name=cast(str | None, self.name),
manufacturer="Adax",
)
self._apply_data(self.room)

@property
def available(self) -> bool:
"""Whether the entity is available or not."""
return super().available and self._device_id in self.coordinator.data

@property
def room(self) -> dict[str, Any]:
"""Gets the data for this particular device."""
return self.coordinator.data[self._device_id]

async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set hvac mode."""
Expand All @@ -104,7 +106,9 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
)
else:
return
await self._adax_data_handler.update()

# Request data refresh from source to verify that update was successful
await self.coordinator.async_request_refresh()

async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature."""
Expand All @@ -114,28 +118,31 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
self._device_id, temperature, True
)

async def async_update(self) -> None:
"""Get the latest data."""
for room in await self._adax_data_handler.get_rooms():
if room["id"] != self._device_id:
continue
self._attr_name = room["name"]
self._attr_current_temperature = room.get("temperature")
self._attr_target_temperature = room.get("targetTemperature")
if room["heatingEnabled"]:
self._attr_hvac_mode = HVACMode.HEAT
self._attr_icon = "mdi:radiator"
else:
self._attr_hvac_mode = HVACMode.OFF
self._attr_icon = "mdi:radiator-off"
return
@callback
def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
if room := self.room:
self._apply_data(room)
super()._handle_coordinator_update()

def _apply_data(self, room: dict[str, Any]) -> None:
"""Update the appropriate attributues based on received data."""
self._attr_current_temperature = room.get("temperature")
self._attr_target_temperature = room.get("targetTemperature")
if room["heatingEnabled"]:
self._attr_hvac_mode = HVACMode.HEAT
self._attr_icon = "mdi:radiator"
else:
self._attr_hvac_mode = HVACMode.OFF
self._attr_icon = "mdi:radiator-off"


class LocalAdaxDevice(ClimateEntity):
class LocalAdaxDevice(CoordinatorEntity[AdaxLocalCoordinator], ClimateEntity):
"""Representation of a heater."""

_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
_attr_hvac_mode = HVACMode.HEAT
_attr_hvac_mode = HVACMode.OFF
_attr_icon = "mdi:radiator-off"
_attr_max_temp = 35
_attr_min_temp = 5
_attr_supported_features = (
Expand All @@ -146,9 +153,10 @@ class LocalAdaxDevice(ClimateEntity):
_attr_target_temperature_step = PRECISION_WHOLE
_attr_temperature_unit = UnitOfTemperature.CELSIUS

def __init__(self, adax_data_handler: AdaxLocal, unique_id: str) -> None:
def __init__(self, coordinator: AdaxLocalCoordinator, unique_id: str) -> None:
"""Initialize the heater."""
self._adax_data_handler = adax_data_handler
super().__init__(coordinator)
self._adax_data_handler: AdaxLocal = coordinator.adax_data_handler
self._attr_unique_id = unique_id
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, unique_id)},
Expand All @@ -169,17 +177,20 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
return
await self._adax_data_handler.set_target_temperature(temperature)

async def async_update(self) -> None:
"""Get the latest data."""
data = await self._adax_data_handler.get_status()
self._attr_current_temperature = data["current_temperature"]
self._attr_available = self._attr_current_temperature is not None
if (target_temp := data["target_temperature"]) == 0:
self._attr_hvac_mode = HVACMode.OFF
self._attr_icon = "mdi:radiator-off"
if target_temp == 0:
self._attr_target_temperature = self._attr_min_temp
else:
self._attr_hvac_mode = HVACMode.HEAT
self._attr_icon = "mdi:radiator"
self._attr_target_temperature = target_temp
@callback
def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
if data := self.coordinator.data:
self._attr_current_temperature = data["current_temperature"]
self._attr_available = self._attr_current_temperature is not None
if (target_temp := data["target_temperature"]) == 0:
self._attr_hvac_mode = HVACMode.OFF
self._attr_icon = "mdi:radiator-off"
if target_temp == 0:
self._attr_target_temperature = self._attr_min_temp
else:
self._attr_hvac_mode = HVACMode.HEAT
self._attr_icon = "mdi:radiator"
self._attr_target_temperature = target_temp

super()._handle_coordinator_update()
3 changes: 3 additions & 0 deletions homeassistant/components/adax/const.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Constants for the Adax integration."""

import datetime
from typing import Final

ACCOUNT_ID: Final = "account_id"
Expand All @@ -9,3 +10,5 @@
LOCAL = "Local"
WIFI_SSID = "wifi_ssid"
WIFI_PSWD = "wifi_pswd"

SCAN_INTERVAL = datetime.timedelta(seconds=60)
71 changes: 71 additions & 0 deletions homeassistant/components/adax/coordinator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""DataUpdateCoordinator for the Adax component."""

import logging
from typing import Any, cast

from adax import Adax
from adax_local import Adax as AdaxLocal

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_TOKEN
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

from .const import ACCOUNT_ID, SCAN_INTERVAL

_LOGGER = logging.getLogger(__name__)


type AdaxConfigEntry = ConfigEntry[AdaxCloudCoordinator | AdaxLocalCoordinator]


class AdaxCloudCoordinator(DataUpdateCoordinator[dict[str, dict[str, Any]]]):
"""Coordinator for updating data to and from Adax (cloud)."""

def __init__(self, hass: HomeAssistant, entry: AdaxConfigEntry) -> None:
"""Initialize the Adax coordinator used for Cloud mode."""
super().__init__(
hass,
config_entry=entry,
logger=_LOGGER,
name="AdaxCloud",
update_interval=SCAN_INTERVAL,
)

self.adax_data_handler = Adax(
entry.data[ACCOUNT_ID],
entry.data[CONF_PASSWORD],
websession=async_get_clientsession(hass),
)

async def _async_update_data(self) -> dict[str, dict[str, Any]]:
"""Fetch data from the Adax."""
rooms = await self.adax_data_handler.get_rooms() or []
return {r["id"]: r for r in rooms}


class AdaxLocalCoordinator(DataUpdateCoordinator[dict[str, Any] | None]):
"""Coordinator for updating data to and from Adax (local)."""

def __init__(self, hass: HomeAssistant, entry: AdaxConfigEntry) -> None:
"""Initialize the Adax coordinator used for Local mode."""
super().__init__(
hass,
config_entry=entry,
logger=_LOGGER,
name="AdaxLocal",
update_interval=SCAN_INTERVAL,
)

self.adax_data_handler = AdaxLocal(
entry.data[CONF_IP_ADDRESS],
entry.data[CONF_TOKEN],
websession=async_get_clientsession(hass, verify_ssl=False),
)

async def _async_update_data(self) -> dict[str, Any]:
"""Fetch data from the Adax."""
if result := await self.adax_data_handler.get_status():
return cast(dict[str, Any], result)
raise UpdateFailed("Got invalid status from device")
10 changes: 7 additions & 3 deletions homeassistant/components/cloud/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,11 @@ async def async_get_tts_audio(
language=language,
voice=options.get(
ATTR_VOICE,
self._voice
if language == self._language
else DEFAULT_VOICES[language],
(
self._voice
if language == self._language
else DEFAULT_VOICES[language]
),
),
gender=options.get(ATTR_GENDER),
),
Expand All @@ -435,6 +437,8 @@ async def async_get_tts_audio(
class CloudProvider(Provider):
"""Home Assistant Cloud speech API provider."""

has_entity = True

def __init__(self, cloud: Cloud[CloudClient]) -> None:
"""Initialize cloud provider."""
self.cloud = cloud
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/conversation/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/conversation",
"integration_type": "system",
"quality_scale": "internal",
"requirements": ["hassil==2.2.3", "home-assistant-intents==2025.3.28"]
"requirements": ["hassil==2.2.3", "home-assistant-intents==2025.4.30"]
}
Loading