1
0
mirror of https://github.com/home-assistant/core.git synced 2026-08-06 05:14:06 +01:00

Bump lyngdorf to 1.4.0 (#177685)

This commit is contained in:
Alex Fishlock
2026-08-03 22:10:31 +01:00
committed by GitHub
parent b5890bb497
commit ebd12dcda4
7 changed files with 80 additions and 31 deletions
+20 -19
View File
@@ -71,25 +71,26 @@ async def async_setup_entry(
model=lyngdorf_model.model_name,
)
# Register the main device up front so Zone B can resolve its via_device_id.
device_registry = dr.async_get(hass)
device_registry.async_get_or_create(
config_entry_id=config_entry.entry_id, **device_info
)
zone_b_device_info = DeviceInfo(
identifiers={(DOMAIN, f"{config_entry.unique_id}_zone_b")},
manufacturer=lyngdorf_model.manufacturer,
serial_number=serial,
model=lyngdorf_model.model_name,
translation_key="zone_b",
translation_placeholders={"device_name": config_entry.title},
via_device_id=async_get_device_id_by_identifier(
hass,
(DOMAIN, config_entry.unique_id),
config_entry_id=config_entry.entry_id,
),
)
zone_b_device_info: DeviceInfo | None = None
if lyngdorf_model.has_zone_b_feature():
# Register the main device up front so Zone B can resolve its via_device_id.
device_registry = dr.async_get(hass)
device_registry.async_get_or_create(
config_entry_id=config_entry.entry_id, **device_info
)
zone_b_device_info = DeviceInfo(
identifiers={(DOMAIN, f"{config_entry.unique_id}_zone_b")},
manufacturer=lyngdorf_model.manufacturer,
serial_number=serial,
model=lyngdorf_model.model_name,
translation_key="zone_b",
translation_placeholders={"device_name": config_entry.title},
via_device_id=async_get_device_id_by_identifier(
hass,
(DOMAIN, config_entry.unique_id),
config_entry_id=config_entry.entry_id,
),
)
config_entry.runtime_data = LyngdorfRuntimeData(
receiver=receiver,
@@ -9,7 +9,7 @@
"iot_class": "local_push",
"loggers": ["lyngdorf", "async_upnp_client"],
"quality_scale": "silver",
"requirements": ["lyngdorf==1.3.3"],
"requirements": ["lyngdorf==1.4.0"],
"ssdp": [
{
"deviceType": "urn:schemas-upnp-org:device:MediaRenderer:2",
@@ -51,16 +51,19 @@ async def async_setup_entry(
"""Set up the receiver from a config entry."""
runtime_data = config_entry.runtime_data
async_add_entities(
[
LyngdorfMainDevice(
runtime_data.receiver, config_entry, runtime_data.device_info
),
entities: list[LyngdorfDevice] = [
LyngdorfMainDevice(
runtime_data.receiver, config_entry, runtime_data.device_info
)
]
if runtime_data.zone_b_device_info is not None:
entities.append(
LyngdorfZoneBDevice(
runtime_data.receiver, config_entry, runtime_data.zone_b_device_info
),
]
)
)
)
async_add_entities(entities)
def _to_ha_volume(volume_db: float) -> float:
+1 -1
View File
@@ -14,7 +14,7 @@ class LyngdorfRuntimeData:
receiver: Receiver
device_info: DeviceInfo
zone_b_device_info: DeviceInfo
zone_b_device_info: DeviceInfo | None
type LyngdorfConfigEntry = ConfigEntry[LyngdorfRuntimeData]
+1 -1
View File
@@ -1531,7 +1531,7 @@ lw12==0.9.2
lxml==6.1.1
# homeassistant.components.lyngdorf
lyngdorf==1.3.3
lyngdorf==1.4.0
# homeassistant.components.matrix
matrix-nio==0.26.0
+23
View File
@@ -127,3 +127,26 @@ async def test_mac_connection_registered_when_serial_is_mac(
value for kind, value in device.connections if kind == dr.CONNECTION_NETWORK_MAC
}
assert mac_connections == expected_mac_connections
@pytest.mark.usefixtures("mock_receiver")
async def test_no_zone_b_device_for_model_without_zone_b(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
device_registry: dr.DeviceRegistry,
) -> None:
"""Test no Zone B device is created for a model without Zone B."""
mock_config_entry.add_to_hass(hass)
with patch(
"homeassistant.components.lyngdorf.lookup_receiver_model",
return_value=LyngdorfModel.TDAI_3400,
):
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
assert mock_config_entry.state is ConfigEntryState.LOADED
device = device_registry.async_get_device(
identifiers={(DOMAIN, f"{mock_config_entry.unique_id}_zone_b")}
)
assert device is None
+23 -1
View File
@@ -1,7 +1,8 @@
"""Tests for the Lyngdorf media player platform."""
from unittest.mock import MagicMock
from unittest.mock import MagicMock, patch
from lyngdorf.const import LyngdorfModel
import pytest
from syrupy.assertion import SnapshotAssertion
@@ -46,6 +47,27 @@ async def test_entities(
await snapshot_platform(hass, entity_registry, snapshot, init_integration.entry_id)
@pytest.mark.usefixtures("mock_receiver")
async def test_no_zone_b_entity_for_model_without_zone_b(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
entity_registry: er.EntityRegistry,
) -> None:
"""Test no Zone B media player entity is created for a model without Zone B."""
mock_config_entry.add_to_hass(hass)
with patch(
"homeassistant.components.lyngdorf.lookup_receiver_model",
return_value=LyngdorfModel.TDAI_3400,
):
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
assert hass.states.get(ZONE_B) is None
assert entity_registry.async_get(ZONE_B) is None
assert hass.states.get(MAIN_ZONE) is not None
@pytest.mark.parametrize(
("entity_id", "service", "attr", "expected"),
[