Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions homeassistant/components/bang_olufsen/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
}
},
"preset1": {
"name": "Favourite 1",
"name": "Favorite 1",
"state_attributes": {
"event_type": {
"state": {
Expand All @@ -107,7 +107,7 @@
}
},
"preset2": {
"name": "Favourite 2",
"name": "Favorite 2",
"state_attributes": {
"event_type": {
"state": {
Expand All @@ -121,7 +121,7 @@
}
},
"preset3": {
"name": "Favourite 3",
"name": "Favorite 3",
"state_attributes": {
"event_type": {
"state": {
Expand All @@ -135,7 +135,7 @@
}
},
"preset4": {
"name": "Favourite 4",
"name": "Favorite 4",
"state_attributes": {
"event_type": {
"state": {
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/paperless_ngx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions homeassistant/components/risco/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand All @@ -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%]"
}
}
}
Expand Down
31 changes: 4 additions & 27 deletions homeassistant/components/shelly/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,14 @@
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

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

Expand Down Expand Up @@ -234,26 +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 = DeviceInfo(
connections={(CONNECTION_NETWORK_MAC, coordinator.mac)}
)
self._attr_device_info = get_entity_rpc_device_info(coordinator)

async def _press_method(self) -> None:
"""Press method."""
Expand Down
13 changes: 2 additions & 11 deletions homeassistant/components/shelly/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
)
Expand Down
88 changes: 41 additions & 47 deletions homeassistant/components/shelly/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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:
Expand All @@ -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,
)
13 changes: 2 additions & 11 deletions homeassistant/components/shelly/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
13 changes: 3 additions & 10 deletions homeassistant/components/shelly/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
)


Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/suez_water/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "cloud_polling",
"loggers": ["pysuez", "regex"],
"quality_scale": "bronze",
"requirements": ["pysuezV2==2.0.5"]
"requirements": ["pysuezV2==2.0.7"]
}
2 changes: 1 addition & 1 deletion requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/components/bang_olufsen/snapshots/test_event.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion tests/components/bang_olufsen/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand Down
Loading
Loading