Giter VIP home page Giter VIP logo

beoplay's Introduction

BeoPlay: Bang & Olufsen Speakers and TVs in Home Assistant

This component enables integration of B&O Audio/Video equipment with Home Assistant: TVs, Speakers and units like the BeoLink Converter ML/NL. BeoPlay API is the 2nd generation B&O API, after Masterlink Gateway and before Mozart. It is supported by devices built from 2015 onwards, including several BeoVision TV, newer BeoLab speakers and the NL/ML Converter.

It allows you to:

  • Control speakers and TVs just like a remote control (turn on, off, volume, select source, playback, media)
  • Execute Home Assistant automations based on:
    • Status changes (Source, what's playing, volume...)
    • BeoOne "Light/Control" and "Function" keypresses on select systems. YMMV, not all devices support this.

Installation via HACS

The preferred type of installation is via HACS. This way, you'll get updates when there are new versions.

Manual Installation

You can also install it manually in custom_components. Just copy the full contents of the custom_components/beoplay folder into the config/custom_components/beoplay folder in your Home Assistant system (You'll need to create the beoplay folder). If you are installing over a previous version, delete all the contents and start fresh. Then, restart Home Assistant.

Configuration

B&O devices should automaticlly show up in your discovery panel (Configuration->Integrations). Just press "Configure".

If they don't show up, go to Configuration -> Integrations -> Add Integration (bottom right corner), search for BeoPlay and insert the host name or IP. It should work with both TVs, Speakers and other devices like NL/ML converters.

Once configured, it should show up as something like this:

beoplay_mini_media_player.png

Configuring the Next/Prev button actions

Older B&O devices use "Step Up" and "Step Down" to change CD tracks and radio channels. This includes the Beolink Converter NL/ML and BeoVision Avant TVs. Newer devices use "Forward" and "Backward" commands, including smart speakers and audio devices.

You can select which one to use during the configuration flow. The default is Forward/Backward.

Power Saving modes caveats (WOL, Quickstart)

If your TV or speaker is in power saving mode (Wake on Lan off, Quickstart off), the BeoPlay integration won't be able to connect with the device. The first time you set it up, the device needs to be powered on. Afterwards, if it cannot connect with the device it will retry, and reconnect once the device comes back online.

Using the integration

The beoplay integration creates a media_player and remote entities for each device. The media_player can be used as any other on Home Assistant, and responds to most common commands.

The remote can be used to send specific key-presses to the device, just as if you were to press the equivalent key on your Beo remote. The following keypresses are supported:

Cursor/Select, Cursor/Up, Cursor/Down, Cursor/Left, Cursor/Right, Cursor/Exit, Cursor/Back, Cursor/PageUp, Cursor/PageDown, Cursor/Clear, Stream/Play, Stream/Stop, Stream/Pause, Stream/Wind, Stream/Rewind, Stream/Forward, Stream/Backward, List/StepUp, List/StepDown, List/PreviousElement, List/Shuffle, List/Repeat, Menu/Root, Menu/Option, Menu/Setup, Menu/Contents, Menu/Favorites, Menu/ElectronicProgramGuide, Menu/VideoOnDemand, Menu/Text, Menu/HbbTV,Menu/HomeControl, Device/Information, Device/Eject, Device/TogglePower, Device/Languages, Device/Subtitles, Device/OneWayJoin, Device/Mots, Record/Record, Generic/Blue, Generic/Red, Generic/Green, Generic/Yellow as well as the digits 0-9

See below for an example:

image

Services

The integration is a Media Player so responds to all Media Player commands.

It also exposes 3 additional services:

beoplay.beoplay_join_experience:

This command joins the speaker to the current play experience, just like pressing the 'Join' button on the remote. A source must be playing already for Join to work.

beoplay.beoplay_leave_experience:

This command makes the speaker quit the current experience, and turn off.

beoplay.beoplay_add_media_to_queue:

This command is experimental. It allows to add a URL of a DLNA asset on your network to the speaker and play it. Let me know if it works for you!

These are called through service calls, e.g.:

image

Events

Beoplay also generates events (beoplay_notification) where you can track status changes of the speaker. You can use this to enable all kinds of cool experiences. For example, you can catch when the user activates a source like A.MEM to control automations on the Home Assistant. For example:

  • Start a streaming player that is connected with your B&O equipment.
  • Track when the TV turns on, to select a certain source, and adjust the lights in the room to create a better ambiance.
  • Track when the user presses a Light/Control or Function command on the BeoPlay remote (only works with certain devices, e.g., M3 speakers, but not with others, e.g. BeoVision Avant).

image

Troubleshoot

  • If you can't initialize a TV, try setting 'wake on LAN' or 'wake on WIFI' to on, depending on how your TV is connected to the network.
  • Also, Home Assistant and the TV/Speaker must be on the same local network, i.e. they need to be able to communicate to one another.

beoplay's People

Contributors

giachello avatar igo-r avatar mbolo01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

beoplay's Issues

Cant connect to Beolab 28

2023-08-09 09:57:56.353 ERROR (Thread-24) [pychromecast.socket_client] [BeoLab 28-35781510(10.200.20.105):8009] Error reading from socket.
2023-08-09 09:57:56.354 WARNING (Thread-24) [pychromecast.socket_client] [BeoLab 28-35781510(10.200.20.105):8009] Error communicating with socket, resetting connection
2023-08-09 09:57:56.359 ERROR (Thread-24) [pychromecast.socket_client] [BeoLab 28-35781510(10.200.20.105):8009] Failed to connect to service ServiceInfo(type='host', data=('10.200.20.105', 8009)), retrying in 5.0s

Adding host manually gives "Failed to connect" instantly

Theater and/or 28 support

Hi, I've installed the plugin in HA.

However, it doesn't pick up neither Theater nor 28s, and won't connect directly if specifying the IP. Before further debugging, I wanted to ask if these are supported, or if explicit Mozart support is required.

Thanks!

HomeAssistant ERROR message

Hi,

Please note the following error message :

2021-05-24 13:10:55 ERROR (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'beoplay'. As of 
Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'beoplay' 

Kind regards.

Python warning message

Hi there. Please note the following message:

_/config/custom_components/beoplay/media_player.py:266: DeprecationWarning: The loop argument is deprecated since Python 3.8, and schedul
ed for removal in Python 3.10.
await asyncio.sleep(CHECK_TIMEOUT, loop=self.hass.loop)

Kind regards.

events stops working

Hi.
after upgrade to v2022.10.2, the event listerner suddenly stops working.
In log i get this:
This error originated from a custom integration.

Logger: custom_components.beoplay.media_player
Source: helpers/entity.py:529
Integration: Bang & Olufsen BeoPlay Devices
First occurred: 18:58:18 (2 occurrences)
Last logged: 19:06:34

Unexpected error in
Traceback (most recent call last):
File "/config/custom_components/beoplay/media_player.py", line 275, in _start_poll_command
await self.async_update_status()
File "/config/custom_components/beoplay/media_player.py", line 336, in async_update_status
self.async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 678, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 529, in async_write_ha_state
raise NoEntitySpecifiedError(
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity

Source selection drop box does not retrieve the product user configured sources

Source selection drop box does not retrieve the product's user configured sources, but all possible sources, even the unused ones or the one that you cannot action from the product itself such as Airplay or Chromecast.
I worked with TLK (https://github.com/tlk/beoplay-macos-remote-gui) to fix this behavior as TLK was initially inspired by legacy beoplay code to write his own (clever OSX Beoplay control tool) so the code was also retrieving all these useless sources.
The sources drop box I'm referring to:
Capture d’écran 2021-01-21 à 15 02 06

Beovision 11 reporting NaN volume

Just installed the latest version of this component. It works, with the exception of volume control. The slider is at the bottom 0%. shows NaN and is unable to move. Anything I can do to sort this out?

State updates break

Hi there, I've noticed that the device states aren't getting updated in the media player. It works once after reloading the integration but then never updates again. Control buttons still work though (source change, next track etc, but no state update from the interaction). Reloading the integration updates the player, but then appears to freeze again. Not sure when this problem materialised, it must be within the past couple of months possibly after a core update as it did always used to work well.

HACS is showing version 2022.6 as installed.

Many thanks!

There is an error in the log, I hope this helps:

Logger: custom_components.beoplay.media_player
Source: helpers/entity.py:529
Integration: BeoPlay for Bang & Olufsen
First occurred: 16:52:36 (1 occurrences)
Last logged: 16:52:36

Unexpected error in
Traceback (most recent call last):
File "/config/custom_components/beoplay/media_player.py", line 273, in _start_poll_command
await self.async_update_status()
File "/config/custom_components/beoplay/media_player.py", line 334, in async_update_status
self.async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 678, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 529, in async_write_ha_state
raise NoEntitySpecifiedError(
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity

discovery_info.get('name') warning

Get this warning in the log on 2022.5
Detected integration that accessed discovery_info.get('name') instead of discovery_info.name; this will fail in version 2022.6. Please report issue to the custom component author for beoplay using this method at custom_components/beoplay/config_flow.py, line 100: if not discovery_info.get("name") or not discovery_info["name"].startswith(

Light and Control functions

Hi Giachello

It would be nice if this integration could handle the Light and Control/FuncXX_KeyPress, from the Beoremote One.

So it's possible to name the different functions on the remote.

Thank you for this integration in general - it works flawlessly :)

not unique ID's

hi.
Getting this in the HA logs.:
Logger: homeassistant.components.media_player
Source: helpers/entity_platform.py:652
Integration: Media player (documentation, issues)
First occurred: August 22, 2022 at 06:21:13 (1 occurrences)
Last logged: August 22, 2022 at 06:21:13

Platform beoplay does not generate unique IDs. ID already exists - ignoring media_player.beoplay

WARNING Message

Hi there,

Happy new year!

Following HA update, I received the following message:

2022-01-22 12:22:45 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that accessed discovery_info.get('name') instead of discovery_info.name; this will fail in version 2022.6. Please report issue to the custom component author for beoplay using this method at custom_components/beoplay/config_flow.py, line 100: if not discovery_info.get("name") or not discovery_info["name"].startswith(

Kind regards,
Jérôme

`async_add_job`, which is deprecated and will be removed in Home Assistant 2025.4

Hi there - In case you have not seen this message from HA Console:

2024-04-06 17:16:01.310 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'beoplay' calls async_add_job, which is deprecated and will be removed in Home Assistant 2025.4; Please review https://developers.home-assistant.io/blog/2024/03/13/deprecate_add_run_job for replacement options at custom_components/beoplay/media_player.py, line 278: self._polling_task = self._hass.async_add_job(self._start_poll_command()), please create a bug report at https://github.com/giachello/beoplay/issues

KR,
Jérôme

Previous/Next

Hi,

thanks for this integration which keeps the ASE products alive. Unfortunately the Previous/Next buttons are not responding, no matter which source -except MA when casting-. Is there any solution I am missing?

Best regards

Daniel

Help: Information not refreshed

Hi there,

I need help on the following:

I recently noticed that my B&O HA media_player entities were no longer refreshing the media image of the currently playing track when using Airplay against a B&O product.

I first tried to isolate any changes in several components that could have triggered this issue, O/S change, music player application change, B&O device software change, but I could not find any obvious answer. Issue occurs with any Airplay source (OSX, IOS), including very old ones, it occurs also with different music players and against B&O devices that I kept out from software updates.

The only changes I could think of are HA updates.

I had a deeper look at a given B&O HA entity attributes while playing different tracks from different albums, so with different media image, and I could find that "Entity picture" was not changing while others such as "Volume Level", "Media title", "Media artist", "Media track" were changing properly and accordingly.

The "Entity picture" sticks with the very first value it collected when entity was first activated e.g. first play after entity has been turned off or after a HA restart.

The Entity picture value is in the form of "/api/media_player_proxy/media_player.bs_core?token=fa001c96da44c5d55f68214ddf4cd51111a3316e8ae0581b3d9d94b227611c7f&cache=34af6d1562400fa7" and this token value stays the same until entity off/on

My media_player.py "media_image_url" property is set as follow (note: I have two static images depending on the source, otherwise it is dynamic).

@Property
def media_image_url(self):
"""Image url of current playing media."""
if self._source == "Optical":
return "http://192.168.1.52:8123/local/TVFrame.jpg"
elif self._source == "Line-In":
return "http://192.168.1.52:8123/local/BSMoment.jpeg"
return self._media_url if self._media_url else None

Thanks in advance for any help you can provide.
Kind regards.
Jérôme

Media Player entity is Missing after Update to v2024

after updating from v2023.4.2 to v2024.3.2 the Media Player entity is missing while power on/off is still available.
Restore to v2023.4.2 solves the issue

testet with Beovision Avant 55 Type 8641

Home Assistant Installation
Core 2024.3.1 and 2024.3.0 testet
Supervisor 2024.03.0
Operating System 12.1

Generic x86-64

Unable to power on Beovision 11

Latest version of component and Home Assistant. I can power of the TV but it does not power on again. Anything I can change to make this work?

Add device name in Notification Events

Currently HA Events generated from Notifications on the device don't contain the name of the device, so it's impossible to distinguish which device generated the notification. Need to add it.

Beolink Converter ML/NL behaviour

Dear Giovanni
I'm using both of your integrations, beoplay as well as mlgw with home-assistant. Thank you very much for all your time you spent in developing this, really appreciated.
I was setting both up and playing around with my setup at home. Most of the things are working out of the box, or if I faced issues like with the virtual button to send to the blgw, there is already a fix which is working.
I'm using beoplay integration to control my Beo11-55, as well as my Converter ML/NL, which I used to 'wireless' interconnect my Beo10 in another room. So I setup the NL/ML Converter as ML Audio-Master. Discovery works, and the Converter with it's sources will be recognised. I can choose a source of Radio and the Beo10 turns on and plays Radio. The only thing, the status in the mini-player will not be updated. When I check the ML/NL Converter, the state is: nowPlaying= & nowPlayingDetails=type: Legacy; track number: 9 & online=Yes & sourceName=RADIO & sourceUniqueId=RADIO:[email protected] & state=Play & volume=50

So if I change now the source from RADIO to f.e. CD with me Beo-Remote, the state of the mini-media player gets updated automatically.

As long as this state is not updated, I'm not able to turn off the Beo10 with the mini-player app. As soon as the state is updated, I can turn off with app. Do you perhaps have an idea?

I'm not sure, if my explanation is clear enough. If so, please apologise.

Have a great start into the new day, and stay healthy.
Best
Roli

allstandby error

Hi,

After updating HA to latest release I get this error:

IMG_3645

Any Ideas?

media_player.py Airplay exclusion for album cover

Hi,
"media_player.py" has Airplay exclusion back where I think we already discussed a while ago that this exclusion is not necessary as Airplay source is able to expose the album art.

@Property
def media_image_url(self):
"""Image url of current playing media."""
_if self.source == "AirPlay":
return None

return self._media_url if self._media_url else None

Kind regards,
Jérôme

Paused issue

Something is causing it (in this case a M3) to set the state ‘Paused’ approximately every 5 min. The speaker has not played today at all. When I monitor the BeoNotify stream, nothing is registered at the same time, so it must be the HA component itself.
image

How to change IP addresses of the speaker in beoplay configuration?

Hi Giovanni,
my internet provider sent me a new router.

How can I change the IP address of a Beoplay speakers in the Beoplay integration?

I tried to change the IP addresses in the configuration.yaml file but the Beoplay integration is still searching for the devices by the old ip addresses.

media_player:

  • platform: beoplay
    host: 192.168.178.71
    name: M5 Esszimmer
  • platform: beoplay
    host: 192.168.178.72
    name: M5 Wohnzimmer
  • platform: beoplay
    host: 192.168.178.73
    name: M3 Bad

Kind regards,
Stefan

Errors after updating to 2024.4.1

2024-04-07 13:41:29.145 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up beoplay platform for media_player
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/beoplay/media_player.py", line 200, in async_setup_entry
type = config_entry.data[CONF_TYPE]

KeyError: 'type'

Next and Previous not working

Hi Giovanni,

Thank you for all the time and effort you put into this great integration! I've noticed that the next & previous controls are not working for the Beoplay A9 mk4 and M5. However they work for the BV11. This is using the mini media player. The service call to media_next_track doesn't do anything either. Play/stop/power/join however do work.

Many thanks!

Rob.

The integration never shows up

Hej,

I just bought the b&o sounds staging and I’d like to have it to work with an integration.

Fron your read me. I did copy the files into a new folder /bioplay , restart, reboot, cleared the cache and always without success

I’m running the latest hassio on a raspberry pi4 on a ssd drive.

If you have time… :-) to look at it

/Mvh Marc

Problem with state since update

Since the update to 2022.3 the integration seems not to update the status of the devices. Everytime the device is playing from a source the state is ‚unknown‘. Actually there isn‘t any possibility to read out the source of the device.
Are there any solutions for that problem?

Can't add beoplay media player to HA workspace

Bonjour!
I'm currently using the legacy beoplay HA integration and I tried the one you published without success.

What I have done so far:

  • Legacy ha-beoplay directory is present in custom_components
  • Moved the former beoplay directory out of custom_components
  • Commented out previous beoplay entries in configuration.yaml
  • Installed the new beoplay directory pulled from your repository into custom_components
  • Added beoplay section in configuration.yaml as per the README.CMD: FAILED HA configuration checks
  • Added a device via the configuration flow/ Integration add successfully
  • I'm not able to find the device when I want to add it my HA Workspace while looking for media_player entity.

Note: I'm not a developer, so apologize my poor skills here
Note 2: I'm a member of the Beoworld forum

Kind regards.
Jérôme

adding new devices return none

Hi
I had to readd some of my devices, due to network changes.
My TVs work fine, but other audio devices (e.g. essence and core) come in as unnamed device, shown as none none.

HA version 2023.6.1
errors from the log:

Logger: custom_components.beoplay.media_player
Source: custom_components/beoplay/media_player.py:297
Integration: Bang & Olufsen BeoPlay Devices
First occurred: 16:33:59 (1 occurrences)
Last logged: 16:33:59

Unexpected error in None
Traceback (most recent call last):
File "/config/custom_components/beoplay/media_player.py", line 263, in _start_poll_command
await self.async_update_status()
File "/config/custom_components/beoplay/media_player.py", line 297, in async_update_status
await self._speaker.async_notificationsTask(notif_callback)
File "/usr/local/lib/python3.11/site-packages/pybeoplay/init.py", line 202, in async_notificationsTask
self._speaker._host_notifications,
^^^^^^^^^^^^^
AttributeError: 'BeoPlay' object has no attribute '_speaker'

Add as device

Featurerequest: it would be nice if the TV's and speakers was added as devices, so it was possible to do automations, based on device state etc.
e.g. i have some speakers that are on a controlled power outlet for energy saving. An automation could be to switch them on, when TV is powered on

Exception thrown when starting HA

HA version: 2022.12.8 Beoplay version: 2023.1.4
When restarting HA it throws exception as it cannot find TV. TV is in ECO mode, so it it not available on network all the time.

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect
return await fut
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.0.106', 8080)

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/beoplay/media_player.py", line 211, in async_setup_entry
await _add_player(hass, async_add_entities, host)
File "/config/custom_components/beoplay/media_player.py", line 132, in _add_player
await speaker.async_update()
File "/config/custom_components/beoplay/media_player.py", line 535, in async_update
await self._speaker.async_get_device_info()
File "/usr/local/lib/python3.10/site-packages/pybeoplay/init.py", line 249, in async_get_device_info
r = await self.async_getReq("BeoDevice")
File "/usr/local/lib/python3.10/site-packages/pybeoplay/init.py", line 96, in async_getReq
async with self._clientsession.get(
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in aenter
self._resp = await self._coro
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.106:8080 ssl:default [Connect call failed ('192.168.0.106', 8080)]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.