Multiroom Audio mit HomeMatic und Sony

User stellen ihre Haussteuerung vor

Moderator: Co-Administratoren

tbu
Beiträge: 14
Registriert: 13.02.2013, 23:18

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von tbu » 10.08.2013, 19:58

Hallo Monty,

vielen Dank für deine Skripte.
Das upnp.tcl läuft auf meiner CCU2 und ich habe erstmal die Funktionen Play, Stop, AVTransport eingerichtet. Für jede Funktion und Sender habe ich das Skript angepast und separat gespeichert.
(sony_play.tcl, sony_stop.tcl, sony_rtlradio.tcl, sony_radiodeutschland.tcl usw.)
Die Skripte starte ich über einzelne Programme in der CCU.
Das läuft schon super, die CCU verkraftet es ohne weiteres.

Mit dem party_streaming.tcl habe ich aber noch Probleme.
Die uuid´s meine LS habe ich gefunden und erst mal zwei Skripte angelegt:
Party-Start
- der LS der an der Party teilnehmen soll wird aus dem standby geweckt, nimmt aber nicht an der Party teil
Party-Abort
- keine Reaktion

jeweils mit (set uuidListenerList "uuid:5f9ec1b3-ed59-1900-4530-3c077100bc21,uuid:5f9ec1b3-ed59-1900-4530-5453edc29e48")


Für die einzelnen Funktionen würde ich gerne entsprechende Systemvariablen in der CCU anlegen und mit Mediola steuern, z.B.:
Systemvariable: RadioSender als Werteliste: rtlradio;ndr2;deutschlandfunk;...
Systemvariable: RadioParty als Logikwert: Start / Abort
Systemvariable: RadioMute als Logikwert: 1 / 0
Systemvariable: RadioVolume als Zahl: 0 bis 100
Systemvariable: RadioPlayStop als Logikwert: Play / Stop
usw.
Hast Du dafür auch noch eine Idee/Lösung?

Gruß tbu

Benutzeravatar
Monty1979
Beiträge: 854
Registriert: 28.10.2010, 20:47
Wohnort: Bremen
Kontaktdaten:

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von Monty1979 » 11.08.2013, 11:14

Hallo tbu,
tbu hat geschrieben:Mit dem party_streaming.tcl habe ich aber noch Probleme.
ich Tippe mal, dass du die Party falsch startest.

Es gibt zwei Möglichkeiten
1.) nur PartyHost starten um später einen PartyClient hinzuzufügen

Code: Alles auswählen

set address "192.168.1.20" # Adresse des PartyHost
set port "8080"
set action "Start"
set uuidListenerList "" # wird hier nicht gebraucht
einzelnen oder mehrere (Komma getrennt) PartyClients hinzufügen

Code: Alles auswählen

set address "192.168.1.20" # Adresse des PartyHost
set port "8080"
set action "Entry"
set uuidListenerList "uuid:5f9ec1b3-ed59-1900-4530-3c077101056d" # uuid des Client
2.) PartyHost Starten mit PartyClient

Code: Alles auswählen

set address "192.168.1.20" # Adresse des PartyHost
set port "8080"
set action "StartWithClient"
set uuidListenerList "uuid:5f9ec1b3-ed59-1900-4530-3c077101056d" # uuid des Client
tbu hat geschrieben:Für die einzelnen Funktionen würde ich gerne entsprechende Systemvariablen in der CCU anlegen und mit Mediola steuern, z.B.:
die Variablen kannst du im TCL auslesen mit

Code: Alles auswählen

#!/bin/tclsh
load tclrega.so

# Variablen Werte aus der CCU holen
array set values [rega_script { 
  var x1 = dom.GetObject('RadioSender').State();
  var x2 = dom.GetObject('RadioVolume').State();
} ]

# in TCL Variablen speichern
set x1 $values(x1)
set x2 $values(x2)

# Radio sender anhand der Variable x1 setzen
set value ""

if { $x1 == 0 } {
	append value "local://192.168.1.20/a/proc/bivl1...."
} elseif { $x1 == 1 } {
	append value "local://192.168.1.20/a/proc/bivl2...."
} else {
	append value "local://192.168.1.20/a/proc/bivl3...."
}

# zum Testen anzeigen
puts $x1
puts $value
puts $x2
Gruß Monty

tbu
Beiträge: 14
Registriert: 13.02.2013, 23:18

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von tbu » 11.08.2013, 13:28

Hallo Monty,

ok, das teste ich, erstmal recht vielen Dank :)
Was hällst Du denn selber von dieser Lösung per TCL ohne Home24-Mediaplayer :?:

Gruß tbu

Arminhh
Beiträge: 284
Registriert: 09.05.2011, 09:18

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von Arminhh » 11.08.2013, 13:37

