Bang Olufsen Module

Hi,

i want to make a B&O module for my TV and speakers.

The question i have is to make a JSON stream into SYmcon.

B&O works with a JSON stream based on the HTTP/1.1 protocol. connection is not closed, JSON packages are comming in to update the status.

Which I/O module do i need to build this, or made my own I/O module?

Thanx

Some commands:

the speaker sends a JSON stream on: http://<ip_address>:8080/BeoNotify/Notifications
the volume can be controlled with: curl -H „Content-Type: application/json“ -X PUT -d ‚{„level“:‘${volume_level}’}’ http://192.168.0.50:8080/BeoZone/Zone/Sound/Volume/Speaker/Level
to play the song/radio/spotify that has been paused: curl -H „Content-Type: application/json“ -X POST http://192.168.0.50:8080/BeoZone/Zone/Stream/Play curl -H „Content-Type: application/json“ -X POST http://192.168.0.50:8080/BeoZone/Zone/Stream/Play/Release
to pause the song/radio/spotify that has been playing: curl -H „Content-Type: application/json“ -X POST http://192.168.0.50:8080/BeoZone/Zone/Stream/Pause curl -H „Content-Type: application/json“ -X POST http://192.168.0.50:8080/BeoZone/Zone/Stream/Pause/Release
to turn off the speaker (standby mode): curl -H „Content-Type: application/json“ -X PUT -d ‚{„standby“:{„powerState“:„standby“}}‘ http://192.168.0.50:8080/BeoDevice/powerManagement/standby

Hi,

I think you have to build your own module. The module type could be a device and has not to be an I/O instance.

Maybe you have a look at the Sonos or Bose SoundTouch modules to get some ideas or any other module like this, e.g Onkyo… Have a look at the community.

Do you have an official API documentation?

If you don‘t want to build a module, you can create scripts to start with, but a module would be the best way.

Regards

Uli

Gesendet von iPhone mit Tapatalk

thanx for you reply.
Already checked both modules.
I already build some modules, but the question is how to proces a HTTP Stream of data.

A telnet output:
~  telnet 192.168.11.167 8080  :heavy_check_mark:  158  21:03:25
Trying 192.168.11.167…
Connected to beoplay-a6-25611490.steehouwer.local.
Escape character is ‚^]‘.
GET /BeoNotify/Notifications?list=recursive+features HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: 192.168.11.167
Accept-Language: en-us
Connection: Keep-Alive

HTTP/1.1 200 OK
Connection: Keep-Alive
Transfer-Encoding: chunked
Device-Jid: 2702.1200268.25611490@products.bang-olufsen.com
Content-Type: application/json

8d6
{„notification“:{„timestamp“:„2019-07-19T19:29:44.313096“,„type“:„SOURCE“,„kind“:„source“,„data“:{„primary":"radio:2702.1200268.25611490@products.bang-olufsen.com,„primaryJid“:"2702.1200268.25611490@products.bang-olufsen.com",„primaryExperience“:{„source“:{„id":"radio:2702.1200268.25611490@products.bang-olufsen.com“,„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":"2702.1200268.25611490@products.bang-olufsen.com“,„friendlyName“:„BeoPlay A6“}},„listener“:[„2702.1200268.25611490@products.bang-olufsen.com“],„lastUsed“:„2019-07-19T18:19:22.855000“,„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-07-19T19:29:44.314428“,„type“:„NOW_PLAYING_NET_RADIO“,„kind“:„playing“,„data“:{„name“:„Arrow Classic Rock (Classic Rock)“,„genre“:„Classic Rock“,„country“:"",„languages“:"",„image“:[{„url“:„http://cdn-profiles.tunein.com/s6702/images/logog.png?t=152752",„size“:„large“,„mediatype“:„image/png“}],„liveDescription“:"FREE - MY BROTHER JAKE“,„stationId“:„s6702“,„playQueueItemId“:„plid-4205.6“}}}

{„notification“:{„timestamp“:„2019-07-19T19:29:44.314695“,„type“:„PROGRESS_INFORMATION“,„kind“:„playing“,„data“:{„state“:„play“,„position“:4219,„seekSupported“:false,„playQueueItemId“:„plid-4205.6“}}}

{„notification“:{„timestamp“:„2019-07-19T19:29:44.314857“,„type“:„VOLUME“,„kind“:„renderer“,„data“:{„speaker“:{„level“:33,„muted“:false,„range“:{„minimum“:0,„maximum“:74}}}}}

{„notification“:{„timestamp“:„2019-07-19T19:29:44.314998“,„type“:„SOFTWARE_UPDATE_STATE“,„kind“:„device“,„data“:{„state“:„idle“}}}

This continues as long as the connection is established.

Now, howto proces this stream, non blocking in Symcon.

Thanx!

The easiest should be a simple ClientSocket. You send the „initial“ request and then you take care of the HTTP processing on your own. As you are only interested in the payload filtering the HTTP overhead should not be that complicated.

paresy

Thanx, this helped me a lot! traffic is comming in!

Next question, how can i have a statefull property variable?

examples:

/**

  • @property int $State
    */
    class BangOlufsenDevice extends IPSModule
    {

public function Create()
{

$this->State=10;
}

public function ReceiveData($JSONString)
{
$this->State++;
$this->SendDebug(FUNCTION, "COunt: ".$this->State,0);

}

I get a error: 20-07-2019 13:47:11 | FlowHandler | Could not forward data to instance #37416: <br />
<b>Notice</b>: Undefined property: BangOlufsenDevice::$State in <b>/var/lib/symcon/modules/IPS_BO/BangOlufsen/module.php</b> on line <b>107</b><br />

How can i fix this and make $State not static but keeps my state?

thanx again.

found it,

added those functions to my class and it works:
public function __set($name, $value)
{
$this->SetBuffer($name, serialize($value));
}
public function __get($name)
{
return unserialize($this->GetBuffer($name));
}

Just in case anyone stumbles upon this old thread; I’ve started working on a module for the B&O speakers.
If anyone is interested, you can check it out manually: GitHub - Tharit/IPSymconBeoPlay
I might add it to the store once I had time to polish a little more.

No discovery yet, just manually add a BeoPlaySpeakerDevice and configure the socket with the right IP & port 8080. Actions (Stop, Pause, Play, …) are available via BeoPlay_* methods.

Also, at least with my speakers there is still frequent disconnects, I’ll look into that in the next days… maybe the long polling connection has a timeout and simply works this way.

Hi,

I have made a beta module: GitHub - herwinjan/IPS_BO: Bang Olufsen Symcon Module two years ago.

Stopped with it for the same reason you described: frequent disconnects. could not found the issue then.

With the new speakers (like the BL28) this code is not working anymore, they are using a new protocol.

Just if anyone else looks here:
I figured out the disconnects in the meantime; the speakers use chunked http for sending the updates; at some point the webserver will indicate that a chunk is the last one; then you can reuse the connection and send another request to get updates again. With this handled it’s very stable.

1 „Gefällt mir“