Dynamische Sprachausgabe mit Airplay wiedergeben

User stellen ihre Haussteuerung vor

Moderator: Co-Administratoren

Benutzeravatar
fraso
Beiträge: 47
Registriert: 05.12.2013, 16:17
Wohnort: 35083 Wetter
Kontaktdaten:

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von fraso » 06.12.2013, 00:55

Ok. Hier mein workaround - vllt. interessiert es jemanden.
Da ich nicht weiß wie man den ccu2 daemon nutzt hab ich ein workaround erstellt.
dazu nutze ich mein php server auf der meine webseiten laufen

ich habe dies auf dem php server hinzugefügt: http://phpseclib.sourceforge.net/ssh/intro.html
dann ein php geschrieben (das sample umgeschrieben) dass mit einer variable text übergeben
werden kann.

das php programm sendet dann mit dem ssh daemon meines webserver die befehle (airfoil anmachen,
say, etc.) an meinen macmini. das file dann noch mit passwort code versehen, sonst kann ja jeder
auf der ganzen welt im haus rumbabbeln...

zusammenfassung:
auf einenm php server die phpseclib reinkopieren.
das sample file anpassen
natürlich muss der MAC MINI den port 22 offen haben (portforwarding)

achja - auf dem mac mini muss noch SSH aktiviert werden. sonst kommt nix an.
anleitung hier: http://bluishcoder.co.nz/articles/mac-ssh.html

soweit babbelt jetzt mein mac mini auf airport express - und das mit ccu2

ich weiß - hingebastelt aber geht. ob das öffnen des port 22 auf der fritzbox so ne super idee ist weiß ich noch nicht so genau...

fraso
Homematic seit 11-2013 CCU2 ... es wächst und wächst
Meine Euphorie ist etwas der Realität gewichen - CCU und z.B. Homematic-Tür-Fensterkontakt HM-Sec-SC zu anfällig. Die machen mein CCU Leben zur Hölle.

Benutzeravatar
joni-blue
Beiträge: 1171
Registriert: 04.01.2012, 12:20
System: CCU
Wohnort: Hannover
Hat sich bedankt: 6 Mal
Danksagung erhalten: 1 Mal

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von joni-blue » 21.12.2013, 18:11

unlight hat geschrieben:Ich hoffe ich hab das was ihr vorhabt richtig verstanden, ansonsten bitte nicht gleich lynchen!:)

Alle Mac User können doch das recht akzeptable "say" auf dem Mac nutzen; mit der "Steffi" Stimme die in den Einstellungen zum Download angeboten wird lasse ich mir schon lange den Wetterbericht ansagen. Hab nix dran auszusetzen.
Falls ihr bereit seid Airfoil zu nutzen gibt es eine praktikable Lösung bei der die Komponenten noch nicht mal 24/7 laufen müssen.
Voraussetzung ist, dass "Entfernte Anmeldung" auf dem Mac eingeschaltet ist und dropbear auf der CCU installiert ist.


1.
Airport über Funksteckdose einschalten (entfällt bei Dauerbetrieb)

2.
Mac über CuxD Etherwake wecken

3.
Warten bis Airport erreichbar ist (ca. 60sek?) (entfällt bei Dauerbetrieb)

4.
Ein kleines Skript auf dem Mac über Dropbear starten welches Lautstärke und Audiosource von Airfoil stellt (kann ich posten wenn gewünscht)

5.
String im WebUI zusammensetzen und über Dropbear an Mac geben und vorlesen lassen z.B.

string ansage = "Dieser Text wird gleich vorgelesen und sollte bei Anwesenheit von Kleinkindern keine Schimpfwoerter enthalten";
string befehl = "sh -c 'export DROPBEAR_PASSWORD=MACPASSWORT; /usr/local/addons/dropbear/dbclient USERNAMEMAC@IPDESCOMPUTERS/22 -y say "#ansage#" '";
dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State(befehl);



Gruß
Unlight
wie hast du das gelöst?

sobald ein ä ö oder ü im text enthalten ist spielt der mac die ansage nicht mehr ab!!!

bei bewölkt wenn es abgerufen wird ist ja ein ö drinnen also fällt der text schonmal aus!

vilen dank für deine Hilfe
Reboot tut gut ! ! !

Benutzeravatar
unlight
Beiträge: 484
Registriert: 23.12.2012, 13:03
Wohnort: Ruhrpott

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von unlight » 23.12.2013, 20:53