Hallo Monty,
super Lösung die Du da erarbeitet hast. Ich hatte das Glück einen NS510 für sage und schreibe 150 € beim Mediamarkt zu bekommen.
Die ersten 2 Seiten bis zum TCL script kann ich ich noch nachvollziehen und funktioniert auch soweit ich das mit einem Lautsprecher testen kann. Ich finde es auch sehr reizvoll ohne den Umweg über den Mediaplayer das mit dem TCL Script zu verwirklichen. Das hat den Grund das der Mediaplayer bei mir auf dem Handy läuft und das Handy nicht immer zu hause ist!
Könntet Ihr bitte mal für Anfänger die Lösung mit dem TCL Script erklären!
mfg
Armin

Benutzeravatar
Monty1979
Beiträge: 854
Registriert: 28.10.2010, 20:47
Wohnort: Bremen
Kontaktdaten:

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von Monty1979 » 11.08.2013, 14:02

Hallo tbu,

könnte jetzt nicht sagen was besser ist oder nicht. Am Ende kommt aufs gleiche raus, beides läuft.

Die TCLs müsste man jetzt nur noch so individuell anpassen das man so wenig wie möglich die System.Exec bzw. CUxD.CUX2801001:1.CMD_EXEC braucht.
Nicht das sonst die CCU wieder steht. also zB. ein TCL mit AVTransport, Play, und Party StartWithClient in einem
Aktuell weiß ich auch nicht was die CCU macht wenn mal ein LS nicht erreichbar ist. Bei meinem Test hat es sie nicht gestört aber auf dauer muss man dann erst mal in der Praxis sehen.

Und über die App ist es vielleicht für HM Anfänger, ohne ssh oder tcl Kenntnis, etwas was einfacher einzurichten.
Verbindungsprobleme zum Tab fängt hier ja CUxD ab und zum LS die App.

Gruß Monty

Benutzeravatar
Monty1979
Beiträge: 854
Registriert: 28.10.2010, 20:47
Wohnort: Bremen
Kontaktdaten:

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von Monty1979 » 11.08.2013, 14:25

Hallo Arminhh,
Arminhh hat geschrieben:Könntet Ihr bitte mal für Anfänger die Lösung mit dem TCL Script erklären!
ich fange mal von vorne an. Wenn das die falsche Antwort war einfach nochmal melden

1.) in der TCL die IP usw. an deinen LS anpassen
2.) per WinSCP oder so. die TCL auf deine CCU kopieren, z.B. nach /usr/local/etc/config/addons/www/
3.) auf CCU legst du ein Programm an in dem du ein Script ausführst. In das Script muss du wenn du CUxD installiert hast vollgendes schreiben

Code: Alles auswählen

dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State("tclsh /usr/local/etc/config/addons/www/upnp.tcl");
mehr ist das eigentlich nicht.

Wie du die AVTransportUri fürs TCL (set value "")) herausfindest, habe ich hier erklärt

Gruß Monty

Arminhh
Beiträge: 284
Registriert: 09.05.2011, 09:18

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von Arminhh » 11.08.2013, 16:29

Hallo Monty,
danke für die schnelle Antwort!! Das ist soweit klar, aber wie werden die einzelnen Variablen angesprochen? Ich meine Stop, Play Volume usw
mfg
Armin

Benutzeravatar
Monty1979
Beiträge: 854
Registriert: 28.10.2010, 20:47
Wohnort: Bremen
Kontaktdaten:

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von Monty1979 » 11.08.2013, 17:20

Hallo Arminhh,

achso am einfachsten bei action "Play" bzw "Stop" eintragen und jeweils ein TCL dafür speichern.

Du könntest es so wie tbu hier im unter teil des Posts und hier meine Antwort zu seiner Frage, machen.

Mal noch ein Beispiel mit zwei Variablen auf der CCU "Wohnzimmer" mit der IP des LS und "RadioAction" wo Play drin steht

Code: Alles auswählen

#!/bin/tclsh

load tclrega.so

# Variablen Werte aus der CCU holen
array set values [rega_script { 
  var hm_address = dom.GetObject('Wohnzimmer').State();
  var hm_action = dom.GetObject('RadioAction').State();
} ]

set address $values(hm_address)
set port "8080"

# SetVolume
# SetMute - 0/1
# Play
# Stop
# Pause 
# AVTransport - local://192.168.199.223/a/proc/bivl2129%3aa%60local%230%7e4%5elocal%60%230%7e7%5e18898
set action $values(hm_action)
set value "local://192.168.199.223/a/proc/bivl2129%3aa%60local%230%7e4%5elocal%60%230%7e7%5e18898"

######################
#ab hier nichts ändern
######################

set length [string length $value]
set content ""

