BeoLink (Bang & Olufsen)

{“notification”:{“timestamp”:“2019-02-05T15:28:36.570772”,“type”:“SOURCE”,“kind”:“source”,“data”:{“primary":"radio:[email protected],“primaryJid”:"[email protected]",“primaryExperience”:{“source”:{“id":"radio:[email protected]”,“friendlyName”:“TuneIn”,“sourceType”:{“type”:“TUNEIN”},“category”:“RADIO”,“inUse”:true,“profile”:“”,“linkable”:true,“recommendedIrMapping”:[{“format”:0,“unit”:0,“command”:129},{“format”:11,“unit”:0,“command”:129},{“format”:11,“unit”:1,“command”:129},{“format”:0,“unit”:0,“command”:147},{“format”:11,“unit”:0,“command”:147}],“contentProtection”:{“schemeList”:[“NONE”]},“embeddedBinary”:{“schemeList”:},“product”:{“jid":"[email protected]”,“friendlyName”:“Beosound Shape”}},“listener”:[“[email protected],"[email protected]"],“lastUsed”:“2019-02-05T15:23:23.153000”,“state”:“play”,“_capabilities”:{“supportedNotifications”:[{“type”:“SOURCE”,“kind”:“source”},{“type”:“SOURCE_EXPERIENCE_CHANGED”,“kind”:“source”},{“type”:“PLAY_QUEUE_CHANGED”,“kind”:“playing”},{“type”:“NOW_PLAYING_ENDED”,“kind”:“playing”},{“type”:“STREAMING_STATUS”,“kind”:“streaming”},{“type”:“PROGRESS_INFORMATION”,“kind”:“playing”},{“type”:“NOW_PLAYING_NET_RADIO”,“kind”:“playing”}]}}}}}

