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

 

Python program to monitor ML and BL network traffic

rated by 0 users
This post has 4 Replies | 0 Followers

L Spad
Top 500 Contributor
Brighton
Posts 271
OFFLINE
Bronze Member
L Spad Posted: Thu, Nov 25 2021 7:35 PM

Dear all,

I'm in the process of forking the amazing HomeAssistant integration that Giachello produced for the Indigo Home Automation Software. He did a really incredible job and has been really kind with advice - to be really clear all the clever stuff is his work. In the process of doing so I've had to reprogram it because Indigo only recognises Python 2.7. As a stepping stone I produced a simple reporting tool before I embed it into the HA system and I thought others might be interested. I should have the Indigo plugin sorted in a month or so.

I've coded a very basic logging program that will provide a nicely formatted read out of any traffic on the basic MasterLink network, the MLGW protocol and the Bang and Olufsen Home Automation protocol (trust B&O to make it overly complex). It borrows information from each protocol to make the packet readout more informative where possible (e.g. if a currently playing radio station is in your favourites list the software will recognise that and report the name).

The software requires either an MLGW or BLGW to run. It probably works with a Believing intelligence, but I don't have one of those to test it with. It will require a basic knowledge of python to run: The main requirement to set it up is to edit the main.py file to include the correct host address and password for your gateway, as well as the ports assigned to the various protocols if you've changed them from the defaults.

I've uploaded the code to Github here: https://github.com/LukeSpad/BeoGateway

An example readout below for a masterlink telegram when I turn on my radio:

INFO:root:

-------------------------------------------------------------------------------------------------------------------------------------

ML command line interface: <--Data-received!-<< on 25/11/21 at 19:10:45

-------------------------------------------------------------------------------------------------------------------------------------

Header: [192, 193, 1, 20, 0, 0, 0, 130, 9]

Payload: [1, 4, 111, 2, 2, 0, 0, 1, 255, 255]

============================================================================

    from_device: AUDIO MASTER 

    from_source: NONE 

    to_device: VIDEO MASTER 

    to_source: NONE 

    type: RESPONSE 

    payload_type: TRACK_INFO_LONG 

    payload_len: 10 

    State_Update: 

        nowPlaying: BBC Radio 2 

        nowPlayingDetails: 

            type: AUDIO 

            channel_track: 2

 

        sourceName: RADIO 

        source: RADIO 

        sourceID: 111 

        state: Play

 

It's quite fun to see things like the 'conversations' that occur when a masterlink network powers up!

L Spad
Top 500 Contributor
Brighton
Posts 271
OFFLINE
Bronze Member

Hi all,

In case anyone is interested, I've uploaded an updated version to Github today. It allows direct control of apple music from the N.Music source, as well as reporting of the system state in the Notification Centre. Obviously this means it is a Mac only program.

I've tested it with my BLGW and my old MLGW and it works with all 4 B&O monitoring protocols at least for all use cases of my system (which includes ML and NL devices). Next step is packaging it up as a plugin for the Indigo home automation software.

Screenshot attached

L Spad
Top 500 Contributor
Brighton
Posts 271
OFFLINE
Bronze Member
L Spad replied on Sun, Feb 6 2022 12:23 AM

I’ve now updated the software and released v1.0 of the fully featured Indigo Domotics plug-in. 
 https://www.indigodomo.com/pluginstore/259/

the plug-in allows

- control of lighting and other smart home appliances 

- Native control of iTunes on a user assigned Source

- one touch start/join of audio sources via Apple Home app/Siri

- posting state message in the Notification Centre

mbolo01
Top 50 Contributor
Louannec - France
Posts 2,035
OFFLINE
Bronze Member
mbolo01 replied on Sun, Feb 6 2022 9:46 AM
Nice work! Can’t test it now, but I’m considering expanding my home automation setup in the coming months. For now I’m using HA in a docker hosted by a QNAP NAS. I use Giachello’s great integration on a daily basis:

BS Moment, BS Core, BG 4002, BC 4500, BS1, BL18, BL19, BL8000 + RCV1, A6, M5, M3, A1, P6 (tks Botty), H5, TR1

L Spad
Top 500 Contributor
Brighton
Posts 271
OFFLINE
Bronze Member
L Spad replied on Sun, Feb 6 2022 10:32 AM

Yes, my work draws heavily on the MLGW HA plug-in; use of the MLGW/BLGW as a gateway rather than a main automation controller opens up a lot of possibilities. My programmes have mainly been for my own entertainment and use but if they’re at all helpful to others I’m glad to share. 

I must say I’ve been quite tempted by HA, but I’m slightly tied to using indigo as it allows me to run my file server, Home Automationserver, Music Server (Apple Music) and CCTV (SecuritySpy) server from a single Mac mini, and control the lot via the apple Home app/Siri. It’s also rock solid - I’ve restarted it less than a handful of times in the past 7 years. When my old Mac mini dies I may well transition to HA.

anyway - hopefully these projects can run in parallel - there’s a good community of developers here and the B&O protocols are complex and dare I say not always as strictly followed as you might expect!

Page 1 of 1 (5 items) | RSS