Seite 4 von 12

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 27.08.2013, 22:25
von tbu
Hallo Monty,

danke für die Hilfe, hat soweit alles gut geklappt :D
Ich habe nun auch noch den letzten NS510 im Mediamarkt für 150 € bekommen.
Nun läuft ein NS310, ein NS410 und der neue NS510 seit gut einer Woche stabil.
Ein kleines Weckprogramm auf der CCU startet täglich die "Gute Morgen Musik" auf allen drei "Lampenschirmen".
Durch die Bedienung über Mediola läst sich alles auch gut bedienen.
Schön wäre jetzt noch ein Skript für die Statusabfrage (Play, Stop, Volume, Mute, Sender, Partymodus) der LS.
Im Device Spy habe ich ja schon einiges entdeckt, es fehlt nur noch ein Skript zur Abfrage.
Du hast doch bestimmt auch hierfür eine Lösung/Skript :?:

Gruß tbu

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 28.08.2013, 13:12
von Monty1979
Hallo tbu,

im party_streaming.tcl ist ja schon die abfrage der ID enthalten das brauchst du für den Rest nur anpassen

Code: Alles auswählen

#!/usr/bin/tclsh
set address "192.168.1.20"
set port "8080"

set contentGetState "POST /Party_Control HTTP/1.1\n"
append contentGetState "HOST: $address:$port\n"
append contentGetState "SOAPACTION: \"urn:schemas-sony-com:service:Party:1#X_GetState\"\n"
append contentGetState "CONTENT-TYPE: text/xml; charset=\"utf-8\"\n"
append contentGetState "Content-Length: 298\n"
append contentGetState "CONNECTION: close\n"
append contentGetState "\n"
append contentGetState "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
append contentGetState "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
append contentGetState "<s:Body>"
append contentGetState "<u:X_GetState xmlns:u=\"urn:schemas-sony-com:service:Party:1\"></u:X_GetState>"
append contentGetState "</s:Body>"
append contentGetState "</s:Envelope>"

set chan [socket $address $port]
puts $chan $contentGetState
flush $chan         
      
while {[gets $chan line] >= 0} {
  set input [gets $chan]
  regexp "<SessionID>(.*?)</SessionID>" $input dummy singerSessionID          
  }
close $chan  
    	
puts $singerSessionID
Beispiel: für Play "PLAYING", Stop "NO_MEDIA_PRESENT" und Pause "PAUSED_PLAYBACK"

Code: Alles auswählen

#!/usr/bin/tclsh
set address "192.168.1.20"
set port "8080"

set getState ""
set adresslength [string length $address]

set contentGetState "POST /AVTransport/ctrl HTTP/1.1\n"
append contentGetState "HOST: $address:$port\n"
append contentGetState "SOAPACTION: \"urn:schemas-upnp-org:service:AVTransport:1#GetTransportInfo\"\n"
append contentGetState "CONTENT-TYPE: text/xml; charset=\"utf-8\"\n"
append contentGetState "Content-Length: [expr $adresslength+338]\n"
append contentGetState "CONNECTION: close\n"
append contentGetState "\n"
append contentGetState "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
append contentGetState "<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
append contentGetState "<s:Body>"
append contentGetState "<u:GetTransportInfo xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\">"
append contentGetState "<InstanceID>0</InstanceID>"
append contentGetState "</u:GetTransportInfo>"
append contentGetState "</s:Body>"
append contentGetState "</s:Envelope>"

set chan [socket $address $port]
puts $chan $contentGetState
flush $chan         
puts "[gets $chan]"

while {[gets $chan line] >= 0} {
   set input [gets $chan]
   regexp "<CurrentTransportState>(.*?)</CurrentTransportState>" $input dummy getState
}
close $chan

puts $getState
Beispiel: Volume

Code: Alles auswählen

#!/usr/bin/tclsh
set address "192.168.1.20"
set port "8080"

set getValue ""
set adresslength [string length $address]

set contentGetState "POST /RenderingControl/ctrl HTTP/1.1\n"
append contentGetState "HOST: $address:$port\n"
append contentGetState "SOAPACTION: \"urn:schemas-upnp-org:service:RenderingControl:1#GetVolume\"\n"
append contentGetState "CONTENT-TYPE: text/xml; charset=\"utf-8\"\n"
append contentGetState "Content-Length: [expr $adresslength+365]\n"
append contentGetState "CONNECTION: close\n"
append contentGetState "\n"
append contentGetState "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
append contentGetState "<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
append contentGetState "<s:Body>"
append contentGetState "<u:GetVolume xmlns:u=\"urn:schemas-upnp-org:service:RenderingControl:1\">"
append contentGetState "<InstanceID>0</InstanceID>"
append contentGetState "<Channel>Master</Channel>"
append contentGetState "</u:GetVolume>"
append contentGetState "</s:Body>"
append contentGetState "</s:Envelope>"

set chan [socket $address $port]
puts $chan $contentGetState
flush $chan         
puts "[gets $chan]"

while {[gets $chan line] >= 0} {
   set input [gets $chan]   
   regexp "<CurrentVolume>(.*?)</CurrentVolume>" $input dummy getValue
}
close $chan

puts $getValue
[EDIT] Anpassung der letzten zwei Scripte

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 31.08.2013, 18:02
von tbu
Hallo Monty,

ich habe beide Beispiele getestet (IP-Adresse angepast) und komme nicht weiter.
Hier die Ausgaben Im WinSCP-Terminal:
__________________________

