diff --git a/custom_components/bang_olufsen/const.py b/custom_components/bang_olufsen/const.py index c506d25..fed17d6 100644 --- a/custom_components/bang_olufsen/const.py +++ b/custom_components/bang_olufsen/const.py @@ -420,3 +420,6 @@ class WebsocketNotification(StrEnum): STR_PARAMETERS, NONE_PARAMETERS, ) + +# Prefix for Beolink Converter NL/ML in async_beolink_join custom service +BL_CONVERTER_PREFIX = "bc_nlml_" diff --git a/custom_components/bang_olufsen/manifest.json b/custom_components/bang_olufsen/manifest.json index f7e45d6..d7e1d5b 100644 --- a/custom_components/bang_olufsen/manifest.json +++ b/custom_components/bang_olufsen/manifest.json @@ -9,6 +9,6 @@ "iot_class": "local_push", "issue_tracker": "https://github.com/bang-olufsen/bang_olufsen-hacs/issues", "requirements": ["mozart-api==4.1.1.116.3"], - "version": "3.1.0", + "version": "3.1.1", "zeroconf": ["_bangolufsen._tcp.local."] } diff --git a/custom_components/bang_olufsen/media_player.py b/custom_components/bang_olufsen/media_player.py index 398b25a..5befd89 100644 --- a/custom_components/bang_olufsen/media_player.py +++ b/custom_components/bang_olufsen/media_player.py @@ -89,6 +89,7 @@ BEOLINK_LISTENER_COMMAND, BEOLINK_RELATIVE_VOLUME, BEOLINK_VOLUME, + BL_CONVERTER_PREFIX, CONF_BEOLINK_JID, CONNECTION_STATUS, DOMAIN, @@ -1165,6 +1166,11 @@ async def async_beolink_join( response = await self._client.join_beolink_peer(jid=beolink_jid) # Join a peer and select specific source elif beolink_jid and source_id: + # Home Assistant does not support the "raw" Beolink Converter NL/ML source ids in strings.json + # So they have the be transformed to be compatible and now have to be capatilized in order to work + if BL_CONVERTER_PREFIX in source_id: + source_id = source_id.removeprefix(BL_CONVERTER_PREFIX).upper() + response = await self._client.join_beolink_peer( jid=beolink_jid, source=source_id ) diff --git a/custom_components/bang_olufsen/services.yaml b/custom_components/bang_olufsen/services.yaml index 7e84eda..af0b3e7 100644 --- a/custom_components/bang_olufsen/services.yaml +++ b/custom_components/bang_olufsen/services.yaml @@ -52,7 +52,19 @@ beolink_join: required: false example: tidal selector: - text: + select: + translation_key: "source_ids" + options: + - deezer + - spotify + - tidal + - beoradio + - bc_nlml_radio + - bc_nlml_tp1 + - bc_nlml_tp2 + - bc_nlml_cd + - bc_nlml_aux_a + - bc_nlml_ph beolink_leader_command: target: diff --git a/custom_components/bang_olufsen/strings.json b/custom_components/bang_olufsen/strings.json index 1170c0f..3a3dae6 100644 --- a/custom_components/bang_olufsen/strings.json +++ b/custom_components/bang_olufsen/strings.json @@ -36,6 +36,22 @@ } } }, + "selector": { + "source_ids": { + "options": { + "deezer": "Deezer", + "spotify": "Spotify", + "tidal": "Mozart Tidal", + "beoradio": "ASE Beoradio", + "bc_nlml_radio": "Beolink Converter NL/ML RADIO", + "bc_nlml_tp1": "Beolink Converter NL/ML TP1", + "bc_nlml_tp2": "Beolink Converter NL/ML TP2", + "bc_nlml_cd": "Beolink Converter NL/ML CD", + "bc_nlml_aux_a": "Beolink Converter NL/ML AUX_A", + "bc_nlml_ph": "Beolink Converter NL/ML PH" + } + } + }, "services": { "beolink_allstandby": { "name": "Beolink all standby", @@ -70,8 +86,8 @@ "description": "Manually specify Beolink JID to join." }, "source_id": { - "name": "Source ID", - "description": "Specify which source to join, behavior varies between platforms. Compatible Mozart source IDs: 'deezer', 'spotify', 'tidal'. Compatible ASE source IDs: 'beoradio', 'deezer', 'spotify', using Beolink Converter NL/ML: 'RADIO', 'TP1', 'TP2', 'CD', 'AUX_A', 'PH'. A defined Beolink JID is required." + "name": "Source", + "description": "Specify which source to join, behavior varies between platforms. Source names prefaced by a platform name can only be used when connecting to that platform. A defined Beolink JID is required" } }, "sections": { diff --git a/custom_components/bang_olufsen/translations/en.json b/custom_components/bang_olufsen/translations/en.json index eea39d0..7d99a4f 100644 --- a/custom_components/bang_olufsen/translations/en.json +++ b/custom_components/bang_olufsen/translations/en.json @@ -1239,6 +1239,22 @@ "message": "An error occurred while attempting to play {media_type}: {error_message}." } }, + "selector": { + "source_ids": { + "options": { + "bc_nlml_aux_a": "Beolink Converter NL/ML AUX_A", + "bc_nlml_cd": "Beolink Converter NL/ML CD", + "bc_nlml_ph": "Beolink Converter NL/ML PH", + "bc_nlml_radio": "Beolink Converter NL/ML RADIO", + "bc_nlml_tp1": "Beolink Converter NL/ML TP1", + "bc_nlml_tp2": "Beolink Converter NL/ML TP2", + "beoradio": "ASE Beoradio", + "deezer": "Deezer", + "spotify": "Spotify", + "tidal": "Mozart Tidal" + } + } + }, "services": { "beolink_allstandby": { "description": "Set all Connected Beolink devices to standby.", @@ -1272,8 +1288,8 @@ "name": "Beolink JID" }, "source_id": { - "description": "Specify which source to join, behavior varies between platforms. Compatible Mozart source IDs: 'deezer', 'spotify', 'tidal'. Compatible ASE source IDs: 'beoradio', 'deezer', 'spotify', using Beolink Converter NL/ML: 'RADIO', 'TP1', 'TP2', 'CD', 'AUX_A', 'PH'. A defined Beolink JID is required.", - "name": "Source ID" + "description": "Specify which source to join, behavior varies between platforms. Source names prefaced by a platform name can only be used when connecting to that platform. A defined Beolink JID is required", + "name": "Source" } }, "name": "Beolink join",