From 19fd6e20367dfd125edad9fef3ce370e508d19f9 Mon Sep 17 00:00:00 2001 From: Ariel Ebersberger <31776703+justanotherariel@users.noreply.github.com> Date: Thu, 23 Apr 2026 21:26:54 +0200 Subject: [PATCH] Fix b&o race conditions for Python 3.14.3 (#168885) --- .../components/bang_olufsen/__init__.py | 33 +- .../components/bang_olufsen/config_flow.py | 10 +- .../components/bang_olufsen/event.py | 7 - .../components/bang_olufsen/sensor.py | 2 +- tests/components/bang_olufsen/conftest.py | 13 +- tests/components/bang_olufsen/const.py | 24 +- .../snapshots/test_diagnostics.ambr | 24 +- .../bang_olufsen/snapshots/test_event.ambr | 66 +-- .../snapshots/test_media_player.ambr | 94 ++-- .../snapshots/test_websocket.ambr | 470 +++++++++--------- tests/components/bang_olufsen/test_init.py | 2 +- .../components/bang_olufsen/test_websocket.py | 26 +- tests/components/bang_olufsen/util.py | 12 +- 13 files changed, 392 insertions(+), 391 deletions(-) diff --git a/homeassistant/components/bang_olufsen/__init__.py b/homeassistant/components/bang_olufsen/__init__.py index 1668b03b021..6b0f1d5f308 100644 --- a/homeassistant/components/bang_olufsen/__init__.py +++ b/homeassistant/components/bang_olufsen/__init__.py @@ -21,8 +21,9 @@ from homeassistant.helpers import config_validation as cv, device_registry as dr from homeassistant.helpers.typing import ConfigType from homeassistant.util.ssl import get_default_context -from .const import DOMAIN +from .const import DOMAIN, MANUFACTURER, BeoModel from .services import async_setup_services +from .util import get_remotes from .websocket import BeoWebsocket @@ -58,15 +59,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: BeoConfigEntry) -> bool: # Remove casts to str assert entry.unique_id - # Create device now as BeoWebsocket needs a device for debug logging, firing events etc. - device_registry = dr.async_get(hass) - device_registry.async_get_or_create( - config_entry_id=entry.entry_id, - identifiers={(DOMAIN, entry.unique_id)}, - name=entry.title, - model=entry.data[CONF_MODEL], - ) - client = MozartClient(host=entry.data[CONF_HOST], ssl_context=get_default_context()) # Check API and WebSocket connection @@ -83,6 +75,27 @@ async def async_setup_entry(hass: HomeAssistant, entry: BeoConfigEntry) -> bool: await client.close_api_client() raise ConfigEntryNotReady(f"Unable to connect to {entry.title}") from error + # Create device now as BeoWebsocket needs a device for debug logging, firing events etc. + device_registry = dr.async_get(hass) + device_registry.async_get_or_create( + config_entry_id=entry.entry_id, + identifiers={(DOMAIN, entry.unique_id)}, + model=entry.data[CONF_MODEL], + ) + + # Create devices for paired Beoremote One remotes + for remote in await get_remotes(client): + device_registry.async_get_or_create( + config_entry_id=entry.entry_id, + identifiers={(DOMAIN, f"{remote.serial_number}_{entry.unique_id}")}, + name=f"{BeoModel.BEOREMOTE_ONE}-{remote.serial_number}-{entry.unique_id}", + model=BeoModel.BEOREMOTE_ONE, + serial_number=remote.serial_number, + sw_version=remote.app_version, + manufacturer=MANUFACTURER, + via_device=(DOMAIN, entry.unique_id), + ) + websocket = BeoWebsocket(hass, entry, client) # Add the websocket and API client diff --git a/homeassistant/components/bang_olufsen/config_flow.py b/homeassistant/components/bang_olufsen/config_flow.py index 62ee08502e2..2b0dc774f49 100644 --- a/homeassistant/components/bang_olufsen/config_flow.py +++ b/homeassistant/components/bang_olufsen/config_flow.py @@ -52,6 +52,7 @@ class BeoConfigFlowHandler(ConfigFlow, domain=DOMAIN): _beolink_jid = "" _client: MozartClient + _friendly_name = "" _host = "" _model = "" _name = "" @@ -111,6 +112,7 @@ class BeoConfigFlowHandler(ConfigFlow, domain=DOMAIN): ) self._beolink_jid = beolink_self.jid + self._friendly_name = beolink_self.friendly_name self._serial_number = get_serial_number_from_jid(beolink_self.jid) await self.async_set_unique_id(self._serial_number) @@ -149,6 +151,7 @@ class BeoConfigFlowHandler(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="invalid_address") self._model = discovery_info.hostname[:-16].replace("-", " ") + self._friendly_name = discovery_info.properties[ATTR_FRIENDLY_NAME] self._serial_number = discovery_info.properties[ATTR_SERIAL_NUMBER] self._beolink_jid = f"{discovery_info.properties[ATTR_TYPE_NUMBER]}.{discovery_info.properties[ATTR_ITEM_NUMBER]}.{self._serial_number}@products.bang-olufsen.com" @@ -164,16 +167,13 @@ class BeoConfigFlowHandler(ConfigFlow, domain=DOMAIN): async def _create_entry(self) -> ConfigFlowResult: """Create the config entry for a discovered or manually configured Bang & Olufsen device.""" - # Ensure that created entities have a unique and easily identifiable id and not a "friendly name" - self._name = f"{self._model}-{self._serial_number}" - return self.async_create_entry( - title=self._name, + title=self._friendly_name, data=EntryData( host=self._host, jid=self._beolink_jid, model=self._model, - name=self._name, + name=self._friendly_name, ), ) diff --git a/homeassistant/components/bang_olufsen/event.py b/homeassistant/components/bang_olufsen/event.py index a14e940b655..270a51c0c64 100644 --- a/homeassistant/components/bang_olufsen/event.py +++ b/homeassistant/components/bang_olufsen/event.py @@ -20,7 +20,6 @@ from .const import ( CONNECTION_STATUS, DEVICE_BUTTON_EVENTS, DOMAIN, - MANUFACTURER, BeoModel, WebsocketNotification, ) @@ -142,12 +141,6 @@ class BeoRemoteKeyEvent(BeoEvent): self._attr_unique_id = f"{remote.serial_number}_{self._unique_id}_{key_type}" self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, f"{remote.serial_number}_{self._unique_id}")}, - name=f"{BeoModel.BEOREMOTE_ONE}-{remote.serial_number}-{self._unique_id}", - model=BeoModel.BEOREMOTE_ONE, - serial_number=remote.serial_number, - sw_version=remote.app_version, - manufacturer=MANUFACTURER, - via_device=(DOMAIN, self._unique_id), ) # Make the native key name Home Assistant compatible diff --git a/homeassistant/components/bang_olufsen/sensor.py b/homeassistant/components/bang_olufsen/sensor.py index 9ff703112c3..04733ea6772 100644 --- a/homeassistant/components/bang_olufsen/sensor.py +++ b/homeassistant/components/bang_olufsen/sensor.py @@ -115,7 +115,7 @@ class BeoSensorRemoteBatteryLevel(BeoSensor): f"{remote.serial_number}_{self._unique_id}_remote_battery_level" ) self._attr_device_info = DeviceInfo( - identifiers={(DOMAIN, f"{remote.serial_number}_{self._unique_id}")} + identifiers={(DOMAIN, f"{remote.serial_number}_{self._unique_id}")}, ) self._attr_native_value = remote.battery_level self._remote = remote diff --git a/tests/components/bang_olufsen/conftest.py b/tests/components/bang_olufsen/conftest.py index 5f94c26558b..90d004b7480 100644 --- a/tests/components/bang_olufsen/conftest.py +++ b/tests/components/bang_olufsen/conftest.py @@ -41,6 +41,7 @@ from .const import ( TEST_DATA_CREATE_ENTRY_3, TEST_DATA_CREATE_ENTRY_4, TEST_FRIENDLY_NAME, + TEST_FRIENDLY_NAME_2, TEST_FRIENDLY_NAME_3, TEST_FRIENDLY_NAME_4, TEST_HOST_3, @@ -48,10 +49,6 @@ from .const import ( TEST_JID_1, TEST_JID_3, TEST_JID_4, - TEST_NAME, - TEST_NAME_2, - TEST_NAME_3, - TEST_NAME_4, TEST_REMOTE_SERIAL, TEST_SERIAL_NUMBER, TEST_SERIAL_NUMBER_2, @@ -72,7 +69,7 @@ def mock_config_entry() -> MockConfigEntry: domain=DOMAIN, unique_id=TEST_SERIAL_NUMBER, data=TEST_DATA_CREATE_ENTRY, - title=TEST_NAME, + title=TEST_FRIENDLY_NAME, ) @@ -83,7 +80,7 @@ def mock_config_entry_core() -> MockConfigEntry: domain=DOMAIN, unique_id=TEST_SERIAL_NUMBER_2, data=TEST_DATA_CREATE_ENTRY_2, - title=TEST_NAME_2, + title=TEST_FRIENDLY_NAME_2, ) @@ -94,7 +91,7 @@ def mock_config_entry_premiere() -> MockConfigEntry: domain=DOMAIN, unique_id=TEST_SERIAL_NUMBER_3, data=TEST_DATA_CREATE_ENTRY_3, - title=TEST_NAME_3, + title=TEST_FRIENDLY_NAME_3, ) @@ -105,7 +102,7 @@ def mock_config_entry_a5() -> MockConfigEntry: domain=DOMAIN, unique_id=TEST_SERIAL_NUMBER_4, data=TEST_DATA_CREATE_ENTRY_4, - title=TEST_NAME_4, + title=TEST_FRIENDLY_NAME_4, ) diff --git a/tests/components/bang_olufsen/const.py b/tests/components/bang_olufsen/const.py index 53e86f83e2f..35a7be68590 100644 --- a/tests/components/bang_olufsen/const.py +++ b/tests/components/bang_olufsen/const.py @@ -49,32 +49,30 @@ TEST_FRIENDLY_NAME = "Living room Balance" TEST_TYPE_NUMBER = "1111" TEST_ITEM_NUMBER = "1111111" TEST_JID_1 = f"{TEST_TYPE_NUMBER}.{TEST_ITEM_NUMBER}.{TEST_SERIAL_NUMBER}@products.bang-olufsen.com" -TEST_MEDIA_PLAYER_ENTITY_ID = "media_player.beosound_balance_11111111" +TEST_MEDIA_PLAYER_ENTITY_ID = "media_player.living_room_balance" TEST_FRIENDLY_NAME_2 = "Laundry room Core" TEST_SERIAL_NUMBER_2 = "22222222" TEST_NAME_2 = f"{TEST_MODEL_CORE}-{TEST_SERIAL_NUMBER_2}" TEST_JID_2 = f"{TEST_TYPE_NUMBER}.{TEST_ITEM_NUMBER}.{TEST_SERIAL_NUMBER_2}@products.bang-olufsen.com" -TEST_MEDIA_PLAYER_ENTITY_ID_2 = "media_player.beoconnect_core_22222222" +TEST_MEDIA_PLAYER_ENTITY_ID_2 = "media_player.laundry_room_core" TEST_HOST_2 = "192.168.0.2" TEST_FRIENDLY_NAME_3 = "Bedroom Premiere" TEST_SERIAL_NUMBER_3 = "33333333" TEST_NAME_3 = f"{TEST_MODEL_PREMIERE}-{TEST_SERIAL_NUMBER_3}" TEST_JID_3 = f"{TEST_TYPE_NUMBER}.{TEST_ITEM_NUMBER}.{TEST_SERIAL_NUMBER_3}@products.bang-olufsen.com" -TEST_MEDIA_PLAYER_ENTITY_ID_3 = f"media_player.beosound_premiere_{TEST_SERIAL_NUMBER_3}" +TEST_MEDIA_PLAYER_ENTITY_ID_3 = "media_player.bedroom_premiere" TEST_HOST_3 = "192.168.0.3" TEST_FRIENDLY_NAME_4 = "Lounge room A5" TEST_SERIAL_NUMBER_4 = "44444444" TEST_NAME_4 = f"{TEST_MODEL_A5}-{TEST_SERIAL_NUMBER_4}" TEST_JID_4 = f"{TEST_TYPE_NUMBER}.{TEST_ITEM_NUMBER}.{TEST_SERIAL_NUMBER_4}@products.bang-olufsen.com" -TEST_MEDIA_PLAYER_ENTITY_ID_4 = f"media_player.beosound_a5_{TEST_SERIAL_NUMBER_4}" +TEST_MEDIA_PLAYER_ENTITY_ID_4 = "media_player.lounge_room_a5" TEST_HOST_4 = "192.168.0.4" -TEST_BATTERY_SENSOR_ENTITY_ID = f"sensor.beosound_a5_{TEST_SERIAL_NUMBER_4}_battery" -TEST_BATTERY_CHARGING_BINARY_SENSOR_ENTITY_ID = ( - f"binary_sensor.beosound_a5_{TEST_SERIAL_NUMBER_4}_charging" -) +TEST_BATTERY_SENSOR_ENTITY_ID = "sensor.lounge_room_a5_battery" +TEST_BATTERY_CHARGING_BINARY_SENSOR_ENTITY_ID = "binary_sensor.lounge_room_a5_charging" # Beoremote One TEST_REMOTE_SERIAL = "55555555" @@ -85,7 +83,7 @@ TEST_REMOTE_KEY_EVENT_ENTITY_ID = "event.beoremote_one_55555555_11111111_control TEST_REMOTE_BATTERY_LEVEL_SENSOR_ENTITY_ID = ( "sensor.beoremote_one_55555555_11111111_battery" ) -TEST_BUTTON_EVENT_ENTITY_ID = "event.beosound_balance_11111111_play_pause" +TEST_BUTTON_EVENT_ENTITY_ID = "event.living_room_balance_play_pause" TEST_HOSTNAME_ZEROCONF = TEST_NAME.replace(" ", "-") + ".local." TEST_TYPE_ZEROCONF = "_bangolufsen._tcp.local." @@ -99,27 +97,27 @@ TEST_DATA_CREATE_ENTRY = { CONF_HOST: TEST_HOST, CONF_MODEL: TEST_MODEL_BALANCE, CONF_BEOLINK_JID: TEST_JID_1, - CONF_NAME: TEST_NAME, + CONF_NAME: TEST_FRIENDLY_NAME, } TEST_DATA_CREATE_ENTRY_2 = { CONF_HOST: TEST_HOST_2, CONF_MODEL: TEST_MODEL_CORE, CONF_BEOLINK_JID: TEST_JID_2, - CONF_NAME: TEST_NAME_2, + CONF_NAME: TEST_FRIENDLY_NAME_2, } TEST_DATA_CREATE_ENTRY_3 = { CONF_HOST: TEST_HOST_3, CONF_MODEL: TEST_MODEL_PREMIERE, CONF_BEOLINK_JID: TEST_JID_3, - CONF_NAME: TEST_NAME_3, + CONF_NAME: TEST_FRIENDLY_NAME_3, } TEST_DATA_CREATE_ENTRY_4 = { CONF_HOST: TEST_HOST_4, CONF_MODEL: TEST_MODEL_A5, CONF_BEOLINK_JID: TEST_JID_4, - CONF_NAME: TEST_NAME_4, + CONF_NAME: TEST_FRIENDLY_NAME_4, } TEST_DATA_ZEROCONF = ZeroconfServiceInfo( diff --git a/tests/components/bang_olufsen/snapshots/test_diagnostics.ambr b/tests/components/bang_olufsen/snapshots/test_diagnostics.ambr index 0d45adf710b..10066babd8f 100644 --- a/tests/components/bang_olufsen/snapshots/test_diagnostics.ambr +++ b/tests/components/bang_olufsen/snapshots/test_diagnostics.ambr @@ -14,7 +14,7 @@ ]), 'friendly_name': 'Living room Balance Play / Pause', }), - 'entity_id': 'event.beosound_balance_11111111_play_pause', + 'entity_id': 'event.living_room_balance_play_pause', 'state': 'unknown', }), 'config_entry': dict({ @@ -22,7 +22,7 @@ 'host': '192.168.0.1', 'jid': '1111.1111111.11111111@products.bang-olufsen.com', 'model': 'Beosound Balance', - 'name': 'Beosound Balance-11111111', + 'name': 'Living room Balance', }), 'disabled_by': None, 'discovery_keys': dict({ @@ -36,7 +36,7 @@ 'source': 'user', 'subentries': list([ ]), - 'title': 'Beosound Balance-11111111', + 'title': 'Living room Balance', 'unique_id': '11111111', 'version': 1, }), @@ -59,7 +59,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -79,7 +79,7 @@ ]), 'supported_features': 2095933, }), - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'state': 'playing', }), 'remote_55555555': dict({ @@ -128,7 +128,7 @@ 'state_class': 'measurement', 'unit_of_measurement': '%', }), - 'entity_id': 'sensor.beosound_a5_44444444_battery', + 'entity_id': 'sensor.lounge_room_a5_battery', 'state': '5', }), 'charging': dict({ @@ -136,7 +136,7 @@ 'device_class': 'battery_charging', 'friendly_name': 'Living room Balance Charging', }), - 'entity_id': 'binary_sensor.beosound_a5_44444444_charging', + 'entity_id': 'binary_sensor.lounge_room_a5_charging', 'state': 'off', }), 'config_entry': dict({ @@ -144,7 +144,7 @@ 'host': '192.168.0.4', 'jid': '1111.1111111.44444444@products.bang-olufsen.com', 'model': 'Beosound A5', - 'name': 'Beosound A5-44444444', + 'name': 'Lounge room A5', }), 'disabled_by': None, 'discovery_keys': dict({ @@ -158,7 +158,7 @@ 'source': 'user', 'subentries': list([ ]), - 'title': 'Beosound A5-44444444', + 'title': 'Lounge room A5', 'unique_id': '44444444', 'version': 1, }), @@ -181,9 +181,9 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_a5_44444444', + 'media_player.lounge_room_a5', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', - 'media_player.beosound_a5_44444444', + 'media_player.lounge_room_a5', ]), 'media_content_type': 'music', 'repeat': 'off', @@ -201,7 +201,7 @@ ]), 'supported_features': 2095933, }), - 'entity_id': 'media_player.beosound_a5_44444444', + 'entity_id': 'media_player.lounge_room_a5', 'state': 'playing', }), 'remote_55555555': dict({ diff --git a/tests/components/bang_olufsen/snapshots/test_event.ambr b/tests/components/bang_olufsen/snapshots/test_event.ambr index f0ee135f98e..90ce7cb1274 100644 --- a/tests/components/bang_olufsen/snapshots/test_event.ambr +++ b/tests/components/bang_olufsen/snapshots/test_event.ambr @@ -1,7 +1,7 @@ # serializer version: 1 # name: test_button_event_creation_a5 list([ - 'binary_sensor.beosound_a5_44444444_charging', + 'binary_sensor.lounge_room_a5_charging', 'event.beoremote_one_55555555_44444444_control_blue', 'event.beoremote_one_55555555_44444444_control_digit_0', 'event.beoremote_one_55555555_44444444_control_digit_1', @@ -92,18 +92,18 @@ 'event.beoremote_one_55555555_44444444_light_up', 'event.beoremote_one_55555555_44444444_light_wind', 'event.beoremote_one_55555555_44444444_light_yellow', - 'event.beosound_a5_44444444_bluetooth', - 'event.beosound_a5_44444444_favorite_1', - 'event.beosound_a5_44444444_favorite_2', - 'event.beosound_a5_44444444_favorite_3', - 'event.beosound_a5_44444444_favorite_4', - 'event.beosound_a5_44444444_next', - 'event.beosound_a5_44444444_play_pause', - 'event.beosound_a5_44444444_previous', - 'event.beosound_a5_44444444_volume', - 'media_player.beosound_a5_44444444', + 'event.lounge_room_a5_bluetooth', + 'event.lounge_room_a5_favorite_1', + 'event.lounge_room_a5_favorite_2', + 'event.lounge_room_a5_favorite_3', + 'event.lounge_room_a5_favorite_4', + 'event.lounge_room_a5_next', + 'event.lounge_room_a5_play_pause', + 'event.lounge_room_a5_previous', + 'event.lounge_room_a5_volume', + 'media_player.lounge_room_a5', 'sensor.beoremote_one_55555555_44444444_battery', - 'sensor.beosound_a5_44444444_battery', + 'sensor.lounge_room_a5_battery', ]) # --- # name: test_button_event_creation_balance @@ -198,22 +198,30 @@ 'event.beoremote_one_55555555_11111111_light_up', 'event.beoremote_one_55555555_11111111_light_wind', 'event.beoremote_one_55555555_11111111_light_yellow', - 'event.beosound_balance_11111111_bluetooth', - '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_microphone', - 'event.beosound_balance_11111111_next', - 'event.beosound_balance_11111111_play_pause', - 'event.beosound_balance_11111111_previous', - 'event.beosound_balance_11111111_volume', - 'media_player.beosound_balance_11111111', + 'event.living_room_balance_bluetooth', + 'event.living_room_balance_favorite_1', + 'event.living_room_balance_favorite_2', + 'event.living_room_balance_favorite_3', + 'event.living_room_balance_favorite_4', + 'event.living_room_balance_microphone', + 'event.living_room_balance_next', + 'event.living_room_balance_play_pause', + 'event.living_room_balance_previous', + 'event.living_room_balance_volume', + 'media_player.living_room_balance', 'sensor.beoremote_one_55555555_11111111_battery', ]) # --- # name: test_button_event_creation_premiere list([ + 'event.bedroom_premiere_favorite_1', + 'event.bedroom_premiere_favorite_2', + 'event.bedroom_premiere_favorite_3', + 'event.bedroom_premiere_favorite_4', + 'event.bedroom_premiere_next', + 'event.bedroom_premiere_play_pause', + 'event.bedroom_premiere_previous', + 'event.bedroom_premiere_volume', 'event.beoremote_one_55555555_33333333_control_blue', 'event.beoremote_one_55555555_33333333_control_digit_0', 'event.beoremote_one_55555555_33333333_control_digit_1', @@ -304,20 +312,12 @@ 'event.beoremote_one_55555555_33333333_light_up', 'event.beoremote_one_55555555_33333333_light_wind', 'event.beoremote_one_55555555_33333333_light_yellow', - 'event.beosound_premiere_33333333_favorite_1', - 'event.beosound_premiere_33333333_favorite_2', - 'event.beosound_premiere_33333333_favorite_3', - 'event.beosound_premiere_33333333_favorite_4', - 'event.beosound_premiere_33333333_next', - 'event.beosound_premiere_33333333_play_pause', - 'event.beosound_premiere_33333333_previous', - 'event.beosound_premiere_33333333_volume', - 'media_player.beosound_premiere_33333333', + 'media_player.bedroom_premiere', 'sensor.beoremote_one_55555555_33333333_battery', ]) # --- # name: test_no_button_and_remote_key_event_creation_core list([ - 'media_player.beoconnect_core_22222222', + 'media_player.laundry_room_core', ]) # --- diff --git a/tests/components/bang_olufsen/snapshots/test_media_player.ambr b/tests/components/bang_olufsen/snapshots/test_media_player.ambr index c62490f3bf9..add51d3bb17 100644 --- a/tests/components/bang_olufsen/snapshots/test_media_player.ambr +++ b/tests/components/bang_olufsen/snapshots/test_media_player.ambr @@ -19,7 +19,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -40,7 +40,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -67,7 +67,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -89,7 +89,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -116,7 +116,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -138,7 +138,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -165,7 +165,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -187,7 +187,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -214,7 +214,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -236,7 +236,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -263,7 +263,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -284,7 +284,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -311,7 +311,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -332,7 +332,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -359,7 +359,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -380,7 +380,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -407,7 +407,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -428,7 +428,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -455,7 +455,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -476,7 +476,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -503,7 +503,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -524,7 +524,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -551,7 +551,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -572,7 +572,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -599,7 +599,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -621,7 +621,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -648,7 +648,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beoconnect_core_22222222', + 'media_player.laundry_room_core', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -670,7 +670,7 @@ 'volume_level': 0.0, }), 'context': , - 'entity_id': 'media_player.beoconnect_core_22222222', + 'entity_id': 'media_player.laundry_room_core', 'last_changed': , 'last_reported': , 'last_updated': , @@ -697,7 +697,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -719,7 +719,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -746,7 +746,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beoconnect_core_22222222', + 'media_player.laundry_room_core', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -768,7 +768,7 @@ 'volume_level': 0.0, }), 'context': , - 'entity_id': 'media_player.beoconnect_core_22222222', + 'entity_id': 'media_player.laundry_room_core', 'last_changed': , 'last_reported': , 'last_updated': , @@ -795,7 +795,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -818,7 +818,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -845,7 +845,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beoconnect_core_22222222', + 'media_player.laundry_room_core', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -867,7 +867,7 @@ 'volume_level': 0.0, }), 'context': , - 'entity_id': 'media_player.beoconnect_core_22222222', + 'entity_id': 'media_player.laundry_room_core', 'last_changed': , 'last_reported': , 'last_updated': , @@ -894,7 +894,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -916,7 +916,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -943,7 +943,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beoconnect_core_22222222', + 'media_player.laundry_room_core', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -965,7 +965,7 @@ 'volume_level': 0.0, }), 'context': , - 'entity_id': 'media_player.beoconnect_core_22222222', + 'entity_id': 'media_player.laundry_room_core', 'last_changed': , 'last_reported': , 'last_updated': , @@ -992,7 +992,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beosound_balance_11111111', + 'media_player.living_room_balance', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -1013,7 +1013,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -1039,8 +1039,8 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beoconnect_core_22222222', - 'media_player.beosound_balance_11111111', + 'media_player.laundry_room_core', + 'media_player.living_room_balance', ]), 'media_content_type': , 'repeat': , @@ -1059,7 +1059,7 @@ 'supported_features': , }), 'context': , - 'entity_id': 'media_player.beosound_balance_11111111', + 'entity_id': 'media_player.living_room_balance', 'last_changed': , 'last_reported': , 'last_updated': , @@ -1086,7 +1086,7 @@ 'entity_picture_local': None, 'friendly_name': 'Living room Balance', 'group_members': list([ - 'media_player.beoconnect_core_22222222', + 'media_player.laundry_room_core', 'listener_not_in_hass-1111.1111111.33333333@products.bang-olufsen.com', 'listener_not_in_hass-1111.1111111.44444444@products.bang-olufsen.com', ]), @@ -1108,7 +1108,7 @@ 'volume_level': 0.0, }), 'context': , - 'entity_id': 'media_player.beoconnect_core_22222222', + 'entity_id': 'media_player.laundry_room_core', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/bang_olufsen/snapshots/test_websocket.ambr b/tests/components/bang_olufsen/snapshots/test_websocket.ambr index 642854fb9ed..133e483829c 100644 --- a/tests/components/bang_olufsen/snapshots/test_websocket.ambr +++ b/tests/components/bang_olufsen/snapshots/test_websocket.ambr @@ -1,56 +1,6 @@ # serializer version: 1 # name: test_on_remote_control_already_added list([ - 'event.beosound_balance_11111111_bluetooth', - 'event.beosound_balance_11111111_microphone', - 'event.beosound_balance_11111111_next', - 'event.beosound_balance_11111111_play_pause', - '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', - 'event.beoremote_one_55555555_11111111_light_blue', - 'event.beoremote_one_55555555_11111111_light_digit_0', - 'event.beoremote_one_55555555_11111111_light_digit_1', - 'event.beoremote_one_55555555_11111111_light_digit_2', - 'event.beoremote_one_55555555_11111111_light_digit_3', - 'event.beoremote_one_55555555_11111111_light_digit_4', - 'event.beoremote_one_55555555_11111111_light_digit_5', - 'event.beoremote_one_55555555_11111111_light_digit_6', - 'event.beoremote_one_55555555_11111111_light_digit_7', - 'event.beoremote_one_55555555_11111111_light_digit_8', - 'event.beoremote_one_55555555_11111111_light_digit_9', - 'event.beoremote_one_55555555_11111111_light_down', - 'event.beoremote_one_55555555_11111111_light_green', - 'event.beoremote_one_55555555_11111111_light_left', - 'event.beoremote_one_55555555_11111111_light_play', - 'event.beoremote_one_55555555_11111111_light_red', - 'event.beoremote_one_55555555_11111111_light_rewind', - 'event.beoremote_one_55555555_11111111_light_right', - 'event.beoremote_one_55555555_11111111_light_select', - 'event.beoremote_one_55555555_11111111_light_stop', - 'event.beoremote_one_55555555_11111111_light_up', - 'event.beoremote_one_55555555_11111111_light_wind', - 'event.beoremote_one_55555555_11111111_light_yellow', - 'event.beoremote_one_55555555_11111111_light_function_1', - 'event.beoremote_one_55555555_11111111_light_function_2', - 'event.beoremote_one_55555555_11111111_light_function_3', - 'event.beoremote_one_55555555_11111111_light_function_4', - 'event.beoremote_one_55555555_11111111_light_function_5', - 'event.beoremote_one_55555555_11111111_light_function_6', - 'event.beoremote_one_55555555_11111111_light_function_7', - 'event.beoremote_one_55555555_11111111_light_function_8', - 'event.beoremote_one_55555555_11111111_light_function_9', - 'event.beoremote_one_55555555_11111111_light_function_10', - 'event.beoremote_one_55555555_11111111_light_function_11', - 'event.beoremote_one_55555555_11111111_light_function_12', - 'event.beoremote_one_55555555_11111111_light_function_13', - 'event.beoremote_one_55555555_11111111_light_function_14', - 'event.beoremote_one_55555555_11111111_light_function_15', - 'event.beoremote_one_55555555_11111111_light_function_16', - 'event.beoremote_one_55555555_11111111_light_function_17', 'event.beoremote_one_55555555_11111111_control_blue', 'event.beoremote_one_55555555_11111111_control_digit_0', 'event.beoremote_one_55555555_11111111_control_digit_1', @@ -63,6 +13,33 @@ 'event.beoremote_one_55555555_11111111_control_digit_8', 'event.beoremote_one_55555555_11111111_control_digit_9', 'event.beoremote_one_55555555_11111111_control_down', + 'event.beoremote_one_55555555_11111111_control_function_1', + 'event.beoremote_one_55555555_11111111_control_function_10', + 'event.beoremote_one_55555555_11111111_control_function_11', + 'event.beoremote_one_55555555_11111111_control_function_12', + 'event.beoremote_one_55555555_11111111_control_function_13', + 'event.beoremote_one_55555555_11111111_control_function_14', + 'event.beoremote_one_55555555_11111111_control_function_15', + 'event.beoremote_one_55555555_11111111_control_function_16', + 'event.beoremote_one_55555555_11111111_control_function_17', + 'event.beoremote_one_55555555_11111111_control_function_18', + 'event.beoremote_one_55555555_11111111_control_function_19', + 'event.beoremote_one_55555555_11111111_control_function_2', + 'event.beoremote_one_55555555_11111111_control_function_20', + 'event.beoremote_one_55555555_11111111_control_function_21', + 'event.beoremote_one_55555555_11111111_control_function_22', + 'event.beoremote_one_55555555_11111111_control_function_23', + 'event.beoremote_one_55555555_11111111_control_function_24', + 'event.beoremote_one_55555555_11111111_control_function_25', + 'event.beoremote_one_55555555_11111111_control_function_26', + 'event.beoremote_one_55555555_11111111_control_function_27', + 'event.beoremote_one_55555555_11111111_control_function_3', + 'event.beoremote_one_55555555_11111111_control_function_4', + 'event.beoremote_one_55555555_11111111_control_function_5', + 'event.beoremote_one_55555555_11111111_control_function_6', + 'event.beoremote_one_55555555_11111111_control_function_7', + 'event.beoremote_one_55555555_11111111_control_function_8', + 'event.beoremote_one_55555555_11111111_control_function_9', 'event.beoremote_one_55555555_11111111_control_green', 'event.beoremote_one_55555555_11111111_control_left', 'event.beoremote_one_55555555_11111111_control_play', @@ -74,89 +51,62 @@ 'event.beoremote_one_55555555_11111111_control_up', 'event.beoremote_one_55555555_11111111_control_wind', 'event.beoremote_one_55555555_11111111_control_yellow', - 'event.beoremote_one_55555555_11111111_control_function_1', - 'event.beoremote_one_55555555_11111111_control_function_2', - 'event.beoremote_one_55555555_11111111_control_function_3', - 'event.beoremote_one_55555555_11111111_control_function_4', - 'event.beoremote_one_55555555_11111111_control_function_5', - 'event.beoremote_one_55555555_11111111_control_function_6', - 'event.beoremote_one_55555555_11111111_control_function_7', - 'event.beoremote_one_55555555_11111111_control_function_8', - 'event.beoremote_one_55555555_11111111_control_function_9', - 'event.beoremote_one_55555555_11111111_control_function_10', - 'event.beoremote_one_55555555_11111111_control_function_11', - 'event.beoremote_one_55555555_11111111_control_function_12', - 'event.beoremote_one_55555555_11111111_control_function_13', - 'event.beoremote_one_55555555_11111111_control_function_14', - 'event.beoremote_one_55555555_11111111_control_function_15', - 'event.beoremote_one_55555555_11111111_control_function_16', - 'event.beoremote_one_55555555_11111111_control_function_17', - 'event.beoremote_one_55555555_11111111_control_function_18', - 'event.beoremote_one_55555555_11111111_control_function_19', - 'event.beoremote_one_55555555_11111111_control_function_20', - 'event.beoremote_one_55555555_11111111_control_function_21', - 'event.beoremote_one_55555555_11111111_control_function_22', - 'event.beoremote_one_55555555_11111111_control_function_23', - 'event.beoremote_one_55555555_11111111_control_function_24', - 'event.beoremote_one_55555555_11111111_control_function_25', - 'event.beoremote_one_55555555_11111111_control_function_26', - 'event.beoremote_one_55555555_11111111_control_function_27', + 'event.beoremote_one_55555555_11111111_light_blue', + 'event.beoremote_one_55555555_11111111_light_digit_0', + 'event.beoremote_one_55555555_11111111_light_digit_1', + 'event.beoremote_one_55555555_11111111_light_digit_2', + 'event.beoremote_one_55555555_11111111_light_digit_3', + 'event.beoremote_one_55555555_11111111_light_digit_4', + 'event.beoremote_one_55555555_11111111_light_digit_5', + 'event.beoremote_one_55555555_11111111_light_digit_6', + 'event.beoremote_one_55555555_11111111_light_digit_7', + 'event.beoremote_one_55555555_11111111_light_digit_8', + 'event.beoremote_one_55555555_11111111_light_digit_9', + 'event.beoremote_one_55555555_11111111_light_down', + 'event.beoremote_one_55555555_11111111_light_function_1', + 'event.beoremote_one_55555555_11111111_light_function_10', + 'event.beoremote_one_55555555_11111111_light_function_11', + 'event.beoremote_one_55555555_11111111_light_function_12', + 'event.beoremote_one_55555555_11111111_light_function_13', + 'event.beoremote_one_55555555_11111111_light_function_14', + 'event.beoremote_one_55555555_11111111_light_function_15', + 'event.beoremote_one_55555555_11111111_light_function_16', + 'event.beoremote_one_55555555_11111111_light_function_17', + 'event.beoremote_one_55555555_11111111_light_function_2', + 'event.beoremote_one_55555555_11111111_light_function_3', + 'event.beoremote_one_55555555_11111111_light_function_4', + 'event.beoremote_one_55555555_11111111_light_function_5', + 'event.beoremote_one_55555555_11111111_light_function_6', + 'event.beoremote_one_55555555_11111111_light_function_7', + 'event.beoremote_one_55555555_11111111_light_function_8', + 'event.beoremote_one_55555555_11111111_light_function_9', + 'event.beoremote_one_55555555_11111111_light_green', + 'event.beoremote_one_55555555_11111111_light_left', + 'event.beoremote_one_55555555_11111111_light_play', + 'event.beoremote_one_55555555_11111111_light_red', + 'event.beoremote_one_55555555_11111111_light_rewind', + 'event.beoremote_one_55555555_11111111_light_right', + 'event.beoremote_one_55555555_11111111_light_select', + 'event.beoremote_one_55555555_11111111_light_stop', + 'event.beoremote_one_55555555_11111111_light_up', + 'event.beoremote_one_55555555_11111111_light_wind', + 'event.beoremote_one_55555555_11111111_light_yellow', + 'event.living_room_balance_bluetooth', + 'event.living_room_balance_favorite_1', + 'event.living_room_balance_favorite_2', + 'event.living_room_balance_favorite_3', + 'event.living_room_balance_favorite_4', + 'event.living_room_balance_microphone', + 'event.living_room_balance_next', + 'event.living_room_balance_play_pause', + 'event.living_room_balance_previous', + 'event.living_room_balance_volume', + 'media_player.living_room_balance', 'sensor.beoremote_one_55555555_11111111_battery', - 'media_player.beosound_balance_11111111', ]) # --- # name: test_on_remote_control_paired list([ - 'event.beosound_balance_11111111_bluetooth', - 'event.beosound_balance_11111111_microphone', - 'event.beosound_balance_11111111_next', - 'event.beosound_balance_11111111_play_pause', - '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', - 'event.beoremote_one_55555555_11111111_light_blue', - 'event.beoremote_one_55555555_11111111_light_digit_0', - 'event.beoremote_one_55555555_11111111_light_digit_1', - 'event.beoremote_one_55555555_11111111_light_digit_2', - 'event.beoremote_one_55555555_11111111_light_digit_3', - 'event.beoremote_one_55555555_11111111_light_digit_4', - 'event.beoremote_one_55555555_11111111_light_digit_5', - 'event.beoremote_one_55555555_11111111_light_digit_6', - 'event.beoremote_one_55555555_11111111_light_digit_7', - 'event.beoremote_one_55555555_11111111_light_digit_8', - 'event.beoremote_one_55555555_11111111_light_digit_9', - 'event.beoremote_one_55555555_11111111_light_down', - 'event.beoremote_one_55555555_11111111_light_green', - 'event.beoremote_one_55555555_11111111_light_left', - 'event.beoremote_one_55555555_11111111_light_play', - 'event.beoremote_one_55555555_11111111_light_red', - 'event.beoremote_one_55555555_11111111_light_rewind', - 'event.beoremote_one_55555555_11111111_light_right', - 'event.beoremote_one_55555555_11111111_light_select', - 'event.beoremote_one_55555555_11111111_light_stop', - 'event.beoremote_one_55555555_11111111_light_up', - 'event.beoremote_one_55555555_11111111_light_wind', - 'event.beoremote_one_55555555_11111111_light_yellow', - 'event.beoremote_one_55555555_11111111_light_function_1', - 'event.beoremote_one_55555555_11111111_light_function_2', - 'event.beoremote_one_55555555_11111111_light_function_3', - 'event.beoremote_one_55555555_11111111_light_function_4', - 'event.beoremote_one_55555555_11111111_light_function_5', - 'event.beoremote_one_55555555_11111111_light_function_6', - 'event.beoremote_one_55555555_11111111_light_function_7', - 'event.beoremote_one_55555555_11111111_light_function_8', - 'event.beoremote_one_55555555_11111111_light_function_9', - 'event.beoremote_one_55555555_11111111_light_function_10', - 'event.beoremote_one_55555555_11111111_light_function_11', - 'event.beoremote_one_55555555_11111111_light_function_12', - 'event.beoremote_one_55555555_11111111_light_function_13', - 'event.beoremote_one_55555555_11111111_light_function_14', - 'event.beoremote_one_55555555_11111111_light_function_15', - 'event.beoremote_one_55555555_11111111_light_function_16', - 'event.beoremote_one_55555555_11111111_light_function_17', 'event.beoremote_one_55555555_11111111_control_blue', 'event.beoremote_one_55555555_11111111_control_digit_0', 'event.beoremote_one_55555555_11111111_control_digit_1', @@ -169,6 +119,33 @@ 'event.beoremote_one_55555555_11111111_control_digit_8', 'event.beoremote_one_55555555_11111111_control_digit_9', 'event.beoremote_one_55555555_11111111_control_down', + 'event.beoremote_one_55555555_11111111_control_function_1', + 'event.beoremote_one_55555555_11111111_control_function_10', + 'event.beoremote_one_55555555_11111111_control_function_11', + 'event.beoremote_one_55555555_11111111_control_function_12', + 'event.beoremote_one_55555555_11111111_control_function_13', + 'event.beoremote_one_55555555_11111111_control_function_14', + 'event.beoremote_one_55555555_11111111_control_function_15', + 'event.beoremote_one_55555555_11111111_control_function_16', + 'event.beoremote_one_55555555_11111111_control_function_17', + 'event.beoremote_one_55555555_11111111_control_function_18', + 'event.beoremote_one_55555555_11111111_control_function_19', + 'event.beoremote_one_55555555_11111111_control_function_2', + 'event.beoremote_one_55555555_11111111_control_function_20', + 'event.beoremote_one_55555555_11111111_control_function_21', + 'event.beoremote_one_55555555_11111111_control_function_22', + 'event.beoremote_one_55555555_11111111_control_function_23', + 'event.beoremote_one_55555555_11111111_control_function_24', + 'event.beoremote_one_55555555_11111111_control_function_25', + 'event.beoremote_one_55555555_11111111_control_function_26', + 'event.beoremote_one_55555555_11111111_control_function_27', + 'event.beoremote_one_55555555_11111111_control_function_3', + 'event.beoremote_one_55555555_11111111_control_function_4', + 'event.beoremote_one_55555555_11111111_control_function_5', + 'event.beoremote_one_55555555_11111111_control_function_6', + 'event.beoremote_one_55555555_11111111_control_function_7', + 'event.beoremote_one_55555555_11111111_control_function_8', + 'event.beoremote_one_55555555_11111111_control_function_9', 'event.beoremote_one_55555555_11111111_control_green', 'event.beoremote_one_55555555_11111111_control_left', 'event.beoremote_one_55555555_11111111_control_play', @@ -180,75 +157,46 @@ 'event.beoremote_one_55555555_11111111_control_up', 'event.beoremote_one_55555555_11111111_control_wind', 'event.beoremote_one_55555555_11111111_control_yellow', - 'event.beoremote_one_55555555_11111111_control_function_1', - 'event.beoremote_one_55555555_11111111_control_function_2', - 'event.beoremote_one_55555555_11111111_control_function_3', - 'event.beoremote_one_55555555_11111111_control_function_4', - 'event.beoremote_one_55555555_11111111_control_function_5', - 'event.beoremote_one_55555555_11111111_control_function_6', - 'event.beoremote_one_55555555_11111111_control_function_7', - 'event.beoremote_one_55555555_11111111_control_function_8', - 'event.beoremote_one_55555555_11111111_control_function_9', - 'event.beoremote_one_55555555_11111111_control_function_10', - 'event.beoremote_one_55555555_11111111_control_function_11', - 'event.beoremote_one_55555555_11111111_control_function_12', - 'event.beoremote_one_55555555_11111111_control_function_13', - 'event.beoremote_one_55555555_11111111_control_function_14', - 'event.beoremote_one_55555555_11111111_control_function_15', - 'event.beoremote_one_55555555_11111111_control_function_16', - 'event.beoremote_one_55555555_11111111_control_function_17', - 'event.beoremote_one_55555555_11111111_control_function_18', - 'event.beoremote_one_55555555_11111111_control_function_19', - 'event.beoremote_one_55555555_11111111_control_function_20', - 'event.beoremote_one_55555555_11111111_control_function_21', - 'event.beoremote_one_55555555_11111111_control_function_22', - 'event.beoremote_one_55555555_11111111_control_function_23', - 'event.beoremote_one_55555555_11111111_control_function_24', - 'event.beoremote_one_55555555_11111111_control_function_25', - 'event.beoremote_one_55555555_11111111_control_function_26', - 'event.beoremote_one_55555555_11111111_control_function_27', - 'sensor.beoremote_one_55555555_11111111_battery', - 'media_player.beosound_balance_11111111', - 'event.beoremote_one_66666666_11111111_light_blue', - 'event.beoremote_one_66666666_11111111_light_digit_0', - 'event.beoremote_one_66666666_11111111_light_digit_1', - 'event.beoremote_one_66666666_11111111_light_digit_2', - 'event.beoremote_one_66666666_11111111_light_digit_3', - 'event.beoremote_one_66666666_11111111_light_digit_4', - 'event.beoremote_one_66666666_11111111_light_digit_5', - 'event.beoremote_one_66666666_11111111_light_digit_6', - 'event.beoremote_one_66666666_11111111_light_digit_7', - 'event.beoremote_one_66666666_11111111_light_digit_8', - 'event.beoremote_one_66666666_11111111_light_digit_9', - 'event.beoremote_one_66666666_11111111_light_down', - 'event.beoremote_one_66666666_11111111_light_green', - 'event.beoremote_one_66666666_11111111_light_left', - 'event.beoremote_one_66666666_11111111_light_play', - 'event.beoremote_one_66666666_11111111_light_red', - 'event.beoremote_one_66666666_11111111_light_rewind', - 'event.beoremote_one_66666666_11111111_light_right', - 'event.beoremote_one_66666666_11111111_light_select', - 'event.beoremote_one_66666666_11111111_light_stop', - 'event.beoremote_one_66666666_11111111_light_up', - 'event.beoremote_one_66666666_11111111_light_wind', - 'event.beoremote_one_66666666_11111111_light_yellow', - 'event.beoremote_one_66666666_11111111_light_function_1', - 'event.beoremote_one_66666666_11111111_light_function_2', - 'event.beoremote_one_66666666_11111111_light_function_3', - 'event.beoremote_one_66666666_11111111_light_function_4', - 'event.beoremote_one_66666666_11111111_light_function_5', - 'event.beoremote_one_66666666_11111111_light_function_6', - 'event.beoremote_one_66666666_11111111_light_function_7', - 'event.beoremote_one_66666666_11111111_light_function_8', - 'event.beoremote_one_66666666_11111111_light_function_9', - 'event.beoremote_one_66666666_11111111_light_function_10', - 'event.beoremote_one_66666666_11111111_light_function_11', - 'event.beoremote_one_66666666_11111111_light_function_12', - 'event.beoremote_one_66666666_11111111_light_function_13', - 'event.beoremote_one_66666666_11111111_light_function_14', - 'event.beoremote_one_66666666_11111111_light_function_15', - 'event.beoremote_one_66666666_11111111_light_function_16', - 'event.beoremote_one_66666666_11111111_light_function_17', + 'event.beoremote_one_55555555_11111111_light_blue', + 'event.beoremote_one_55555555_11111111_light_digit_0', + 'event.beoremote_one_55555555_11111111_light_digit_1', + 'event.beoremote_one_55555555_11111111_light_digit_2', + 'event.beoremote_one_55555555_11111111_light_digit_3', + 'event.beoremote_one_55555555_11111111_light_digit_4', + 'event.beoremote_one_55555555_11111111_light_digit_5', + 'event.beoremote_one_55555555_11111111_light_digit_6', + 'event.beoremote_one_55555555_11111111_light_digit_7', + 'event.beoremote_one_55555555_11111111_light_digit_8', + 'event.beoremote_one_55555555_11111111_light_digit_9', + 'event.beoremote_one_55555555_11111111_light_down', + 'event.beoremote_one_55555555_11111111_light_function_1', + 'event.beoremote_one_55555555_11111111_light_function_10', + 'event.beoremote_one_55555555_11111111_light_function_11', + 'event.beoremote_one_55555555_11111111_light_function_12', + 'event.beoremote_one_55555555_11111111_light_function_13', + 'event.beoremote_one_55555555_11111111_light_function_14', + 'event.beoremote_one_55555555_11111111_light_function_15', + 'event.beoremote_one_55555555_11111111_light_function_16', + 'event.beoremote_one_55555555_11111111_light_function_17', + 'event.beoremote_one_55555555_11111111_light_function_2', + 'event.beoremote_one_55555555_11111111_light_function_3', + 'event.beoremote_one_55555555_11111111_light_function_4', + 'event.beoremote_one_55555555_11111111_light_function_5', + 'event.beoremote_one_55555555_11111111_light_function_6', + 'event.beoremote_one_55555555_11111111_light_function_7', + 'event.beoremote_one_55555555_11111111_light_function_8', + 'event.beoremote_one_55555555_11111111_light_function_9', + 'event.beoremote_one_55555555_11111111_light_green', + 'event.beoremote_one_55555555_11111111_light_left', + 'event.beoremote_one_55555555_11111111_light_play', + 'event.beoremote_one_55555555_11111111_light_red', + 'event.beoremote_one_55555555_11111111_light_rewind', + 'event.beoremote_one_55555555_11111111_light_right', + 'event.beoremote_one_55555555_11111111_light_select', + 'event.beoremote_one_55555555_11111111_light_stop', + 'event.beoremote_one_55555555_11111111_light_up', + 'event.beoremote_one_55555555_11111111_light_wind', + 'event.beoremote_one_55555555_11111111_light_yellow', 'event.beoremote_one_66666666_11111111_control_blue', 'event.beoremote_one_66666666_11111111_control_digit_0', 'event.beoremote_one_66666666_11111111_control_digit_1', @@ -261,6 +209,33 @@ 'event.beoremote_one_66666666_11111111_control_digit_8', 'event.beoremote_one_66666666_11111111_control_digit_9', 'event.beoremote_one_66666666_11111111_control_down', + 'event.beoremote_one_66666666_11111111_control_function_1', + 'event.beoremote_one_66666666_11111111_control_function_10', + 'event.beoremote_one_66666666_11111111_control_function_11', + 'event.beoremote_one_66666666_11111111_control_function_12', + 'event.beoremote_one_66666666_11111111_control_function_13', + 'event.beoremote_one_66666666_11111111_control_function_14', + 'event.beoremote_one_66666666_11111111_control_function_15', + 'event.beoremote_one_66666666_11111111_control_function_16', + 'event.beoremote_one_66666666_11111111_control_function_17', + 'event.beoremote_one_66666666_11111111_control_function_18', + 'event.beoremote_one_66666666_11111111_control_function_19', + 'event.beoremote_one_66666666_11111111_control_function_2', + 'event.beoremote_one_66666666_11111111_control_function_20', + 'event.beoremote_one_66666666_11111111_control_function_21', + 'event.beoremote_one_66666666_11111111_control_function_22', + 'event.beoremote_one_66666666_11111111_control_function_23', + 'event.beoremote_one_66666666_11111111_control_function_24', + 'event.beoremote_one_66666666_11111111_control_function_25', + 'event.beoremote_one_66666666_11111111_control_function_26', + 'event.beoremote_one_66666666_11111111_control_function_27', + 'event.beoremote_one_66666666_11111111_control_function_3', + 'event.beoremote_one_66666666_11111111_control_function_4', + 'event.beoremote_one_66666666_11111111_control_function_5', + 'event.beoremote_one_66666666_11111111_control_function_6', + 'event.beoremote_one_66666666_11111111_control_function_7', + 'event.beoremote_one_66666666_11111111_control_function_8', + 'event.beoremote_one_66666666_11111111_control_function_9', 'event.beoremote_one_66666666_11111111_control_green', 'event.beoremote_one_66666666_11111111_control_left', 'event.beoremote_one_66666666_11111111_control_play', @@ -272,48 +247,73 @@ 'event.beoremote_one_66666666_11111111_control_up', 'event.beoremote_one_66666666_11111111_control_wind', 'event.beoremote_one_66666666_11111111_control_yellow', - 'event.beoremote_one_66666666_11111111_control_function_1', - 'event.beoremote_one_66666666_11111111_control_function_2', - 'event.beoremote_one_66666666_11111111_control_function_3', - 'event.beoremote_one_66666666_11111111_control_function_4', - 'event.beoremote_one_66666666_11111111_control_function_5', - 'event.beoremote_one_66666666_11111111_control_function_6', - 'event.beoremote_one_66666666_11111111_control_function_7', - 'event.beoremote_one_66666666_11111111_control_function_8', - 'event.beoremote_one_66666666_11111111_control_function_9', - 'event.beoremote_one_66666666_11111111_control_function_10', - 'event.beoremote_one_66666666_11111111_control_function_11', - 'event.beoremote_one_66666666_11111111_control_function_12', - 'event.beoremote_one_66666666_11111111_control_function_13', - 'event.beoremote_one_66666666_11111111_control_function_14', - 'event.beoremote_one_66666666_11111111_control_function_15', - 'event.beoremote_one_66666666_11111111_control_function_16', - 'event.beoremote_one_66666666_11111111_control_function_17', - 'event.beoremote_one_66666666_11111111_control_function_18', - 'event.beoremote_one_66666666_11111111_control_function_19', - 'event.beoremote_one_66666666_11111111_control_function_20', - 'event.beoremote_one_66666666_11111111_control_function_21', - 'event.beoremote_one_66666666_11111111_control_function_22', - 'event.beoremote_one_66666666_11111111_control_function_23', - 'event.beoremote_one_66666666_11111111_control_function_24', - 'event.beoremote_one_66666666_11111111_control_function_25', - 'event.beoremote_one_66666666_11111111_control_function_26', - 'event.beoremote_one_66666666_11111111_control_function_27', + 'event.beoremote_one_66666666_11111111_light_blue', + 'event.beoremote_one_66666666_11111111_light_digit_0', + 'event.beoremote_one_66666666_11111111_light_digit_1', + 'event.beoremote_one_66666666_11111111_light_digit_2', + 'event.beoremote_one_66666666_11111111_light_digit_3', + 'event.beoremote_one_66666666_11111111_light_digit_4', + 'event.beoremote_one_66666666_11111111_light_digit_5', + 'event.beoremote_one_66666666_11111111_light_digit_6', + 'event.beoremote_one_66666666_11111111_light_digit_7', + 'event.beoremote_one_66666666_11111111_light_digit_8', + 'event.beoremote_one_66666666_11111111_light_digit_9', + 'event.beoremote_one_66666666_11111111_light_down', + 'event.beoremote_one_66666666_11111111_light_function_1', + 'event.beoremote_one_66666666_11111111_light_function_10', + 'event.beoremote_one_66666666_11111111_light_function_11', + 'event.beoremote_one_66666666_11111111_light_function_12', + 'event.beoremote_one_66666666_11111111_light_function_13', + 'event.beoremote_one_66666666_11111111_light_function_14', + 'event.beoremote_one_66666666_11111111_light_function_15', + 'event.beoremote_one_66666666_11111111_light_function_16', + 'event.beoremote_one_66666666_11111111_light_function_17', + 'event.beoremote_one_66666666_11111111_light_function_2', + 'event.beoremote_one_66666666_11111111_light_function_3', + 'event.beoremote_one_66666666_11111111_light_function_4', + 'event.beoremote_one_66666666_11111111_light_function_5', + 'event.beoremote_one_66666666_11111111_light_function_6', + 'event.beoremote_one_66666666_11111111_light_function_7', + 'event.beoremote_one_66666666_11111111_light_function_8', + 'event.beoremote_one_66666666_11111111_light_function_9', + 'event.beoremote_one_66666666_11111111_light_green', + 'event.beoremote_one_66666666_11111111_light_left', + 'event.beoremote_one_66666666_11111111_light_play', + 'event.beoremote_one_66666666_11111111_light_red', + 'event.beoremote_one_66666666_11111111_light_rewind', + 'event.beoremote_one_66666666_11111111_light_right', + 'event.beoremote_one_66666666_11111111_light_select', + 'event.beoremote_one_66666666_11111111_light_stop', + 'event.beoremote_one_66666666_11111111_light_up', + 'event.beoremote_one_66666666_11111111_light_wind', + 'event.beoremote_one_66666666_11111111_light_yellow', + 'event.living_room_balance_bluetooth', + 'event.living_room_balance_favorite_1', + 'event.living_room_balance_favorite_2', + 'event.living_room_balance_favorite_3', + 'event.living_room_balance_favorite_4', + 'event.living_room_balance_microphone', + 'event.living_room_balance_next', + 'event.living_room_balance_play_pause', + 'event.living_room_balance_previous', + 'event.living_room_balance_volume', + 'media_player.living_room_balance', + 'sensor.beoremote_one_55555555_11111111_battery', 'sensor.beoremote_one_66666666_11111111_battery', ]) # --- # name: test_on_remote_control_unpaired list([ - 'event.beosound_balance_11111111_bluetooth', - 'event.beosound_balance_11111111_microphone', - 'event.beosound_balance_11111111_next', - 'event.beosound_balance_11111111_play_pause', - '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', + 'event.living_room_balance_bluetooth', + 'event.living_room_balance_favorite_1', + 'event.living_room_balance_favorite_2', + 'event.living_room_balance_favorite_3', + 'event.living_room_balance_favorite_4', + 'event.living_room_balance_microphone', + 'event.living_room_balance_next', + 'event.living_room_balance_play_pause', + 'event.living_room_balance_previous', + 'event.living_room_balance_volume', + 'media_player.living_room_balance', ]) # --- diff --git a/tests/components/bang_olufsen/test_init.py b/tests/components/bang_olufsen/test_init.py index 9c9412a5627..ac276188956 100644 --- a/tests/components/bang_olufsen/test_init.py +++ b/tests/components/bang_olufsen/test_init.py @@ -35,7 +35,7 @@ async def test_setup_entry( identifiers={(DOMAIN, TEST_SERIAL_NUMBER)} ) assert device is not None - # Is usually TEST_NAME, but is updated to the device's friendly name by _update_name_and_beolink + # Device name is set from the config entry title (friendly name) assert device.name == TEST_FRIENDLY_NAME assert device.model == TEST_MODEL_BALANCE diff --git a/tests/components/bang_olufsen/test_websocket.py b/tests/components/bang_olufsen/test_websocket.py index fb53f9eef94..94d6d54a9e3 100644 --- a/tests/components/bang_olufsen/test_websocket.py +++ b/tests/components/bang_olufsen/test_websocket.py @@ -25,7 +25,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_registry import EntityRegistry from .const import ( - TEST_NAME, + TEST_FRIENDLY_NAME, TEST_REMOTE_SERIAL, TEST_REMOTE_SERIAL_PAIRED, TEST_SERIAL_NUMBER, @@ -62,7 +62,7 @@ async def test_connection( await hass.async_block_till_done() mock_connection_callback.assert_called_once_with(True) - assert f"Connected to the {TEST_NAME} notification channel" in caplog.text + assert f"Connected to the {TEST_FRIENDLY_NAME} notification channel" in caplog.text async def test_connection_lost( @@ -87,7 +87,7 @@ async def test_connection_lost( await hass.async_block_till_done() mock_connection_lost_callback.assert_called_once_with(False) - assert f"Lost connection to the {TEST_NAME}" in caplog.text + assert f"Lost connection to the {TEST_FRIENDLY_NAME}" in caplog.text async def test_on_software_update_state( @@ -130,7 +130,7 @@ async def test_on_remote_control_already_added( await hass.config_entries.async_setup(mock_config_entry.entry_id) # Check device and API call count - assert mock_mozart_client.get_bluetooth_remotes.call_count == 3 + assert mock_mozart_client.get_bluetooth_remotes.call_count == 4 assert device_registry.async_get_device({(DOMAIN, TEST_REMOTE_SERIAL_PAIRED)}) # Check number of entities (remote and button events and media_player) @@ -149,16 +149,16 @@ async def test_on_remote_control_already_added( await hass.async_block_till_done() # Check device and API call count (triggered once by the WebSocket notification) - assert mock_mozart_client.get_bluetooth_remotes.call_count == 4 + assert mock_mozart_client.get_bluetooth_remotes.call_count == 5 assert device_registry.async_get_device({(DOMAIN, TEST_REMOTE_SERIAL_PAIRED)}) # Check number of entities (remote and button events and media_player) entity_ids_available = list(entity_registry.entities.keys()) - assert list(entity_registry.entities.keys()) == unordered( + assert entity_ids_available == unordered( [*get_balance_entity_ids(), *get_remote_entity_ids()] ) - assert entity_ids_available == snapshot + assert sorted(entity_ids_available) == snapshot async def test_on_remote_control_paired( @@ -176,7 +176,7 @@ async def test_on_remote_control_paired( await hass.config_entries.async_setup(mock_config_entry.entry_id) # Check device and API call count - assert mock_mozart_client.get_bluetooth_remotes.call_count == 3 + assert mock_mozart_client.get_bluetooth_remotes.call_count == 4 assert device_registry.async_get_device({(DOMAIN, TEST_REMOTE_SERIAL_PAIRED)}) # Check number of entities (button and remote events and media_player) @@ -217,7 +217,7 @@ async def test_on_remote_control_paired( await hass.async_block_till_done() # Check device and API call count - assert mock_mozart_client.get_bluetooth_remotes.call_count == 8 + assert mock_mozart_client.get_bluetooth_remotes.call_count == 10 assert device_registry.async_get_device({(DOMAIN, TEST_REMOTE_SERIAL_PAIRED)}) assert device_registry.async_get_device( {(DOMAIN, f"66666666_{TEST_SERIAL_NUMBER}")} @@ -239,7 +239,7 @@ async def test_on_remote_control_paired( *get_remote_entity_ids("66666666"), ] ) - assert entity_ids_available == snapshot + assert sorted(entity_ids_available) == snapshot async def test_on_remote_control_unpaired( @@ -257,7 +257,7 @@ async def test_on_remote_control_unpaired( await hass.config_entries.async_setup(mock_config_entry.entry_id) # Check device and API call count - assert mock_mozart_client.get_bluetooth_remotes.call_count == 3 + assert mock_mozart_client.get_bluetooth_remotes.call_count == 4 assert device_registry.async_get_device({(DOMAIN, TEST_REMOTE_SERIAL_PAIRED)}) # Check number of entities (button and remote events and media_player) @@ -280,7 +280,7 @@ async def test_on_remote_control_unpaired( await hass.async_block_till_done() # Check device and API call count - assert mock_mozart_client.get_bluetooth_remotes.call_count == 6 + assert mock_mozart_client.get_bluetooth_remotes.call_count == 8 assert ( device_registry.async_get_device({(DOMAIN, TEST_REMOTE_SERIAL_PAIRED)}) is None ) @@ -295,7 +295,7 @@ async def test_on_remote_control_unpaired( entity_ids_available = list(entity_registry.entities.keys()) assert entity_ids_available == unordered(get_balance_entity_ids()) - assert entity_ids_available == snapshot + assert sorted(entity_ids_available) == snapshot # async def test_setup_entry_remote_unpaired( diff --git a/tests/components/bang_olufsen/util.py b/tests/components/bang_olufsen/util.py index caf1fe77352..e15c0e24484 100644 --- a/tests/components/bang_olufsen/util.py +++ b/tests/components/bang_olufsen/util.py @@ -22,7 +22,7 @@ from .const import ( ) -def _get_button_entity_ids(id_prefix: str = "beosound_balance_11111111") -> list[str]: +def _get_button_entity_ids(id_prefix: str = "living_room_balance") -> list[str]: """Return a list of button entity_ids that Mozart devices provide. Beoconnect Core, Beosound A5, Beosound A9 and Beosound Premiere do not have (all of the) physical buttons and need filtering. @@ -42,10 +42,10 @@ def get_premiere_entity_ids() -> list[str]: """Return a list of entity_ids that a Beosound Premiere provides.""" buttons = [ TEST_MEDIA_PLAYER_ENTITY_ID_3, - *_get_button_entity_ids("beosound_premiere_33333333"), + *_get_button_entity_ids("bedroom_premiere"), ] - buttons.remove("event.beosound_premiere_33333333_bluetooth") - buttons.remove("event.beosound_premiere_33333333_microphone") + buttons.remove("event.bedroom_premiere_bluetooth") + buttons.remove("event.bedroom_premiere_microphone") return buttons @@ -55,9 +55,9 @@ def get_a5_entity_ids() -> list[str]: TEST_MEDIA_PLAYER_ENTITY_ID_4, TEST_BATTERY_SENSOR_ENTITY_ID, TEST_BATTERY_CHARGING_BINARY_SENSOR_ENTITY_ID, - *_get_button_entity_ids("beosound_a5_44444444"), + *_get_button_entity_ids("lounge_room_a5"), ] - buttons.remove("event.beosound_a5_44444444_microphone") + buttons.remove("event.lounge_room_a5_microphone") return buttons