/usr/local/addons/sony_upnp$ tclsh Beispiel_PlayPLAYING_StopNO_MEDIA_PRESENTundPausePAUSED_PLAYBACK.tcl
CONTENT-LENGTH: 480
X-AV-Server-Info: av="5.0"; cn="Sony Corporation"; mn="SA-NS310"; mv="1.00"
EXT:

<s:Envelope
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<u:GetTransportInfoResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
<CurrentTransportStatus>OK</CurrentTransportStatus>
</u:GetTransportInfoResponse>
</s:Envelope>

OK
__________________________

/usr/local/addons/sony_upnp$ tclsh beispiel_volume.tcl
CONTENT-LENGTH: 359
X-AV-Server-Info: av="5.0"; cn="Sony Corporation"; mn="SA-NS310"; mv="1.00"
EXT:

<s:Envelope
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<u:GetVolumeResponse xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1">
</u:GetVolumeResponse>
</s:Envelope>

can't read "getValue": no such variable
while executing
"puts $getValue"
(file "beispiel_volume.tcl" line 35)
__________________________
Was ist hier noch falsch ?

Gruß tbu

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 01.09.2013, 11:12
von Monty1979
Hallo tbu,

ich habe die letzten zwei scripte nochmal angepasst.
Allerdings bin ich mehr am rätseln wie es richtig ist. Jetzt musste ich ein extra puts "[gets $chan]" (sonst wird das zurückgeben XML nicht richtig verarbeitet) und zusätzlich eine Initialisierung "set getState"der Ausgabe Variablen (falls der Wert nicht zurückkommt) einbauen.

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 01.09.2013, 13:50
von tbu
Hallo Monty,
ja, das funktioniert :)
Wie kommen die Werte jetzt wieder zurück in die HM-Variablen :?:
Gefunden und getestet habe ich schon:

Code: Alles auswählen

   #!/usr/bin/tclsh
    set address "192.168.1.20"
    set port "8080"

    set getValue ""
    set adresslength [string length $address]

    set contentGetState "POST /RenderingControl/ctrl HTTP/1.1\n"
    append contentGetState "HOST: $address:$port\n"
    append contentGetState "SOAPACTION: \"urn:schemas-upnp-org:service:RenderingControl:1#GetVolume\"\n"
    append contentGetState "CONTENT-TYPE: text/xml; charset=\"utf-8\"\n"
    append contentGetState "Content-Length: [expr $adresslength+365]\n"
    append contentGetState "CONNECTION: close\n"
    append contentGetState "\n"
    append contentGetState "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
    append contentGetState "<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
    append contentGetState "<s:Body>"
    append contentGetState "<u:GetVolume xmlns:u=\"urn:schemas-upnp-org:service:RenderingControl:1\">"
    append contentGetState "<InstanceID>0</InstanceID>"
    append contentGetState "<Channel>Master</Channel>"
    append contentGetState "</u:GetVolume>"
    append contentGetState "</s:Body>"
    append contentGetState "</s:Envelope>"

    set chan [socket $address $port]
    puts $chan $contentGetState
    flush $chan         
    puts "[gets $chan]"

    while {[gets $chan line] >= 0} {
       set input [gets $chan]   
       regexp "<CurrentVolume>(.*?)</CurrentVolume>" $input dummy getValue
    }
    close $chan

    puts $getValue
    #--------------------
    load tclrega.so
    set input $getValue
    #
    if { ![ catch { loadOnce tclrega.so } ] } {
        #tclrega.so available. Get Metadata from ReGaHss
       set isecmd ""
       append isecmd "var x = dom.GetObject('SonyVolumeKi');"
       append isecmd "x.State('"$input"');"
       rega_script $isecmd
    }

- läuft auch ohne Fehler durch, aber in der HM-Variablen 'SonyVolumeKi' landet nichts :?:



Gruß tbu

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 02.09.2013, 16:37
von Monty1979
Hallo tbu,

probiers mal so, bei x.State('$input'); müssen die "" raus und die Abfrage musste ich auch raus nehmen

Code: Alles auswählen

load tclrega.so
    set input $getValue
    #
   
        #tclrega.so available. Get Metadata from ReGaHss
       set isecmd ""
       append isecmd "var x = dom.GetObject('SonyVolumeKi');"
       append isecmd "x.State('$input');"
       rega_script $isecmd
   

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 02.09.2013, 16:39
von t_heinrich
Hallo,

überlege gerade ob ich 2x zuschlagen soll :D

http://www.ifun.de/sony-sa-ns410-guenst ... ion-45682/

EDIT äh heute Vormittag haben die noch 89 Euro gekostet, jetzt wieder 173 Euro :evil: :evil:

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 02.09.2013, 17:34
von Monty1979
Hallo,
t_heinrich hat geschrieben: EDIT äh heute Vormittag haben die noch 89 Euro gekostet, jetzt wieder 173 Euro :evil: :evil:
bei 89 hätte ich 3 genommen. Einen könnte ich noch gebrauchen und warte nur auf einen guten Preis. Die anderen 2 zum tauschen der 310'er die ich dann für 189 also 10 unterm aktuelle gebraucht tiefpreis verkauft hätte 8)

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 02.09.2013, 17:38
von t_heinrich
Oh man echt ärgerlich.
Falls ich was mitbekomme, meld ich mich; kannst du ja umgekehrt auch machen 8)

Re: Multiroom Audio mit HomeMatic und Sony

Verfasst: 02.09.2013, 22:15
von tbu
Hallo Monty,
Danke und viele Grüße :D
tbu