+ Antworten
Ergebnis 1 bis 6 von 6
  1. #1
    Registriert seit
    May 2017
    Beiträge
    26

    Standard 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/Zon.../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/Zon...m/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/Zon.../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/p...gement/standby

  2. #2
    Registriert seit
    Oct 2014
    Beiträge
    573

    Standard Bang Olufsen Module

    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

  3. #3
    Registriert seit
    May 2017
    Beiträge
    26

    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  ✔  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@p roducts.bang-olufsen.com","primaryJid":"2702.1200268.25611490@p roducts.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,"comm and":129},{"format":0,"unit":0,"command":147},{"fo rmat":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_PLA YING_ENDED","kind":"playing"},{"type":"STREAMING_S TATUS","kind":"streaming"},{"type":"PROGRESS_INFOR MATION","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":"im age/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":"pli d-4205.6"}}}

    {"notification":{"timestamp":"2019-07-19T19:29:44.314857","type":"VOLUME","kind":"render er","data":{"speaker":{"level":33,"muted":false,"r ange":{"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!

  4. #4
    Registriert seit
    Feb 2005
    Ort
    Lübeck
    Beiträge
    21,057

    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

  5. #5
    Registriert seit
    May 2017
    Beiträge
    26

    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.

  6. #6
    Registriert seit
    May 2017
    Beiträge
    26

    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));
    }

Ähnliche Themen

  1. neue PHP-Module als Ersatz meiner Delphi-Module
    Von tommi im Forum PHP-Module
    Antworten: 187
    Letzter Beitrag: 17.06.19, 21:20
  2. Module aus dem Module Store ersetzen
    Von 1007 im Forum Allgemeine Diskussion
    Antworten: 30
    Letzter Beitrag: 01.04.19, 09:51
  3. Module werden falsch instanziert bei gleichem prefix in der jeweiligen module.json
    Von bumaas im Forum Entwicklung mit PHP-SDK/Delphi-SDK
    Antworten: 9
    Letzter Beitrag: 07.06.17, 15:50
  4. Bang Olufsen A9 Keyring und IPS
    Von jolo im Forum Sonstige Funkkomponenten / Wetterstationen
    Antworten: 1
    Letzter Beitrag: 18.12.11, 17:39