Gute Frage, nächste Frage!

Ich hab das gar nicht gelöst weil ich es so ja gar nicht nutze. Lediglich die Ansteuerung des Mac von der CCU aus nutze ich schon lang, das mit dem say befehl war nur ein Vorschlag, den ich kurz ausprobiert hab.
Für die Wetteransage hab ich ein Script auf dem Mac welches sich den aktuellen Wetterbericht für unsere Stadt aus einer Website raussucht und vorliest, von daher brauch ich die CCU dafür nicht.

Schicke Weihnachtstage
Unlight
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”

Benutzeravatar
joni-blue
Beiträge: 1171
Registriert: 04.01.2012, 12:20
System: CCU
Wohnort: Hannover
Hat sich bedankt: 6 Mal
Danksagung erhalten: 1 Mal

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von joni-blue » 23.12.2013, 23:50

unlight hat geschrieben:Gute Frage, nächste Frage!

Ich hab das gar nicht gelöst weil ich es so ja gar nicht nutze. Lediglich die Ansteuerung des Mac von der CCU aus nutze ich schon lang, das mit dem say befehl war nur ein Vorschlag, den ich kurz ausprobiert hab.
Für die Wetteransage hab ich ein Script auf dem Mac welches sich den aktuellen Wetterbericht für unsere Stadt aus einer Website raussucht und vorliest, von daher brauch ich die CCU dafür nicht.

Schicke Weihnachtstage
Unlight
Kannst du das Mac Wetter script mal posten?


Sent from my iPad using Tapatalk
Reboot tut gut ! ! !

Benutzeravatar
unlight
Beiträge: 484
Registriert: 23.12.2012, 13:03
Wohnort: Ruhrpott

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von unlight » 24.12.2013, 07:40

Mein eigentliches script beinhaltet noch faden der Musik, weil ich die im Hintergrund weiterlaufen lasse:

Code: Alles auswählen

property tick : 2 -- raise volume level by this many each loop
property thismany : 0.1 -- seconds to wait before making next increment to volume
global returner
global vol

set vol to 80

on appIsRunning(appname)
	tell application "System Events" to (name of processes) contains appname
end appIsRunning
tell application "Safari" to open location "http://www.wetter.net/319/Duisburg"
delay 15
set theSource to ""
tell application "Safari" to set theSource to the text of document 1
set AppleScript's text item delimiters to {"Wettervorhersage für heute"}
set theText to text item 2 of theSource
set AppleScript's text item delimiters to {"Wetterbericht der nächsten Tage"}
set myText to text item 1 of theText
set AppleScript's text item delimiters to {""}

tell application "Safari" to quit
if appIsRunning("Airfoil") then
	
	tell application "/Applications/Airfoil.app"
		set returner to (get name of current audio source)
		if (get name of current audio source) is "iTunes" then
			tell application "iTunes"
				if (get sound volume) is less than 50 then
					repeat
						if (get sound volume) is greater than 50 - 5 then
							set sound volume to 50
							exit repeat
						end if
						set sound volume to (sound volume + tick)
						delay thismany
					end repeat
				else if (get sound volume) is greater than 50 then
					repeat
						if (get sound volume) is less than 50 + 5 then
							set sound volume to 50
							exit repeat
						end if
						set sound volume to (sound volume - tick)
						delay thismany
					end repeat
				end if
			end tell
			set volume output volume 45
		else if (get name of current audio source) is "Spotify" then
			tell application "Spotify"
				if (get sound volume) is less than 50 then
					repeat
						if (get sound volume) is greater than 50 - 5 then
							set sound volume to 50
							exit repeat
						end if
						set sound volume to (sound volume + tick)
						delay thismany
					end repeat
				else if (get sound volume) is greater than 50 then
					repeat
						if (get sound volume) is less than 50 + 5 then
							set sound volume to 50
							exit repeat
						end if
						set sound volume to (sound volume - tick)
						delay thismany
					end repeat
				end if
			end tell
		end if
		set volume output volume 45
		set aSource to first system source
		set current audio source to aSource
	end tell
	
	say myText
	
	tell application "/Applications/Airfoil.app"
		if returner is "iTunes" then
			tell application "iTunes"
				if (get sound volume) is less than vol then
					repeat
						if (get sound volume) is greater than vol - 5 then
							set sound volume to vol
							exit repeat
						end if
						set sound volume to (sound volume + tick)
						delay thismany
					end repeat
				else if (get sound volume) is greater than vol then
					repeat
						if (get sound volume) is less than vol + 5 then
							set sound volume to vol
							exit repeat
						end if
						set sound volume to (sound volume - tick)
						delay thismany
					end repeat
				end if
			end tell
			set aSource to make new application source
			set application file of aSource to "/Applications/iTunes.app"
			set current audio source to aSource
			
		else if returner is "Spotify" then
			tell application "Spotify"
				if (get sound volume) is less than vol then
					repeat
						if (get sound volume) is greater than vol - 5 then
							set sound volume to vol
							exit repeat
						end if
						set sound volume to (sound volume + tick)
						delay thismany
					end repeat
				else if (get sound volume) is greater than vol then
					repeat
						if (get sound volume) is less than vol + 5 then
							set sound volume to vol
							exit repeat
						end if
						set sound volume to (sound volume - tick)
						delay thismany
					end repeat
				end if
			end tell
			set aSource to make new application source
			set application file of aSource to "/Applications/Spotify.app"
			set current audio source to aSource
		end if
	end tell
	set volume output volume 30
