Sign in   |  Join   |  Help
Untitled Page

ARCHIVED FORUM -- March 2012 to February 2022
READ ONLY FORUM

This is the second Archived Forum which was active between 1st March 2012 and 23rd February 2022

 

Masterlink Gateway and Beolink Gateway integration Home Assistant

rated by 0 users
This post has 82 Replies | 2 Followers

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni Posted: Tue, Jan 5 2021 4:36 PM

Hi there

Just to let you know that I created an integration between Masterlink Gateway and Beolink Gateway with Home Assistant with some really cool functionality to tap directly into the Masterlink bus and enable all kinds of fun integrations like controlling your digital streaming from your old school Beolink devices.

 

https://github.com/giachello/mlgw

 

Stefan E
Top 500 Contributor
Sweden
Posts 101
OFFLINE
Gold Member

WOW!!! 

This integration really opens up lot of new possibilities to interact with IP controlled products/systems via your local BEO remote as well integrate other home assistant integration with B&O such as my security alarm.

Have been searching for a long time a solution to be able to control via a BEO remote my chrome cast connected to my TV, now I think this solution will solve that issue in a elegant way.

BS3 DVB-HD, BV7-40 MKIII, BC6-26, BC6-23, BV4-50/BS2, BS5, BS9000, BL3500, MLGW, BLGW, PlayMaker, - BS6500, BS4500, LX6000, VX7000, MX5500, VX5000 - Beo6, Beo5, BeoTimex2, Linctonic

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member

Great!

 

Let me know how it works for you and any feedback!

 

stuart50_1
Not Ranked
Posts 65
OFFLINE
Bronze Member

Hi 

is this smoothing that would help with connectivity between my Beomaster /sound 5 and a new eclipse tv 

for playing sound over tv speakers 

stuart50_1
Not Ranked
Posts 65
OFFLINE
Bronze Member

And how do you install it 

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member

No this is for older equipment connected to a MasterLink Gateway device.

 

For newer equipment there is a Home Assistant integration called beoplay

 

https://github.com/giachello/ha-beoplay

 

You need Home Assistant for this to work. Home Assistant is the leading open source Home Automaton system: https://www.home-assistant.io

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member
Zeus_72 replied on Fri, Jan 8 2021 3:34 PM

Ciao Giovanni... gran bel lavoro

Hi Giovanni great job,

if you remember I asked you for help on how to solve the problems I had with the simonkamronn plug-in and you, in addition to helping me, provided me with the frog code.
In recent months I have tried to understand how it works and consequently improve the plug-in but I only realized that I do not have the knowledge and tools necessary to do so. When I saw that you had started developing a new plug-in I immediately installed it, replacing it with simon's. I found improvements in reporting the on/off status of B&O devices and communication in general, nice thing to have also integrated the coding of the ml protocol in addition to that of the mlgw. So far I have noticed these anomalies:


a) When the source is changed, the telegram of the default source is not sent by the homeassistant. I try to explain, let's assume we have configured A.MEM as the default source (default_source: A.MEM), when we go to ask the home assistant to turn-on the B&O device this will turn on the audio master and set the source to A.MEM. When changing source (eg Radio) everything works as it should, a further change will work with all sources except the default source. In other words, once the source has been changed, there is no way to go back to A.MEM.
I tried not to configure the default source or by setting other sources including video (DTV, TV, DVD etc) but the problem remains.


b) If I ask to switch on a slave device (Beolab 2000) all the slave devices switch on (Beovision 10). Looking at the logs I seem to have noticed that home assistant sends a command to all devices.

Finally I would like to discuss the various masterlink configurations.As far as I know, an audio/video masterlink system can be composed of:

Video master (Eg Beovison 7)
Audio master (Beosound 9000)
Source center (Beosound 5 / Beomaster5)
and various Audio and Video slaves.

Slaves can also have local sources (e.g. Beovision 10 or beolink active) It would be interesting to understand if the local information on switching on and changing the source of the various slave-devices is sent on the masterlink protocol.
If this were the case we would have the possibility to know which device is on and on which source it is positioned and use this info as a trigger. What do you think about it?

Thanks

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member

Hi thank you for the feedback!

I did reproduce a) ... and will look into it on the weekend. The source updates in the component data but the UI for some reason does not sync with that

b) I could not reproduce. can you send me the exact sequence of actions and a cut and paste of the home-assistant.log file (enable debugging of the mlgw component as specified in the instructions).

 

Thank you

Giovanni

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member