{“notification”:{“timestamp”:“2019-02-05T15:28:36.571282”,“type”:“NOW_PLAYING_NET_RADIO”,“kind”:“playing”,“data”:{“name”:“103.3 | RAI Isoradio (Traffic News)”,“genre”:“Traffic News”,“country”:“”,“languages”:“”,“image”:[{“url”:“http://cdn-profiles.tunein.com/s25595/images/logog.png?t=152544",“size”:“large”,“mediatype”:“image/png”}],“liveDescription”:"Traffic News”,“stationId”:“s25595”,“playQueueItemId”:“plid-17.3”}}}

{“notification”:{“timestamp”:“2019-02-05T15:28:36.571418”,“type”:“PROGRESS_INFORMATION”,“kind”:“playing”,“data”:{“state”:“play”,“position”:233,“seekSupported”:false,“playQueueItemId”:“plid-17.3”}}}

{“notification”:{“timestamp”:“2019-02-05T15:28:36.571506”,“type”:“VOLUME”,“kind”:“renderer”,“data”:{“speaker”:{“level”:29,“muted”:false,“range”:{“minimum”:0,“maximum”:90}}}}}

{“notification”:{“timestamp”:“2019-02-05T15:28:36.571582”,“type”:“SOFTWARE_UPDATE_STATE”,“kind”:“device”,“data”:{“state”:“idle”}}}

{“notification”:{“id”:26138,“timestamp”:“2019-02-05T15:28:36.639289”,“type”:“PROGRESS_INFORMATION”,“kind”:“playing”,“data”:{“state”:“play”,“position”:234,“seekSupported”:false,“playQueueItemId”:“plid-17.3”}}}

{“notification”:{“id”:26139,“timestamp”:“2019-02-05T15:28:37.643425”,“type”:“PROGRESS_INFORMATION”,“kind”:“playing”,“data”:{“state”:“play”,“position”:235,“seekSupported”:false,“playQueueItemId”:“plid-17.3”}}}

{“notification”:{“id”:26140,“timestamp”:“2019-02-05T15:28:38.643286”,“type”:“PROGRESS_INFORMATION”,“kind”:“playing”,“data”:{“state”:“play”,“position”:236,“seekSupported”:false,“playQueueItemId”:“plid-17.3”}}}

hey @CMDK

here is a quick fix:

This is the custom package update
:wink:

Thanks :smiley:
New error, but only on my shape (really weird):

Unexpected error in Shape
Traceback (most recent call last):
  File "/config/custom_components/media_player/beoplay.py", line 122, in _start_poll_command
    await self.async_update_status()
  File "/config/custom_components/media_player/beoplay.py", line 166, in async_update_status
    self._speaker.getSource(data_json)
  File "/config/deps/lib/python3.6/site-packages/beoplay/__init__.py", line 80, in getSource
    self.source = data["notification"]["data"]["primaryExperience"]["source"]["friendlyName"]
KeyError: 'friendlyName' 

Again here is the output from Notifications:
{"notification":{"timestamp":"2019-02-05T16:02:26.142122","type":"SOURCE","kind":"source","data":{"primary":"radio:[email protected]","primaryJid":"[email protected]","primaryExperience":{"source":{"id":"radio:[email protected]","friendlyName":"TuneIn","sourceType":{"type":"TUNEIN"},"category":"RADIO","inUse":true,"profile":"","linkable":true,"recommendedIrMapping":[{"format":0,"unit":0,"command":129},{"format":11,"unit":0,"command":129},{"format":11,"unit":1,"command":129},{"format":0,"unit":0,"command":147},{"format":11,"unit":0,"command":147}],"contentProtection":{"schemeList":["NONE"]},"embeddedBinary":{"schemeList":[]},"product":{"jid":"[email protected]","friendlyName":"Beosound Shape"}},"listener":["[email protected]"],"lastUsed":"2019-02-05T15:57:35.074000","state":"play","_capabilities":{"supportedNotifications":[{"type":"SOURCE","kind":"source"},{"type":"SOURCE_EXPERIENCE_CHANGED","kind":"source"},{"type":"PLAY_QUEUE_CHANGED","kind":"playing"},{"type":"NOW_PLAYING_ENDED","kind":"playing"},{"type":"STREAMING_STATUS","kind":"streaming"},{"type":"PROGRESS_INFORMATION","kind":"playing"},{"type":"NOW_PLAYING_NET_RADIO","kind":"playing"}]}}}}} {"notification":{"timestamp":"2019-02-05T16:02:26.142606","type":"NOW_PLAYING_NET_RADIO","kind":"playing","data":{"name":"93.9 | DR P3 (Euro Hits)","genre":"Pop","country":"","languages":"","image":[{"url":"http://cdn-profiles.tunein.com/s24861/images/logog.png","size":"large","mediatype":"image/png"}],"liveDescription":"Am I Wrong - Nico & Vinz","stationId":"s24861","playQueueItemId":"plid-17.0"}}}

Does not make much sense. And it’s only the Shape doing it. Tried to reboot the Shape.

Anyways, don’t focus too much on that now, I think. Might be something local.

:slight_smile: great progress!

@CMDK let’s fix as much as we can :slight_smile: I don’t have a shape, but can you get the output from: http://shapeip:8080/BeoZone/Zone/Sources ?

Here you go:

{
    "sources": [
        [
            "radio:[email protected]",
            {
                "id": "radio:[email protected]",
                "friendlyName": "TuneIn",
                "sourceType": {
                    "type": "TUNEIN"
                },
                "category": "RADIO",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": true,
                "recommendedIrMapping": [
                    {
                        "format": 0,
                        "unit": 0,
                        "command": 129
                    },
                    {
                        "format": 11,
                        "unit": 0,
                        "command": 129
                    },
                    {
                        "format": 11,
                        "unit": 1,
                        "command": 129
                    },
                    {
                        "format": 0,
                        "unit": 0,
                        "command": 147
                    },
                    {
                        "format": 11,
                        "unit": 0,
                        "command": 147
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "NONE"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "remoteLists": [
                    "music"
                ],
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=radio%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./radio%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "music:[email protected]",
            {
                "id": "music:[email protected]",
                "friendlyName": "Music",
                "sourceType": {
                    "type": "MUSIC"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": true,
                "recommendedIrMapping": [
                    {
                        "format": 0,
                        "unit": 0,
                        "command": 145
                    },
                    {
                        "format": 11,
                        "unit": 0,
                        "command": 145
                    },
                    {
                        "format": 11,
                        "unit": 0,
                        "command": 148
                    },
                    {
                        "format": 0,
                        "unit": 0,
                        "command": 150
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "PROPRIETARY"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "remoteLists": [
                    "music"
                ],
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=music%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./music%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "qplay:[email protected]",
            {
                "id": "qplay:[email protected]",
                "friendlyName": "QPlay",
                "sourceType": {
                    "type": "QPLAY"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": true,
                "recommendedIrMapping": [
                    {
                        "format": 0,
                        "unit": 0,
                        "command": 148
                    },
                    {
                        "format": 11,
                        "unit": 2,
                        "command": 150
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "PROPRIETARY"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "remoteLists": [
                    "music"
                ],
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=qplay%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./qplay%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "spotify:[email protected]",
            {
                "id": "spotify:[email protected]",
                "friendlyName": "Spotify",
                "sourceType": {
                    "type": "SPOTIFY"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": false,
                "recommendedIrMapping": [
                    {
                        "format": 0,
                        "unit": 0,
                        "command": 146
                    },
                    {
                        "format": 11,
                        "unit": 0,
                        "command": 150
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "PROPRIETARY"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": [
                        "SPOTIFY_EMBEDDED_SDK"
                    ]
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=spotify%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./spotify%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "bluetooth:[email protected]",
            {
                "id": "bluetooth:[email protected]",
                "friendlyName": "Bluetooth",
                "sourceType": {
                    "type": "BLUETOOTH"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": true,
                "recommendedIrMapping": [
                    {
                        "format": 11,
                        "unit": 2,
                        "command": 131
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "PROPRIETARY"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "remoteLists": [
                    "music"
                ],
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=bluetooth%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./bluetooth%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "toslink:[email protected]",
            {
                "id": "toslink:[email protected]",
                "friendlyName": "Optical",
                "sourceType": {
                    "type": "TOSLINK"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": true,
                "recommendedIrMapping": [
                    {
                        "format": 11,
                        "unit": 3,
                        "command": 131
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "PROPRIETARY"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "remoteLists": [
                    "music"
                ],
                "lowLatency": false,
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=toslink%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./toslink%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "linein:[email protected]",
            {
                "id": "linein:[email protected]",
                "friendlyName": "Line-In",
                "sourceType": {
                    "type": "LINE IN"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": true,
                "recommendedIrMapping": [
                    {
                        "format": 0,
                        "unit": 0,
                        "command": 131
                    },
                    {
                        "format": 11,
                        "unit": 0,
                        "command": 131
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "PROPRIETARY"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "remoteLists": [
                    "music"
                ],
                "lowLatency": false,
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=linein%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./linein%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "airplay:[email protected]",
            {
                "id": "airplay:[email protected]",
                "friendlyName": "AirPlay",
                "sourceType": {
                    "type": "AIRPLAY"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": false,
                "recommendedIrMapping": [
                    {
                        "format": 11,
                        "unit": 2,
                        "command": 148
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "BLOCK"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "enableMultiroom": false,
                "passphraseProtection": "",
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=airplay%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./airplay%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "deezer:[email protected]",
            {
                "id": "deezer:[email protected]",
                "friendlyName": "Deezer",
                "sourceType": {
                    "type": "DEEZER"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": false,
                "recommendedIrMapping": [
                    {
                        "format": 11,
                        "unit": 1,
                        "command": 150
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "PROPRIETARY"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=deezer%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./deezer%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "googlecast:[email protected]",
            {
                "id": "googlecast:[email protected]",
                "friendlyName": "Chromecast built-in",
                "sourceType": {
                    "type": "GC4A"
                },
                "category": "MUSIC",
                "inUse": true,
                "signalSensed": false,
                "profile": "",
                "borrowed": false,
                "linkable": false,
                "recommendedIrMapping": [],
                "contentProtection": {
                    "schemeList": [
                        "BLOCK"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "termsAndConditions": "accepted",
                "shareUsageData": true,
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=googlecast%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./googlecast%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "dlna:[email protected]",
            {
                "id": "dlna:[email protected]",
                "friendlyName": "Music stream",
                "sourceType": {
                    "type": "DLNA_DMR"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": false,
                "recommendedIrMapping": [
                    {
                        "format": 11,
                        "unit": 1,
                        "command": 132
                    },
                    {
                        "format": 11,
                        "unit": 1,
                        "command": 148
                    }
                ],
                "contentProtection": {
                    "schemeList": [
                        "PROPRIETARY"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=dlna%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./dlna%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ],
        [
            "alarm:[email protected]",
            {
                "id": "alarm:[email protected]",
                "friendlyName": "Alarm",
                "sourceType": {
                    "type": "UNDEFINED"
                },
                "category": "MUSIC",
                "inUse": true,
                "profile": "",
                "borrowed": false,
                "linkable": false,
                "recommendedIrMapping": [],
                "contentProtection": {
                    "schemeList": [
                        "PROPRIETARY"
                    ]
                },
                "embeddedBinary": {
                    "schemeList": []
                },
                "product": {
                    "jid": "[email protected]",
                    "friendlyName": "Beosound Shape"
                },
                "jid": "[email protected]",
                "_links": {
                    "/relation/move": {
                        "href": "./move?id=alarm%3a2797.1293039.28401075%40products.bang-olufsen.com&moveto={index}",
                        "templated": true
                    },
                    "self": {
                        "href": "./alarm%3a2797.1293039.28401075%40products.bang-olufsen.com"
                    }
                }
            }
        ]
    ]
}

i’m following the post, today i’ve successfully set up a Beoplay M5, but in the Dev-info i got this error:

      Wed Feb 06 2019 12:06:25 GMT+0100 (Ora standard dell’Europa centrale)

Error handling message: {'type': 'media_player_thumbnail', 'entity_id': 'media_player.beoplay_m5_2', 'id': 243}
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/yarl/__init__.py", line 163, in __new__
    port = val.port
  File "/usr/local/lib/python3.6/urllib/parse.py", line 169, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: '8123skin:iconGooglecast'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 371, in _request
    url = URL(str_or_url)
  File "/usr/local/lib/python3.6/site-packages/yarl/__init__.py", line 165, in __new__
    raise ValueError("Invalid URL: port can't be converted to integer")
ValueError: Invalid URL: port can't be converted to integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 881, in websocket_handle_thumbnail
    data, content_type = await player.async_get_media_image()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 388, in async_get_media_image
    return await _async_fetch_image(self.hass, url)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 815, in _async_fetch_image
    response = await websession.get(url)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 373, in _request
    raise InvalidURL(str_or_url)
aiohttp.client_exceptions.InvalidURL: https://xxx:8123skin:iconGooglecast

Weird, it has a friendlyName property. So it should be good. Also this is not an optional property. I have to pass on this one for now :man_shrugging:

1 Like

Hey,

how did you configure it in your configuration.yaml file?

media_player:
  - platform: beoplay
    host: 192.168.1.20
    name: Beoplay M5

That looks good. And how do you play google cast on the speaker? Looks like the media image url is pushed as home assistant mdi:icon and not as an url. That is causing the problem.

i’ve to make some test in the evening…

Alright, let me know how it goes.

hey @g.nigro,

I managed to reproduce the same error. Have a solution in mind. Will implement soon.

Ok, i’ll wait

Hi guys,

here’s an update that fixes issues with the latest 0.88.0 release of Home Assistant.

Don’t forget to change the folder and file name structure to:
/custom_components/beoplay/media_player.py

Best,
Marton

Hi,

A new update with very basic multiroom functions. If you update the files, you’ll see that there are two services under media_player services. One is called “beoplay_join_experience” and the other is “beoplay_leave_experience”. You have to provide the entity id for the service as JSON otherwise it will not do anything.

If you call join experience, it will automatically join the first experience it finds. If you call it again it will jump to the next, etc. Leave experience just leaves the experience. If you call it on the master speaker, everything will stop.

There’s a lot more to do with this. Setting up a proper master-slave configuration, etc. This is just a first test :slight_smile: Also I think it will be time to restructure the code. As I’ll have time I’ll keep updating these.

Marton

Edit:
I have published the library to Pypi, so no need to copy the zip as before.
Just change the requirements to:
REQUIREMENTS = ['ha-beoplay']

Custom component:

1 Like

You’re a legend!

1 Like

Created a github repository for this component, so I don’t have to create a dropbox link every time I push an update:

3 Likes

Hi guys,

I’ve updated the custom component to work with the newest release of Home Assistant. Grab it here:

1 Like