if { $action == "SetVolume" } {

	append content "POST /RenderingControl/ctrl HTTP/1.1\n"
	append content "HOST: $address:$port\n"
	append content "SOAPACTION: \"urn:schemas-upnp-org:service:RenderingControl:1#SetVolume\"\n"
	append content "CONTENT-TYPE: text/xml; charset=\"utf-8\"\n"
	append content "Content-Length: [expr $length+404]\n"
	append content "CONNECTION: close\n"
	append content "\n"
	append content "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
	append content "<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
	append content "<s:Body>"
	append content "<u:SetVolume xmlns:u=\"urn:schemas-upnp-org:service:RenderingControl:1\">"
	append content "<InstanceID>0</InstanceID>"
	append content "<Channel>Master</Channel>"
	append content "<DesiredVolume>$value</DesiredVolume>"
    append content "</u:SetVolume>"
   	append content "</s:Body>"
	append content "</s:Envelope>"
    
} elseif { $action == "SetMute" } {  	    

	append content "POST /RenderingControl/ctrl  HTTP/1.1\n"
	append content "HOST: $address:$port\n"
	append content "SOAPACTION: \"urn:schemas-upnp-org:service:RenderingControl:1#SetMute\"\n"
	append content "CONTENT-TYPE: text/xml; charset=\"utf-8\"\n"
	append content "Content-Length: 396\n"
	append content "CONNECTION: close\n"
	append content "\n"
	append content "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
	append content "<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
    append content "<s:Body>"
    append content "<u:SetMute xmlns:u=\"urn:schemas-upnp-org:service:RenderingControl:1\">"
	append content "<InstanceID>0</InstanceID>"
	append content "<Channel>Master</Channel>"
	append content "<DesiredMute>$value</DesiredMute>"
	append content "</u:SetMute>"
	append content "</s:Body>"
	append content "</s:Envelope>"
    
} elseif { $action == "Play" } {  	    

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

} elseif { $action == "Pause" } {  	    

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

} elseif { $action == "Stop" } {  	    

	append content "POST /AVTransport/ctrl HTTP/1.1\n"
	append content "HOST: $address:$port\n"
	append content "SOAPACTION: \"urn:schemas-upnp-org:service:AVTransport:1#Stop\"\n"
	append content "CONTENT-TYPE: text/xml; charset=\"utf-8\"\n"
	append content "Content-Length: 329\n"
	append content "CONNECTION: close\n"
	append content "\n"
	append content "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
	append content "<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
   	append content "<s:Body>"
	append content "<u:Stop xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\">"
	append content "<InstanceID>0</InstanceID>"
	append content "</u:Stop>"
	append content "</s:Body>"
	append content "</s:Envelope>"
    
} elseif { $action == "AVTransport" } {  	    

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



if { $action != "" } {
  
  set chan [socket $address $port]
  puts $chan $content
  flush $chan     
  close $chan  
}

Gruß Monty

Ps. Die TCL sind nur Beispiele wie ihr es an die LS senden könnt.

tbu
Beiträge: 14
Registriert: 13.02.2013, 23:18

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von tbu » 18.08.2013, 18:01

Hallo Monty,

ich habe noch ein kleines Problem mit Volume.
Habe eine CCU-Systemvariable "SonyVolume" vom Typ Zahl 0-100. Diese läst sich auch komfortabel über Mediola einstellen, nur das TCL-Skript funktioniert noch nicht.
Ich denke es leigt an den Nachkommastellen der Variable.

set value "25"
set action "SetVolume"

funktioniert, aber

load tclrega.so
array set values [rega_script {
var x1 = dom.GetObject('SonyVolume').State();
var x2 = dom.GetObject('SonySender').State();
} ]
set x1 $values(x1)
set x2 $values(x2)
set value x1
set action "SetVolume"

funktioniert nicht.
Kannst du helfen ?

Wo ist eigendlich "puts $x1" zu sehen ?

Gruß tbu

Benutzeravatar
Monty1979
Beiträge: 854
Registriert: 28.10.2010, 20:47
Wohnort: Bremen
Kontaktdaten:

Re: Multiroom Audio mit HomeMatic und Sony

Beitrag von Monty1979 » 19.08.2013, 09:24

Guten Morgen tbu,

da fehlt ein $ vor x1 bei "set value $x1" in deinem Script

Code: Alles auswählen

load tclrega.so
array set values [rega_script {
var x1 = dom.GetObject('SonyVolume').State();
var x2 = dom.GetObject('SonySender').State();
} ]
set x1 $values(x1)
set x2 $values(x2)
set value $x1
set action "SetVolume"
du kannst das auch so machen. SonyVolume direkt in value und zur Sicherheit noch eine Ganzzahlenumwandlung falls mal eine Kommazahlen in der Variable steht

Code: Alles auswählen

load tclrega.so
array set values [rega_script {
var x1 = dom.GetObject('SonyVolume').State().ToInteger();
var x2 = dom.GetObject('SonySender').State();
} ]
set value $values(x1)
set x2 $values(x2)
set action "SetVolume"
Wo ist eigendlich "puts $x1" zu sehen ?
das puts wird in der Console ausgegeben wenn du das TCL mit tclsh upnp.tcl aufrufst. Oder du nimmst hobbyquakers hq-webui und unter Entwicklung gibt's rechts ein Ausgabefenster.

Gruß Monty

Antworten

Zurück zu „Projektvorstellungen“