on the third comment, Local source for sub- components is interesting but I didn't handle these cases. We'd have to understand the protocol better when these are activated. Cut and past of the protocol traffic would be helpful here.

 

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member

Ciao Giovanni

I made further tests.

When I turn on the beolab 2000 (mln 4) from homeassistant only the speacker switch-on but the interface shows on the mln 4 (beolab 2000) and the mln 3 (Beovision 10).

In this situation, if I physically switch off the beolab 2000, lovelace shows mln 3 deactivated and mln 4 active. Everything seems misaligned by 1 (mln - 1).

In fact, if I turn on mnl 3 in the interface, mnl 2 (BeoLink Converter) and mnl 3 are turned on.

Another consideration if a slave device has a double source (eg beoplay A6/Radio and AudioMaster/Radio) then the command on lovelace makes the local source play. I assume that to listen to the source from the Audio-master the command "link+source" mast be implemented.

Over the weekend I will do further tests and let you know. I am attaching an extract from the log and the configuration of the plug-in

 

as for the sub components, let me know how I can help you.

 

 

Thank you

Emanuele

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member

mlgw.yaml file

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member

Ok so I fixed bug #1, check out the repository for the new code. Not that some times it takes a little while for the source to update.

 

I could not reproduce #2.

are you sure you set up the MLN configuration correctly?

 

Giovanni

 

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member

I confirm that with the new code bug # 1 has been solved, but now the last source recalled becomes the default_source. This behavior would be welcome but becomes a problem with Beovision 7 / Beosystem3. When these devices are turned off, they send various telegrams that interfere with the sources, the result is that the plug-in stores a video source as the last source-default_source, even if you were listening to the Radio or a CD. The next time any device is turned on, it will recall a video source with the consequence of turning on the TV.

I was able to understand and solve bug # 2. The plug-in to operate in a bidirectional way synchronizes the mln (masterlink node number) with the identifiers of the ml devices. The synchronization is carried out in a sequential manner, combining the mln with the responses to the commands packaged ad Hoc (I ask Giovanni for confirmation of this statement), the Beolink Converter nl/ml (blc) and the netlink devices connected to it, do not respond to these commands. In my first plug-in configuration I had inserted the blc in second place (mln 2) with the consequence that the mln - command response associations were wrong. Now I have ordered all netlink devices at the end and I have used the mln: number option. Now everything works as it should.
I attach the modified and working mlgw.yaml file.
Moral of the story: If you have a beolink converter nl/ml (blc) and nl devices, always place them at the end.


I further played with the plug-in and found that local sources are not showing on home assistant. Example: if I turn on beovision 7 (video master) by recalling a local source (TV), this is not signaled on lovelace, while everything works if I recall an audio source. If a client device has a local source (eg Beolink Active PC) equal to that of an audio/video master, home assistant will call up the local one. It would be nice to implement the LINK + source function and a different source list for each device as it is done on MasterLinkGateWay.

Thanks again for the great work Giovanni is doing.

 

Emanuele

 

 

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Mon, Jan 11 2021 11:10 PM

Thanks for testing!

For #1, can you enable "debug" logging  and send me the log of the ml traffic with a simple interaction?  This is an interesting use case to support.

 

logger:

  default: warning

  logs:

    custom_components.mlgw: debug

 

 

For #2  I get the synchro issues; that's exactly what is happening. will try to see if there is a more robust way of doing the ML<>MLN matching

 

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member

Here I am,

I am attaching the log you requested from me, I will try to help you by describing my Bang & Olufsen system and what I did during the log.

A. This is my ML/NL configuration:

B. Below are the various commands sent to Bang & olufsen devices

     18:00 With the system completely off, using the beo4 remote control, I turn on the BV7 by calling up the Radio source.

              A radio station is played but lovelace first displays the Radio source and after one minute the DTV source.





   

18:05 Using beo4 I turn off the BV7. The whole system shuts down.





      18:10 With the system completely off, through the Home Assistant Lovelace interface, I turn on the Beolab 2000, which reproduces the sound of a DTV channel.The BV7 is turned on with the screen off.




      18:15 Also from the Lovelace interface I change the source to Beolab 2000, setting it to Radio.

       The Beolab 2000 reproduces the sound of a Radio station but various sources alternate on the interface: Radio --- DVD and finally DTV and so it remains for all the time.





         18:20 From the Lovelace interface re-set source to Beolab 2000, on Radio.

                   Beolab 2000 reproduces the sound of a radio station and the interface shows as source: Radio.





      18:25 Using the Lovelace interface I turn off the BeoLAb 2000. The whole system shuts down.




