From c5cf9b07b7fa5df4908cba537462f8303763877c Mon Sep 17 00:00:00 2001 From: Norbert Rittel Date: Sat, 26 Jul 2025 12:34:24 +0200 Subject: [PATCH 1/6] Replace HA alarm (control panel) states with references in `risco` (#149466) --- homeassistant/components/risco/strings.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/risco/strings.json b/homeassistant/components/risco/strings.json index 86d131b4f80c4..22ed3ff4e528b 100644 --- a/homeassistant/components/risco/strings.json +++ b/homeassistant/components/risco/strings.json @@ -45,7 +45,7 @@ }, "risco_to_ha": { "title": "Map Risco states to Home Assistant states", - "description": "Select what state your Home Assistant alarm will report for every state reported by Risco", + "description": "Select what state your Home Assistant alarm control panel will report for every state reported by Risco", "data": { "arm": "Armed (AWAY)", "partial_arm": "Partially Armed (STAY)", @@ -57,12 +57,12 @@ }, "ha_to_risco": { "title": "Map Home Assistant states to Risco states", - "description": "Select what state to set your Risco alarm to when arming the Home Assistant alarm", + "description": "Select what state to set your Risco alarm to when arming the Home Assistant alarm control panel", "data": { - "armed_away": "Armed Away", - "armed_home": "Armed Home", - "armed_night": "Armed Night", - "armed_custom_bypass": "Armed Custom Bypass" + "armed_away": "[%key:component::alarm_control_panel::entity_component::_::state::armed_away%]", + "armed_home": "[%key:component::alarm_control_panel::entity_component::_::state::armed_home%]", + "armed_night": "[%key:component::alarm_control_panel::entity_component::_::state::armed_night%]", + "armed_custom_bypass": "[%key:component::alarm_control_panel::entity_component::_::state::armed_custom_bypass%]" } } } From be5109fddf26cae70ff101e60568f9bfc59afb29 Mon Sep 17 00:00:00 2001 From: Norbert Rittel Date: Sat, 26 Jul 2025 12:35:11 +0200 Subject: [PATCH 2/6] Change spelling of "Favorite x" to intl. English in `bang_olufsen` (#149464) --- homeassistant/components/bang_olufsen/strings.json | 8 ++++---- tests/components/bang_olufsen/snapshots/test_event.ambr | 8 ++++---- tests/components/bang_olufsen/test_event.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/bang_olufsen/strings.json b/homeassistant/components/bang_olufsen/strings.json index 422dc4be5672d..bacd32fa77ec6 100644 --- a/homeassistant/components/bang_olufsen/strings.json +++ b/homeassistant/components/bang_olufsen/strings.json @@ -93,7 +93,7 @@ } }, "preset1": { - "name": "Favourite 1", + "name": "Favorite 1", "state_attributes": { "event_type": { "state": { @@ -107,7 +107,7 @@ } }, "preset2": { - "name": "Favourite 2", + "name": "Favorite 2", "state_attributes": { "event_type": { "state": { @@ -121,7 +121,7 @@ } }, "preset3": { - "name": "Favourite 3", + "name": "Favorite 3", "state_attributes": { "event_type": { "state": { @@ -135,7 +135,7 @@ } }, "preset4": { - "name": "Favourite 4", + "name": "Favorite 4", "state_attributes": { "event_type": { "state": { diff --git a/tests/components/bang_olufsen/snapshots/test_event.ambr b/tests/components/bang_olufsen/snapshots/test_event.ambr index 3b748d3a27a21..a7fc2c88e49cd 100644 --- a/tests/components/bang_olufsen/snapshots/test_event.ambr +++ b/tests/components/bang_olufsen/snapshots/test_event.ambr @@ -5,10 +5,10 @@ 'event.beosound_balance_11111111_microphone', 'event.beosound_balance_11111111_next', 'event.beosound_balance_11111111_play_pause', - 'event.beosound_balance_11111111_favourite_1', - 'event.beosound_balance_11111111_favourite_2', - 'event.beosound_balance_11111111_favourite_3', - 'event.beosound_balance_11111111_favourite_4', + 'event.beosound_balance_11111111_favorite_1', + 'event.beosound_balance_11111111_favorite_2', + 'event.beosound_balance_11111111_favorite_3', + 'event.beosound_balance_11111111_favorite_4', 'event.beosound_balance_11111111_previous', 'event.beosound_balance_11111111_volume', 'media_player.beosound_balance_11111111', diff --git a/tests/components/bang_olufsen/test_event.py b/tests/components/bang_olufsen/test_event.py index 11f337b715f41..1e5546ac5f2fe 100644 --- a/tests/components/bang_olufsen/test_event.py +++ b/tests/components/bang_olufsen/test_event.py @@ -32,7 +32,7 @@ async def test_button_event_creation( # Add Button Event entity ids entity_ids = [ f"event.beosound_balance_11111111_{underscore(button_type)}".replace( - "preset", "favourite_" + "preset", "favorite_" ) for button_type in DEVICE_BUTTONS ] From e1501d7510609e640f0daefe649c297a3c5427fa Mon Sep 17 00:00:00 2001 From: jb101010-2 <168106462+jb101010-2@users.noreply.github.com> Date: Sat, 26 Jul 2025 12:38:38 +0200 Subject: [PATCH 3/6] Bump pysuezV2 to 2.0.7 (#149436) --- homeassistant/components/suez_water/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/suez_water/conftest.py | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/suez_water/manifest.json b/homeassistant/components/suez_water/manifest.json index 9149f216563dc..5c23240ce9196 100644 --- a/homeassistant/components/suez_water/manifest.json +++ b/homeassistant/components/suez_water/manifest.json @@ -8,5 +8,5 @@ "iot_class": "cloud_polling", "loggers": ["pysuez", "regex"], "quality_scale": "bronze", - "requirements": ["pysuezV2==2.0.5"] + "requirements": ["pysuezV2==2.0.7"] } diff --git a/requirements_all.txt b/requirements_all.txt index f308f39aa8633..2229ee3e3a054 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2385,7 +2385,7 @@ pysqueezebox==0.12.1 pystiebeleltron==0.1.0 # homeassistant.components.suez_water -pysuezV2==2.0.5 +pysuezV2==2.0.7 # homeassistant.components.switchbee pyswitchbee==1.8.3 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index daac6214663e4..5462957f60caf 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1988,7 +1988,7 @@ pysqueezebox==0.12.1 pystiebeleltron==0.1.0 # homeassistant.components.suez_water -pysuezV2==2.0.5 +pysuezV2==2.0.7 # homeassistant.components.switchbee pyswitchbee==1.8.3 diff --git a/tests/components/suez_water/conftest.py b/tests/components/suez_water/conftest.py index 9d29191289e06..005c14b745845 100644 --- a/tests/components/suez_water/conftest.py +++ b/tests/components/suez_water/conftest.py @@ -87,5 +87,7 @@ def mock_suez_client(recorder_mock: Recorder) -> Generator[AsyncMock]: ) suez_client.fetch_aggregated_data.return_value = result - suez_client.get_price.return_value = PriceResult("4.74") + suez_client.get_price.return_value = PriceResult( + "OK", {"price": 4.74}, "Price is 4.74" + ) yield suez_client From 5aa0d0dc81b5270877d6f0746bb0653c225aee40 Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Sat, 26 Jul 2025 14:32:51 +0300 Subject: [PATCH 4/6] Remove Shelly redundant device info assignment in Button class (#149469) --- homeassistant/components/shelly/button.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/homeassistant/components/shelly/button.py b/homeassistant/components/shelly/button.py index 2ab23441c9832..bd42af002d3f5 100644 --- a/homeassistant/components/shelly/button.py +++ b/homeassistant/components/shelly/button.py @@ -19,7 +19,6 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import entity_registry as er -from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.util import slugify @@ -251,9 +250,6 @@ def __init__( coordinator.model_name, suggested_area=coordinator.suggested_area, ) - self._attr_device_info = DeviceInfo( - connections={(CONNECTION_NETWORK_MAC, coordinator.mac)} - ) async def _press_method(self) -> None: """Press method.""" From 7976729e76f0903565af0873d54ab59db8780ea9 Mon Sep 17 00:00:00 2001 From: Florian von Garrel Date: Sat, 26 Jul 2025 14:19:33 +0200 Subject: [PATCH 5/6] Paperless-ngx: Retry setup on initialization error (#149476) --- homeassistant/components/paperless_ngx/__init__.py | 2 +- tests/components/paperless_ngx/test_init.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/paperless_ngx/__init__.py b/homeassistant/components/paperless_ngx/__init__.py index 0fea90b7ea3b5..da990be7173ce 100644 --- a/homeassistant/components/paperless_ngx/__init__.py +++ b/homeassistant/components/paperless_ngx/__init__.py @@ -96,7 +96,7 @@ async def _get_paperless_api( translation_key="forbidden", ) from err except InitializationError as err: - raise ConfigEntryError( + raise ConfigEntryNotReady( translation_domain=DOMAIN, translation_key="cannot_connect", ) from err diff --git a/tests/components/paperless_ngx/test_init.py b/tests/components/paperless_ngx/test_init.py index fd459213ea03a..924e3966c79f9 100644 --- a/tests/components/paperless_ngx/test_init.py +++ b/tests/components/paperless_ngx/test_init.py @@ -63,7 +63,7 @@ async def test_load_config_status_forbidden( "user_inactive_or_deleted", ), (PaperlessForbiddenError(), ConfigEntryState.SETUP_ERROR, "forbidden"), - (InitializationError(), ConfigEntryState.SETUP_ERROR, "cannot_connect"), + (InitializationError(), ConfigEntryState.SETUP_RETRY, "cannot_connect"), ], ) async def test_setup_config_error_handling( From b6bd92ed192ec17183d08284823c9d8b808bbc79 Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Sat, 26 Jul 2025 17:08:08 +0300 Subject: [PATCH 6/6] Shelly entity device info code quality (#149477) --- homeassistant/components/shelly/button.py | 27 +------ homeassistant/components/shelly/climate.py | 13 +--- homeassistant/components/shelly/entity.py | 88 ++++++++++------------ homeassistant/components/shelly/event.py | 13 +--- homeassistant/components/shelly/sensor.py | 13 +--- 5 files changed, 52 insertions(+), 102 deletions(-) diff --git a/homeassistant/components/shelly/button.py b/homeassistant/components/shelly/button.py index bd42af002d3f5..209fa4af54a2e 100644 --- a/homeassistant/components/shelly/button.py +++ b/homeassistant/components/shelly/button.py @@ -25,13 +25,8 @@ from .const import DOMAIN, LOGGER, SHELLY_GAS_MODELS from .coordinator import ShellyBlockCoordinator, ShellyConfigEntry, ShellyRpcCoordinator -from .utils import ( - get_block_device_info, - get_blu_trv_device_info, - get_device_entry_gen, - get_rpc_device_info, - get_rpc_key_ids, -) +from .entity import get_entity_block_device_info, get_entity_rpc_device_info +from .utils import get_blu_trv_device_info, get_device_entry_gen, get_rpc_key_ids PARALLEL_UPDATES = 0 @@ -233,23 +228,9 @@ def __init__( self._attr_unique_id = f"{coordinator.mac}_{description.key}" if isinstance(coordinator, ShellyBlockCoordinator): - self._attr_device_info = get_block_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - suggested_area=coordinator.suggested_area, - ) + self._attr_device_info = get_entity_block_device_info(coordinator) else: - self._attr_device_info = get_rpc_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - suggested_area=coordinator.suggested_area, - ) + self._attr_device_info = get_entity_rpc_device_info(coordinator) async def _press_method(self) -> None: """Press method.""" diff --git a/homeassistant/components/shelly/climate.py b/homeassistant/components/shelly/climate.py index 2a09e867dce1c..3a495c9f4ac96 100644 --- a/homeassistant/components/shelly/climate.py +++ b/homeassistant/components/shelly/climate.py @@ -38,10 +38,9 @@ SHTRV_01_TEMPERATURE_SETTINGS, ) from .coordinator import ShellyBlockCoordinator, ShellyConfigEntry, ShellyRpcCoordinator -from .entity import ShellyRpcEntity, rpc_call +from .entity import ShellyRpcEntity, get_entity_block_device_info, rpc_call from .utils import ( async_remove_shelly_entity, - get_block_device_info, get_block_entity_name, get_blu_trv_device_info, get_device_entry_gen, @@ -210,15 +209,7 @@ def __init__( ] elif entry is not None: self._unique_id = entry.unique_id - self._attr_device_info = get_block_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - sensor_block, - suggested_area=coordinator.suggested_area, - ) + self._attr_device_info = get_entity_block_device_info(coordinator, sensor_block) self._attr_name = get_block_entity_name( self.coordinator.device, sensor_block, None ) diff --git a/homeassistant/components/shelly/entity.py b/homeassistant/components/shelly/entity.py index 33a45a0e10fee..97946ddd8f36a 100644 --- a/homeassistant/components/shelly/entity.py +++ b/homeassistant/components/shelly/entity.py @@ -13,6 +13,7 @@ from homeassistant.core import HomeAssistant, State, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import entity_registry as er +from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.entity import Entity, EntityDescription from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_registry import RegistryEntry @@ -368,15 +369,7 @@ def __init__(self, coordinator: ShellyBlockCoordinator, block: Block) -> None: super().__init__(coordinator) self.block = block self._attr_name = get_block_entity_name(coordinator.device, block) - self._attr_device_info = get_block_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - block, - suggested_area=coordinator.suggested_area, - ) + self._attr_device_info = get_entity_block_device_info(coordinator, block) self._attr_unique_id = f"{coordinator.mac}-{block.description}" # pylint: disable-next=hass-missing-super-call @@ -417,15 +410,7 @@ def __init__(self, coordinator: ShellyRpcCoordinator, key: str) -> None: """Initialize Shelly entity.""" super().__init__(coordinator) self.key = key - self._attr_device_info = get_rpc_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - key, - suggested_area=coordinator.suggested_area, - ) + self._attr_device_info = get_entity_rpc_device_info(coordinator, key) self._attr_unique_id = f"{coordinator.mac}-{key}" self._attr_name = get_rpc_entity_name(coordinator.device, key) @@ -539,14 +524,7 @@ def __init__( coordinator.device, None, description.name ) self._attr_unique_id = f"{coordinator.mac}-{attribute}" - self._attr_device_info = get_block_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - suggested_area=coordinator.suggested_area, - ) + self._attr_device_info = get_entity_block_device_info(coordinator) self._last_value = None @property @@ -653,15 +631,7 @@ def __init__( self.block: Block | None = block # type: ignore[assignment] self.entity_description = description - self._attr_device_info = get_block_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - block, - suggested_area=coordinator.suggested_area, - ) + self._attr_device_info = get_entity_block_device_info(coordinator, block) if block is not None: self._attr_unique_id = ( @@ -726,18 +696,8 @@ def __init__( self.attribute = attribute self.entity_description = description - self._attr_device_info = get_rpc_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - key, - suggested_area=coordinator.suggested_area, - ) - self._attr_unique_id = self._attr_unique_id = ( - f"{coordinator.mac}-{key}-{attribute}" - ) + self._attr_device_info = get_entity_rpc_device_info(coordinator, key) + self._attr_unique_id = f"{coordinator.mac}-{key}-{attribute}" self._last_value = None if coordinator.device.initialized: @@ -763,3 +723,37 @@ def get_entity_class( return description.entity_class return sensor_class + + +def get_entity_block_device_info( + coordinator: ShellyBlockCoordinator, + block: Block | None = None, +) -> DeviceInfo: + """Get device info for block entities.""" + return get_block_device_info( + coordinator.device, + coordinator.mac, + coordinator.configuration_url, + coordinator.model, + coordinator.model_name, + block, + suggested_area=coordinator.suggested_area, + ) + + +def get_entity_rpc_device_info( + coordinator: ShellyRpcCoordinator, + key: str | None = None, + emeter_phase: str | None = None, +) -> DeviceInfo: + """Get device info for RPC entities.""" + return get_rpc_device_info( + coordinator.device, + coordinator.mac, + coordinator.configuration_url, + coordinator.model, + coordinator.model_name, + key, + emeter_phase=emeter_phase, + suggested_area=coordinator.suggested_area, + ) diff --git a/homeassistant/components/shelly/event.py b/homeassistant/components/shelly/event.py index 9e1c748c79068..8b2b92e11ce31 100644 --- a/homeassistant/components/shelly/event.py +++ b/homeassistant/components/shelly/event.py @@ -26,12 +26,11 @@ SHIX3_1_INPUTS_EVENTS_TYPES, ) from .coordinator import ShellyBlockCoordinator, ShellyConfigEntry, ShellyRpcCoordinator -from .entity import ShellyBlockEntity +from .entity import ShellyBlockEntity, get_entity_rpc_device_info from .utils import ( async_remove_orphaned_entities, async_remove_shelly_entity, get_device_entry_gen, - get_rpc_device_info, get_rpc_entity_name, get_rpc_key_instances, is_block_momentary_input, @@ -206,15 +205,7 @@ def __init__( """Initialize Shelly entity.""" super().__init__(coordinator) self.event_id = int(key.split(":")[-1]) - self._attr_device_info = get_rpc_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - key, - suggested_area=coordinator.suggested_area, - ) + self._attr_device_info = get_entity_rpc_device_info(coordinator, key) self._attr_unique_id = f"{coordinator.mac}-{key}" self._attr_name = get_rpc_entity_name(coordinator.device, key) self.entity_description = description diff --git a/homeassistant/components/shelly/sensor.py b/homeassistant/components/shelly/sensor.py index cdfa97357f2f4..49e3d4773c7f7 100644 --- a/homeassistant/components/shelly/sensor.py +++ b/homeassistant/components/shelly/sensor.py @@ -52,13 +52,13 @@ async_setup_entry_attribute_entities, async_setup_entry_rest, async_setup_entry_rpc, + get_entity_rpc_device_info, ) from .utils import ( async_remove_orphaned_entities, get_blu_trv_device_info, get_device_entry_gen, get_device_uptime, - get_rpc_device_info, get_shelly_air_lamp_life, get_virtual_component_ids, is_rpc_wifi_stations_disabled, @@ -138,15 +138,8 @@ def __init__( """Initialize select.""" super().__init__(coordinator, key, attribute, description) - self._attr_device_info = get_rpc_device_info( - coordinator.device, - coordinator.mac, - coordinator.configuration_url, - coordinator.model, - coordinator.model_name, - key, - emeter_phase=description.emeter_phase, - suggested_area=coordinator.suggested_area, + self._attr_device_info = get_entity_rpc_device_info( + coordinator, key, emeter_phase=description.emeter_phase )