std hat geschrieben: 3. September 2017 11:32
Und bei Geräten die das unterstützen, wie mein AVR: Alexa stelle AV-Receiver auf Lautstärke 50"
Das würde aber grundsätzlich überhaupt erst mal Voraus setzten das die AVR über IP gesteuert wird sonst kann das nicht funktionieren da dem Logitech Hub die Lautstärke ja gar nicht bekannt ist über IR. Mit einem eigenen Custom Skill ist das aber jetzt schon möglich.
Sieht bei mir z.B. so aus
Code: Alles auswählen
<?
use Patami\IPS\System\IPS;
function Execute(Request $request)
{
$deviceId = $request->GetDeviceId(); // Device ID auslesen
if($request->IsLaunchRequest())
{
$text = 'Dies war der Launch Intent von Harmony aufgerufen von'.$deviceId;
}
$action = strtolower($request->slots->HarmonyAction);
$radiostation = strtolower($request->slots->RadioStation);
$tvchannel = strtolower($request->slots->TVChannel);
$command = strtolower($request->slots->HarmonyCommand);
$volume = strtolower($request->slots->Volume);
if($volume != "")
{
$text = SetVolume($volume);
}
if($action != "" && $command == "ein")
{
$text = SetHarmonyAction($action);
}
if($action != "" && $command == "aus")
{
$text = SetPowerOff();
}
if($command == "stumm" || $command == "laut")
{
$text = SetMute($command);
}
if($command == "starte" || $command == "play" || $command == "starten")
{
$text = Play();
}
if($command == "pause" || $command == "pausiere" || $command == "pausieren")
{
$text = Pause();
}
if($radiostation != "")
{
$text = SwitchRadioStation($radiostation);
}
if($tvchannel != "")
{
$text = SwitchChannel($tvchannel);
}
// Tell the user
return TellResponse::CreatePlainText(
$text
)->SetSimpleCard(
'IP-Symcon Harmony',
$text
);
}
function SwitchChannel($tvchannel)
{
if($tvchannel == "zdf" || $tvchannel == "z. d. f." || $tvchannel == "zweites deutsches fernsehen")
{
Enigma2BY_ZapTo(20229 /*[Geräte\Heimkino\Video\Dreambox\Dreambox 8000 Wohnzimmer]*/, 'ZDF HD');
$text = "Es wird auf ZDF umgeschaltet.";
}
elseif($tvchannel == "ard" || $tvchannel == "a. r. d." || $tvchannel == "das erste")
{
Enigma2BY_ZapTo(20229 /*[Geräte\Heimkino\Video\Dreambox\Dreambox 8000 Wohnzimmer]*/, 'Das Erste HD');
$text = "Es wird auf ARD umgeschaltet.";
}
elseif($tvchannel == "bayern 3" || $tvchannel == "b. r. drei" || $tvchannel == "bayern drei" || $tvchannel == "br 3")
{
Enigma2BY_ZapTo(20229 /*[Geräte\Heimkino\Video\Dreambox\Dreambox 8000 Wohnzimmer]*/, 'BR Nord HD');
$text = "Es wird auf Bayern 3 umgeschaltet.";
}
elseif($tvchannel == "hessen 3" || $tvchannel == "h. r. drei" || $tvchannel == "hessen drei" || $tvchannel == "hr 3")
{
Enigma2BY_ZapTo(20229 /*[Geräte\Heimkino\Video\Dreambox\Dreambox 8000 Wohnzimmer]*/, 'hr-fernsehen');
$text = "Es wird auf Hessen Drei umgeschaltet.";
}
elseif($tvchannel == "rtl" || $tvchannel == "r. t. l.")
{
Enigma2BY_ZapTo(20229 /*[Geräte\Heimkino\Video\Dreambox\Dreambox 8000 Wohnzimmer]*/, 'RTL Television');
$text = "Es wird auf RTL umgeschaltet.";
}
elseif($tvchannel == "pro 7" || $tvchannel == "pro sieben")
{
Enigma2BY_ZapTo(20229 /*[Geräte\Heimkino\Video\Dreambox\Dreambox 8000 Wohnzimmer]*/, 'ProSieben');
$text = "Es wird auf Pro 7 umgeschaltet.";
}
elseif($tvchannel == "sat 1" || $tvchannel == "sat eins")
{
Enigma2BY_ZapTo(20229 /*[Geräte\Heimkino\Video\Dreambox\Dreambox 8000 Wohnzimmer]*/, 'SAT.1');
$text = "Es wird auf SAT 1 umgeschaltet.";
}
elseif($tvchannel == "kika")
{
Enigma2BY_ZapTo(20229 /*[Geräte\Heimkino\Video\Dreambox\Dreambox 8000 Wohnzimmer]*/, 'KiKA HD');
$text = "Es wird auf KiKa umgeschaltet.";
}
elseif($tvchannel == "disney channel")
{
Enigma2BY_ZapTo(20229 /*[Geräte\Heimkino\Video\Dreambox\Dreambox 8000 Wohnzimmer]*/, 'Disney Channel');
$text = "Es wird auf Disney Channel umgeschaltet.";
}
return $text;
}
function SwitchRadioStation($radiostation)
{
$text = "Es wird der Radiosender ".$radiostation." abgespielt.";
return $text;
}
function SetHarmonyAction($action)
{
if($action == "FireTV") // Amazon Prime
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 11697675);
}
elseif($action == "Apple TV") // Apple TV
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 11697760);
}
elseif($action == "Fernsehen") // Fernsehen
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 11697506);
}
elseif($action == "Plex") // Film anschauen
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 12491805);
}
elseif($action == "Leinwand Fire TV") // Film FTV Leinwand
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 11746407);
}
elseif($action == "Leinwand Movie") // Film Leinwand
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 12491850);
}
elseif($action == "Sonos Küche") // Sonos Küche
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 11738612);
}
elseif($action == "Spielen") // Spielen
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 16188673);
}
elseif($action == "Leinwand TV") // TV Leinwand
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 11768391);
}
elseif($action == "Sonos Wohnzimmer") // Wohnzimmer
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, 11738662);
}
$text = "Die Harmony Aktion ".$action." wurde gestartet";
return $text;
}
function SetPowerOff()
{
HarmonyHub_startActivity(15550 /*[Logitech Harmony Hub Wohnzimmer]*/, -1); // Power Off
$text = "Es wurden alle Aktionen beendet";
}
function SetVolume($volume)
{
$Value = ((98 / 100) * $volume) - 80;
$Valueround = round($Value * 2) / 2;
DAVRT_MasterVolumeFix(30505 /*[Geräte\Heimkino\Audio\Denon\Denon AV 4311 Mainzone]*/, $Valueround);
$text = "Die Lautstärke wurde auf ".$volume." Prozent eingestellt";
return $text;
}
function Play()
{
$action = GetValue(48772 /*[Logitech Harmony Hub Wohnzimmer\Harmony Activity]*/);
if($action == 11697506 || $action == 11768391) // Fernsehen
{
LHD_Send(56749 /*[Geräte\Heimkino\Harmony\Harmony Geräte\Logitech Wohnzimmer-Hub (192.168.55.68)\Dream Multimedia-DVR]*/, "Play");
$text = "Es wurde gestartet";
}
elseif($action == 11697675 || $action == 11746407) // Fire TV
{
LHD_Send(59474 /*[Geräte\Heimkino\Harmony\Harmony Geräte\Logitech Wohnzimmer-Hub (192.168.55.68)\Amazon Fire TV]*/, "Play");
$text = "Es wurde die Wiedergabe auf dem Fire TV gestartet";
}
elseif($action == 11697760) // Apple TV
{
LHD_Send(21716 /*[Geräte\Heimkino\Harmony\Harmony Geräte\Logitech Wohnzimmer-Hub (192.168.55.68)\Apple TV]*/, "Play");
$text = "Es wurde die Wiedergabe auf dem Apple TV gestartet";
}
elseif($action == 12491805 || $action == 12491850) // Plex
{
LHD_Send(27347 /*[Geräte\Heimkino\Harmony\Harmony Geräte\Logitech Wohnzimmer-Hub (192.168.55.68)\Flirc-Media Player]*/, "Play");
$text = "Es wurde die Wiedergabe auf Plex gestartet";
}
else
{
$text = "Es ist keine Harmony Aktion aktiv.";
}
return $text;
}
function Pause()
{
$action = GetValue(48772 /*[Logitech Harmony Hub Wohnzimmer\Harmony Activity]*/);
if($action == 11697506 || $action == 11768391) // Fernsehen
{
LHD_Send(56749 /*[Geräte\Heimkino\Harmony\Harmony Geräte\Logitech Wohnzimmer-Hub (192.168.55.68)\Dream Multimedia-DVR]*/, "Pause");
$text = "Es wird das Fernsehen pausiert";
}
elseif($action == 11697675 || $action == 11746407) // Fire TV
{
LHD_Send(59474 /*[Geräte\Heimkino\Harmony\Harmony Geräte\Logitech Wohnzimmer-Hub (192.168.55.68)\Amazon Fire TV]*/, "Pause");
$text = "Es wird der Fire TV pausiert";
}
elseif($action == 11697760) // Apple TV
{
LHD_Send(21716 /*[Geräte\Heimkino\Harmony\Harmony Geräte\Logitech Wohnzimmer-Hub (192.168.55.68)\Apple TV]*/, "Pause");
$text = "Es wird der Apple TV pausiert";
}
elseif($action == 12491805 || $action == 12491850) // Plex
{
LHD_Send(27347 /*[Geräte\Heimkino\Harmony\Harmony Geräte\Logitech Wohnzimmer-Hub (192.168.55.68)\Flirc-Media Player]*/, "Pause");
$text = "Es wird Plex pausiert";
}
else
{
$text = "Es ist keine Harmony Aktion aktiv.";
}
return $text;
}
function SetMute($command)
{
if ($command == "stumm")
{
// Stumm stellen
DAVRT_MainMute(30505 /*[Geräte\Heimkino\Audio\Denon\Denon AV 4311 Mainzone]*/, true);
}
elseif ($command == "laut")
{
// Laut stellen
DAVRT_MainMute(30505 /*[Geräte\Heimkino\Audio\Denon\Denon AV 4311 Mainzone]*/, false);
}
$text = "Die Lautstärke wurde auf ".$command." gestellt";
return $text;
}
Damit wird wenn Volume übergeben wird der AVR direkt über IP geschaltet. Die Sender schalte ich nicht über Harmony sondern die Dreambox, das starten und stoppen geht auch. Das einzige was gesetzt wird sind die Harmony Aktionen. Ansonsten gehen Befehle direkt an die Geräte wenn diese per IP steuerbar sind.