I stay tuned ...Smile

Ancora grazie .....Ciao

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Sat, Jan 16 2021 8:11 PM

Cool I think I found the issue. Fixing the code and releasing later in the weekend.

 

 

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Sun, Jan 17 2021 3:15 AM

Ok, I uploaded new version of the code, let me know if it works!

 

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member

Now the plug-in works fine for audio sources.

Lovelace still doesn't show when a device (eg Beovision7) plays a local source (eg TV). Seeing the logs maybe there is a trick, but I want to be sure. As for the Playload type 0X44 and its subtype 0X0B, I discovered some things that can help in reporting the info of the source in use on Home assistant. I am attaching a pdf with what I have discovered so far.

Listening to the ML protocol you discover new things every time ...Smile

 

 

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Tue, Jan 19 2021 6:30 AM

Local sources are an issue because nothing is reported on the ML bus when you select a local source like A.MEM. For example, when I select A.MEM on the Audio Master no message is sent out.

So not sure there is a solution for this.

Please send the log from selecting TV on the Beovision and we can look for any traffic.

 

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Wed, Jan 20 2021 12:43 AM

For the Status messages you put in the PDF for payload type, can you cut and paste the actual logs? I find it easier to read through that.

thank you!

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member

 

Hi Giovanni

you found a nice way to tell me that I made a few mistakes ... and indeed it is. I have confused hexadecimal numbers with decimal ones.

I am attaching you correct pdf with the log lines examined.

I am not attaching the log because it is what I entered in the previous post.

At the weekend I rehearse with the televisions and then I send you the logs you asked for.

I would like to propose some changes to the names you used to call the Masterlink nodes.

 

In your plug in you report these associations for devices (Node Name):

 

0x80 = ALL

0x83 = ALL_LINK_DEVICES

0xC0 = VIDEO_MASTER

0xC1 = AUDIO_MASTER

0XC2 = SLAVE_DEVICE ----> 0XC2 = SOURCE_CENTER

0xF0 = MLGW

 

I would propose to use for 0XC2 the name "Source_Center" which is used in the B&O manuals when referring to multimedia / PC sources.

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member

Here I am with the required log.

Here are the actions I performed while recording the log.

19:20 With the system completely off, using the beo4 remote control, I turn on the BV7 by calling up the DTV (local source).

           The BeoVision7 (VideoMaster) switches on and transmits the DTV channel. The interface lovelace does not show any B&O devices turned on.

19.25 With beo4  I change channel on the tv (ch.1)

19:30 With the remote control I change source from DTV to DVD (local sources)

          Nothing happens on the interface lovelace

19:35 Using Beo4 I turn off the BV7. The whole system shuts down.

 

19:40 Using Beo4 I turn on bv10 (VideoSlave) by calling up the TV (local source).

         The BeoVision10 switches on and transmits the TV channel. The lovelace interface does not show any B&O devices turned on.

19:45 With remote  change channel on the tv (ch.1)

           Nothing happens on the interface lovelace

19:50 With BV7 I change source from TV to DVD (from local source to VideoMaster source)

          The beovision 7 turns on with the black screen and at the same time starts the DVD.

          Home assistant shows the bv10 switched on with DVD source.

19:55 While the BV10 is on, I turn on the BL2000 through its "RADIO" button.

          The BL 2000 (Audio Slave) turns on and plays the RADIO source (AudioMaster source)

          The BV10 continues to play the DVD (both audio and video)

          Home assistant shows shows the BL2000 and BV10 switched on and playing the radio source.


20:00 I position myself in front of the BL10 and change chapter / track of the DVD with the remote control.

          The BV10 skips to the next scene and continues to play the video and audio of the DVD

          The BL2000 continues to play the radio.

          Home assistant still shows "Radio" as source for both devices.

20:05 Through the Home assistant interface I change the BL2000 source from Radio to DVD (from AudioMaster sorce to VideoMaster source)

          Both the BL2000 and the BV10 reproduce the audio of the DVD. Logically the BV10 also plays the video.

          Lovelace shows "DVD" as the source for both devices.

20:10 Through the Home assistant interface I turn off the bl2000.

          Lovelace only shows BV10 active

20:15 Using the beo4 I turn off the BeoVision10. The whole system shuts down.

I hope all of this will help you.