end if
Als eigentliches Wetterscript müsste aber das hier reichen:

Code: Alles auswählen

tell application "Safari" to open location "http://www.wetter.net/319/Duisburg"
delay 15
set theSource to ""
tell application "Safari" to set theSource to the text of document 1
set AppleScript's text item delimiters to {"Wettervorhersage für heute"}
set theText to text item 2 of theSource
set AppleScript's text item delimiters to {"Wetterbericht der nächsten Tage"}
set myText to text item 1 of theText
set AppleScript's text item delimiters to {""}
tell application "Safari" to quit
say myText
Den passenden Link zur Stadt muss man natürlich ändern!

Gruß
Unlight
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”

Benutzeravatar
joni-blue
Beiträge: 1171
Registriert: 04.01.2012, 12:20
System: CCU
Wohnort: Hannover
Hat sich bedankt: 6 Mal
Danksagung erhalten: 1 Mal

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von joni-blue » 04.04.2014, 23:50

unlight hat geschrieben:Mein eigentliches script beinhaltet noch faden der Musik, weil ich die im Hintergrund weiterlaufen lasse:

Code: Alles auswählen

property tick : 2 -- raise volume level by this many each loop
property thismany : 0.1 -- seconds to wait before making next increment to volume
global returner
global vol

set vol to 80

on appIsRunning(appname)
	tell application "System Events" to (name of processes) contains appname
end appIsRunning
tell application "Safari" to open location "http://www.wetter.net/319/Duisburg"
delay 15
set theSource to ""
tell application "Safari" to set theSource to the text of document 1
set AppleScript's text item delimiters to {"Wettervorhersage für heute"}
set theText to text item 2 of theSource
set AppleScript's text item delimiters to {"Wetterbericht der nächsten Tage"}
set myText to text item 1 of theText
set AppleScript's text item delimiters to {""}