One thing I noticed when viewing the log is that there is a payload type (0X08) which should indicate if the audio_bus of the masterlink cable is transmitting an audio stream. (The audio stream can be from either an Audiomaster or a VideoMaster).

I saw 3 values ​​for the subtype:

If the value is equal to 0X01 then it is a status request.

If the value is 0X04 then it is an answer whose meaning is "the bus is not occupied by an audio stream"

If the value is 0X06 then it is a response with the payload_len: 4 which means "the bus is occupied by an audio stream". The last Byte will be the source that occupies the bus.

There are also two other payload types 0X07 and 0X1C but I don't know what they mean.

I am waiting for your reply.

Thanks

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Sun, Jan 24 2021 4:53 PM

Thank you for sharing. The main issue is that the MLGW plugin doesn't support two sources at the same time (one on one TV and the other on the other) so some re-engineering is needed to support that. definitely doable but will take some time.

Looking at the logs it looks like the best way to detect activity on the TVs is to use the picture and sound status messages. there may be a way to tracking the audio master when it turns on and off too.

Thanks for sharing the logs, very helpful!

Giovanni

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Mon, Jan 25 2021 4:26 PM

Ok try the current version on github. It should handle TVs better and the sources should be less messed up but I am not sure I handled all the corner cases, so please provide feedback on the same sequence of events you shared previously. Thanks!

 

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member

Ciao Giovanni, Thanks for mentioning me on github

I attack you the new log. I performed the sequences 3 minutes apart.

I just changed the final sequence, I turned off the BV10 from Home assistant and the bl2000 with its button.

The Lovelace interface showed no change when I gave the commands to the BV7 (VideoMaster) by calling up the local sources. Same with the BV10 and local sources, while with the remote sources (DVD of the BV7) things worked.

The lovelace interface showed source changes separately for the slave tv and the slave speaker even while the bv10 showed a dvd and the beolab 2000 played the radio.

I would like to make some considerations and I hope you take them into consideration:

1) what you now call - payload_type ':' UNKNOWN_SOURCE_REQUEST -  it is what, in the previous message, I called "Audio_Bus" and it should indicate if an audio stream goes through the masterlink cable.

I believe that the payload 0x08 works together with 0x07 and 0x1C, but on this statement I have no objective data

I said:

         I saw 3 values ​​for the subtype:

        -  If the value is equal to 0X01 then it is a status request.

        -  If the value is 0X04 then it is an answer whose meaning is "the bus is not occupied by an audio stream"

         - If the value is 0X06 then it is a response with the payload_len: 4 which means "the bus is occupied by an audio stream".

           The last Byte will be the source that occupies the bus.

In the log we see:

VideoMaster asks AudioMaster : 'payload_type': 'UNKNOWN_SOURCE_REQUEST', 'payload_len': '0', 'payload': {}, 'timestamp': '2021-01-25T20:23:17.259000', 'bytes': 'c1c0010b000000080001'

AudioMaster replies to Video Master : payload_type': 'UNKNOWN_SOURCE_REQUEST', 'payload_len': '4', 'payload': {}, 'timestamp': '2021-01-25T20:23:17.289000', 'bytes': 'c0c101140000000804060201006f    (0x6f =RADIO)

 

2) BeoSound 5 / BeoMaster5 consists of a beolink PC2 card connected to a winxp pc embedded. In the beolink system the BS5 / BM5 is recognized both as AudioMaster (0XC1) and as Source Center / PC (0XC2)

That's why I proposed to you:  0XC2 = SLAVE_DEVICE ----> 0XC2 = SOURCE_CENTER

    Many things I found in this repository: https://github.com/toresbe/libpc2

3) In truth this is not a consideration but a curiosity. Why did you rename (0x5C, "REQUEST_KEY") to (0x5C, "LOCK_MANAGER_COMMAND")?

I have many other questions for you, but for now I'll stop here. Continue to thank you for the work you are doing and I renew my help.

 

 

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Tue, Jan 26 2021 1:04 AM

 

Odd about the beovisions not showing that they are on. I added code to set the state to on line 442 of gateway.py. there must be a bug

the code is:

if self._devices is not None and (
response[9] == 0x01 or response[11] == 0x01
):
for x in self._devices:
if x._mln == sourceMLN:
x.set_state(STATE_ON)

 

try to add a logging item just before the for statement. (with the same indentation using spaces, not tabs!!)

_LOGGER.info(f"mlgw: Picture active: {response[9]} on MLN: {sourceMLN}")

 

For 1) happy to add it.  are you 100% sure the telegram does exactly that? I am hesitant to name it with a name that assumes what it does without completely understanding it. 