tell application "Safari" to quit
if appIsRunning("Airfoil") then
	
	tell application "/Applications/Airfoil.app"
		set returner to (get name of current audio source)
		if (get name of current audio source) is "iTunes" then
			tell application "iTunes"
				if (get sound volume) is less than 50 then
					repeat
						if (get sound volume) is greater than 50 - 5 then
							set sound volume to 50
							exit repeat
						end if
						set sound volume to (sound volume + tick)
						delay thismany
					end repeat
				else if (get sound volume) is greater than 50 then
					repeat
						if (get sound volume) is less than 50 + 5 then
							set sound volume to 50
							exit repeat
						end if
						set sound volume to (sound volume - tick)
						delay thismany
					end repeat
				end if
			end tell
			set volume output volume 45
		else if (get name of current audio source) is "Spotify" then
			tell application "Spotify"
				if (get sound volume) is less than 50 then
					repeat
						if (get sound volume) is greater than 50 - 5 then
							set sound volume to 50
							exit repeat
						end if
						set sound volume to (sound volume + tick)
						delay thismany
					end repeat
				else if (get sound volume) is greater than 50 then
					repeat
						if (get sound volume) is less than 50 + 5 then
							set sound volume to 50
							exit repeat
						end if
						set sound volume to (sound volume - tick)
						delay thismany
					end repeat
				end if
			end tell
		end if
		set volume output volume 45
		set aSource to first system source
		set current audio source to aSource
	end tell
	
	say myText
	
	tell application "/Applications/Airfoil.app"
		if returner is "iTunes" then
			tell application "iTunes"
				if (get sound volume) is less than vol then
					repeat
						if (get sound volume) is greater than vol - 5 then
							set sound volume to vol
							exit repeat
						end if
						set sound volume to (sound volume + tick)
						delay thismany
					end repeat
				else if (get sound volume) is greater than vol then
					repeat
						if (get sound volume) is less than vol + 5 then
							set sound volume to vol
							exit repeat
						end if
						set sound volume to (sound volume - tick)
						delay thismany
					end repeat
				end if
			end tell
			set aSource to make new application source
			set application file of aSource to "/Applications/iTunes.app"
			set current audio source to aSource
			
		else if returner is "Spotify" then
			tell application "Spotify"
				if (get sound volume) is less than vol then
					repeat
						if (get sound volume) is greater than vol - 5 then
							set sound volume to vol
							exit repeat
						end if
						set sound volume to (sound volume + tick)
						delay thismany
					end repeat
				else if (get sound volume) is greater than vol then
					repeat
						if (get sound volume) is less than vol + 5 then
							set sound volume to vol
							exit repeat
						end if
						set sound volume to (sound volume - tick)
						delay thismany
					end repeat
				end if
			end tell
			set aSource to make new application source
			set application file of aSource to "/Applications/Spotify.app"
			set current audio source to aSource
		end if
	end tell
	set volume output volume 30
end if
Als eigentliches Wetterscript müsste aber das hier reichen:

Code: Alles auswählen

tell application "Safari" to open location "http://www.wetter.net/319/Duisburg"
delay 15
set theSource to ""
tell application "Safari" to set theSource to the text of document 1
set AppleScript's text item delimiters to {"Wettervorhersage für heute"}
set theText to text item 2 of theSource
set AppleScript's text item delimiters to {"Wetterbericht der nächsten Tage"}
set myText to text item 1 of theText
set AppleScript's text item delimiters to {""}
tell application "Safari" to quit
say myText
Den passenden Link zur Stadt muss man natürlich ändern!

Gruß
Unlight
kannst du spotify noch mit applescript steuern? bei mir sagt er bei volume im einen fehler

Code: Alles auswählen

error "Die Variable „volume“ ist nicht definiert." number -2753 from "volume"
Reboot tut gut ! ! !

Benutzeravatar
unlight
Beiträge: 484
Registriert: 23.12.2012, 13:03
Wohnort: Ruhrpott

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von unlight » 05.04.2014, 07:52

Bei mir gehts noch!
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”

Benutzeravatar
joni-blue
Beiträge: 1171
Registriert: 04.01.2012, 12:20
System: CCU
Wohnort: Hannover
Hat sich bedankt: 6 Mal
Danksagung erhalten: 1 Mal

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von joni-blue » 05.04.2014, 09:30

unlight hat geschrieben:Bei mir gehts noch!
kannst du mir mal deine aktuellen applescripts zur Verfügung stellen? Musste man irgendwas bestimmtes beachten? Einstellungen? Eigentlich nicht oder ???


Sent from my iPhone using Tapatalk
Reboot tut gut ! ! !

Benutzeravatar
unlight
Beiträge: 484
Registriert: 23.12.2012, 13:03
Wohnort: Ruhrpott

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von unlight » 05.04.2014, 13:25

Bin im Moment im Urlaub. Danach gerne!

Gesendet von meinem HUAWEI Y300-0100 mit Tapatalk
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”

Benutzeravatar
joni-blue
Beiträge: 1171
Registriert: 04.01.2012, 12:20
System: CCU
Wohnort: Hannover
Hat sich bedankt: 6 Mal
Danksagung erhalten: 1 Mal

Re: Dynamische Sprachausgabe mit Airplay wiedergeben

Beitrag von joni-blue » 05.04.2014, 13:28

unlight hat geschrieben:Bin im Moment im Urlaub. Danach gerne!

Gesendet von meinem HUAWEI Y300-0100 mit Tapatalk
Danke


Sent from my iPad using Tapatalk
Reboot tut gut ! ! !

Antworten

Zurück zu „Projektvorstellungen“