2)  that's interesting I saw Slave-device in other documentation. but either may work.

3) Lock manager actually I found documented in an article that describes the actual protocol. check out  the link in const.py. I think it's a more accurate representation of the telegram.

 

 

 


Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member

I have attached today's log.

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Tue, Jan 26 2021 7:12 PM

Ok I think I found the bug

try changing lines 412 and 385 from

sourceMLN = _getmlnstr(response[4])

to 

sourceMLN = response[4]

Zeus_72
Not Ranked
Posts 35
OFFLINE
Bronze Member
Zeus_72 replied on Tue, Jan 26 2021 10:33 PM
So,

Good news first. The Lovelace interface recognizes when the bv7 (videomaster) and the bv10 (video slave) are on and when they are off. For the video slave it also shows the correct source. A great job.

The bad news is that home assistant does not report the right source for the videomaster, moreover if I set a video source (eg DVD) through the Lovelace interface both the bv7 and the bv10 only reproduce the audio with the screen off.

Tomorrow or at the latest for the weekend I will do further and more thorough tests and I will attach the log to you.

I believe you are on the right track. Yes - thumbs up
Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Wed, Jan 27 2021 5:08 AM

For the right source in the videomaster

Change line 404 from

if sourceActivity == "Playing" and self._devices is not None:

to:

if sourceActivity != "Standby" and self._devices is not None:

 

For the second one I don't know... let's try to isolate it with the log.


Abakus2007
Not Ranked
Posts 68
OFFLINE
Bronze Member
Abakus2007 replied on Fri, Feb 26 2021 12:38 PM

Hi Giovanni,

 

Thank You for sharing Your knowledge and skills this way, much appreciated.

 

I have one question if I may ask. I have s blgw where the setup if somewhat different from the mlgw, zones etc.

Do I need to make  many changes in the configuration, have added my sources etc in the .yaml file with sources and

devices like beomaster 5 and beolab 3500 and their MLN.

I have my devices in the control panel but not working and I get an error log when starting it up.

 

Thanks in advance

 

Baaz


Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Sat, Feb 27 2021 2:56 PM

Hi Baaz

 

can you send me your configuration, and also the cut and paste of your homeassistant logs? There are other users with BLGW and it works for them.

 

Also, if possible, could you please send me the file http://ADDRESS_OF_BLGW/mlgwpservices.json

 

Giovanni

 

Abakus2007
Not Ranked
Posts 68
OFFLINE
Bronze Member

 

Giovanni,

 

thank You for taking Your time. I've gone back to a very simple installation to narrow down things. Only a Beomaster 5 installed  and two buttons Radio and CD. Also I'm not using the manual config but the automatic. Thing is Beomaster 5 pops up in the control panel but without sources and when I try to start i get the enclosed error code also enclosing mlgwpservices.

 

Thanks

 

Baaz

 

Abakus2007
Not Ranked
Posts 68
OFFLINE
Bronze Member

and the error code...

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member
Giovanni replied on Sat, Feb 27 2021 4:19 PM

Excellent. This is a known bug and I am fixing it this weekend.

Abakus2007
Not Ranked
Posts 68
OFFLINE
Bronze Member

 

Giovanni take Your time, when googling for answers I find You are equally busy helping people on the home assistant forum.

Have a nice Saturday evening

 

Baaz

 

 

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member

Hi Baaz

I made the changes that should support your use case. Please install the latest code and let me know how it works for you.

Giovanni

Abakus2007
Not Ranked
Posts 68
OFFLINE
Bronze Member

 

Hi Giovanni,

some progress, I can start the Beomaster 5, it puts on the CD, and stop once then nothing happens. No error log either.

Still no sources nor does any of the functions work pause or volume control.

 

If I manual include mlgw-script in the configuration I get an error log, if this could be to any help.

 

Thanks

 

Mikael

Abakus2007
Not Ranked
Posts 68
OFFLINE
Bronze Member

 

 

and the yaml

 

 

Giovanni
Not Ranked
San Francisco Bay Area
Posts 56
OFFLINE
Bronze Member

Hi Abakus2007

can you please add this to your configuration.yaml:

 

logger:
  default: warning
  logs:
    custom_components.mlgw: debug

then, do the automatic setup. 
And send me the error log.
The two problems you described (not able to control and manual config failing) are independent from one another, but both seem fixable.

Giovanni

Page 1 of 3 (83 items) 1 2 3 Next > | RSS