From db7d06fe2411ac307f4a265e82bbba8ffa808a99 Mon Sep 17 00:00:00 2001 From: ESERA-Automation Date: Thu, 30 Aug 2018 15:21:56 +0200 Subject: [PATCH 1/2] update AUdiomax --- AudioMax Multiroom System/module.php | 180 ++++++++++++++------------- 1 file changed, 91 insertions(+), 89 deletions(-) diff --git a/AudioMax Multiroom System/module.php b/AudioMax Multiroom System/module.php index 2b6a046..631d3d3 100644 --- a/AudioMax Multiroom System/module.php +++ b/AudioMax Multiroom System/module.php @@ -4,72 +4,74 @@ class AudioMaxSystem extends IPSModule { public function Create(){ //Never delete this line! parent::Create(); - + //These lines are parsed on Symcon Startup or Instance creation //You cannot use variables here. Just static values. - //CreateVariableProfile($ProfileName, $ProfileType, $Suffix, $MinValue, $MaxValue, $StepSize, $Digits, $Icon,$Wert,$Name,$Color) - $this->CreateVariableProfile("ESERA.AMVolume",1,"%",0,40,1,0,"Intensity"); - $this->CreateVariableProfile("ESERA.AMGain",1,"%",0,15,1,0,"Intensity"); - $this->CreateVariableProfile("ESERA.AMTone",1,"%",0,15,1,0,"Intensity"); - $this->CreateVariableProfile("ESERA.AMBalance",1,"%",0,15,1,0,"Intensity"); - $this->CreateVariableProfile("ESERA.AMInput",1,"",1,4,1,0,""); - $this->CreateVariableProfile("ESERA.AMMute",0,"",0,1,1,0,"Power"); - - $this->CreateVariableAssociation("ESERA.AMInput", 1, "Input 1", "Light" , 0x00FF00); - $this->CreateVariableAssociation("ESERA.AMInput", 2, "Input 2", "Light" , 0x00FF00); - $this->CreateVariableAssociation("ESERA.AMInput", 3, "Input 3", "Light" , 0x00FF00); - $this->CreateVariableAssociation("ESERA.AMInput", 4, "Input 4", "Light" , 0x00FF00); - - $position = 1; - for($i = 1; $i <= 6; $i++){ - - $this->RegisterVariableinteger("volume".$i, "Volume ".$i, "ESERA.AMVolume"); - $this->EnableAction("volume".$i); - //$this->SetPosition("volume".$i, $position); - - $this->RegisterVariableinteger("gain".$i, "Gain ".$i, "ESERA.AMGain"); - $this->EnableAction("gain".$i); - $position = $position + 1; - //$this->SetPosition("gain".$i, $position); - - $this->RegisterVariableinteger("bass".$i, "Bass ".$i, "ESERA.AMTone"); - $this->EnableAction("bass".$i); - $position = $position + 1; - //$this->IPS_SetPosition("bass".$i, $position); - - $this->RegisterVariableinteger("mid".$i, "Middle ".$i, "ESERA.AMTone"); - $this->EnableAction("mid".$i); - $position = $position + 1; - //$this->SetPosition("mid".$i, $position); - - $this->RegisterVariableinteger("treble".$i, "Treble ".$i, "ESERA.AMTone"); - $this->EnableAction("treble".$i); - $position = $position + 1; - //$this->IPS_SetPosition("treble".$i, $position); - - $this->RegisterVariableinteger("balance".$i, "Balance ".$i, "ESERA.AMBalance"); - $this->EnableAction("balance".$i); - $position = $position + 1; - //$this->IPS_SetPosition("balance".$i, $position); - - $this->RegisterVariableBoolean("amp".$i, "Amplifier ".$i, "~Switch"); - $this->EnableAction("amp".$i); - $position = $position + 1; - //$this->IPS_SetPosition("amp".$i, $position); - - $this->RegisterVariableBoolean("mute".$i, "Mute Output ".$i, "~Switch"); - $this->EnableAction("mute".$i); - $position = $position + 1; - //$this->IPS_SetPosition("mute".$i, $position); - - $this->RegisterVariableInteger("input".$i, "Input ".$i, "ESERA.AMInput"); - $this->EnableAction("input".$i); - $position = $position + 1; - //$this->IPS_SetPosition("input".$i, $position); - } - - $this->ConnectParent("{C73DD44F-BF0D-4180-A0F1-D296F68024B2}"); //AudioMax Interface - + //CreateVariableProfile($ProfileName, $ProfileType, $Suffix, $MinValue, $MaxValue, $StepSize, $Digits, $Icon,$Wert,$Name,$Color) + $this->CreateVariableProfile("ESERA.AMVolume",1,"%",0,40,1,0,"Intensity"); + $this->CreateVariableProfile("ESERA.AMGain",1,"%",0,15,1,0,"Intensity"); + $this->CreateVariableProfile("ESERA.AMTone",1,"%",0,15,1,0,"Intensity"); + $this->CreateVariableProfile("ESERA.AMBalance",1,"%",0,15,1,0,"Intensity"); + $this->CreateVariableProfile("ESERA.AMInput",1,"",1,4,1,0,""); + $this->CreateVariableProfile("ESERA.AMMute",0,"",0,1,1,0,"Power"); + + $this->CreateVariableAssociation("ESERA.AMInput", 1, "Input 1", "Light" , 0x00FF00); + $this->CreateVariableAssociation("ESERA.AMInput", 2, "Input 2", "Light" , 0x00FF00); + $this->CreateVariableAssociation("ESERA.AMInput", 3, "Input 3", "Light" , 0x00FF00); + $this->CreateVariableAssociation("ESERA.AMInput", 4, "Input 4", "Light" , 0x00FF00); + + $position = 1; + + for($i = 1; $i <= 6; $i++){ + + $this->RegisterVariableinteger("volume".$i, "Volume ".$i, "ESERA.AMVolume"); + $this->EnableAction("volume".$i); + //$this->IPS_SetPosition(47381, $position); + //$this->SetPosition("volume".$i, $position); + + $this->RegisterVariableinteger("gain".$i, "Gain ".$i, "ESERA.AMGain"); + $this->EnableAction("gain".$i); + $position = $position + 1; + //$this->SetPosition("gain".$i, $position); + + $this->RegisterVariableinteger("bass".$i, "Bass ".$i, "ESERA.AMTone"); + $this->EnableAction("bass".$i); + $position = $position + 1; + //$this->IPS_SetPosition("bass".$i, $position); + + $this->RegisterVariableinteger("mid".$i, "Middle ".$i, "ESERA.AMTone"); + $this->EnableAction("mid".$i); + $position = $position + 1; + //$this->SetPosition("mid".$i, $position); + + $this->RegisterVariableinteger("treble".$i, "Treble ".$i, "ESERA.AMTone"); + $this->EnableAction("treble".$i); + $position = $position + 1; + //$this->IPS_SetPosition("treble".$i, $position); + + $this->RegisterVariableinteger("balance".$i, "Balance ".$i, "ESERA.AMBalance"); + $this->EnableAction("balance".$i); + $position = $position + 1; + //$this->IPS_SetPosition("balance".$i, $position); + + $this->RegisterVariableBoolean("amp".$i, "Amplifier ".$i, "~Switch"); + $this->EnableAction("amp".$i); + $position = $position + 1; + //$this->IPS_SetPosition("amp".$i, $position); + + $this->RegisterVariableBoolean("mute".$i, "Mute Output ".$i, "~Switch"); + $this->EnableAction("mute".$i); + $position = $position + 1; + //$this->IPS_SetPosition("mute".$i, $position); + + $this->RegisterVariableInteger("input".$i, "Input ".$i, "ESERA.AMInput"); + $this->EnableAction("input".$i); + $position = $position + 1; + //$this->IPS_SetPosition("input".$i, $position); + } + + $this->ConnectParent("{C73DD44F-BF0D-4180-A0F1-D296F68024B2}"); //AudioMax Interface + } public function Destroy(){ //Never delete this line! @@ -77,30 +79,30 @@ public function Destroy(){ } - + public function ApplyChanges(){ //Never delete this line! parent::ApplyChanges(); $this->SetReceiveDataFilter(".*\"DeviceType\":\"AUDIO\".*"); } - - + + public function ReceiveData($JSONString) { $data = json_decode($JSONString); $this->SendDebug("AudioMaxSystem", "| Room Number:" . $data->RoomNumber . "| Audio Type:" . $data->AudioType . "| Audio Value:" . $data->AudioValue, 0); - + $Number = intval($data->RoomNumber, 10); //Daten der übergebenen Variable //$Type = strval($data->AudioType,10); //Daten der übergebenen Variable $Type = $data->AudioType; $Value = intval($data->AudioValue,10); - + $this->SendDebug("DGB Rec| Room Number:", $Number, 0); $this->SendDebug("DGB Rec| Audio Type:", $Type, 0); $this->SendDebug("DGB Rec| Audio Value:", $Value, 0); - - + + if ($Type == "VOL"){ SetValue($this->GetIDForIdent("volume".$Number), $Value); $this->SendDebug(("volume ".$Number), $Value,0); @@ -112,7 +114,7 @@ public function ReceiveData($JSONString) { if ($Type == "GAI"){ SetValue($this->GetIDForIdent("gain".$Number), $Value); $this->SendDebug(("gain ".$Number), $Value,0); - } + } if ($Type == "BAS"){ SetValue($this->GetIDForIdent("bass".$Number), $Value); $this->SendDebug(("bass ".$Number), $Value,0); @@ -137,8 +139,8 @@ public function ReceiveData($JSONString) { SetValue($this->GetIDForIdent("mute".$Number), $Value); $this->SendDebug(("mute ".$Number), $Value,0); } - - + + /* if ($data->DeviceNumber == 2){ if ($data->DataPoint == 1){ @@ -149,12 +151,12 @@ public function ReceiveData($JSONString) { } } */ - + } public function RequestAction($Ident, $Value) { //$Number = 1; - + switch($Ident) { case "volume1": //$Number = 1; case "volume2": @@ -164,7 +166,7 @@ public function RequestAction($Ident, $Value) { case "volume6": $Type = "VOL"; $Number = SubStr($Ident, 6, 1); - break; + break; case "gain1": case "gain2": case "gain3": @@ -182,7 +184,7 @@ public function RequestAction($Ident, $Value) { case "input6": $Type = "INP"; $Number = SubStr($Ident, 5, 1); - break; + break; case "bass1": case "bass2": case "bass3": @@ -191,7 +193,7 @@ public function RequestAction($Ident, $Value) { case "bass6": $Type = "BAS"; $Number = SubStr($Ident, 4, 1); - break; + break; case "mid1": case "mid2": case "mid3": @@ -200,7 +202,7 @@ public function RequestAction($Ident, $Value) { case "mid6": $Type = "MID"; $Number = SubStr($Ident, 3, 1); - break; + break; case "treble1": case "treble2": case "treble3": @@ -209,7 +211,7 @@ public function RequestAction($Ident, $Value) { case "treble6": $Type = "TRE"; $Number = SubStr($Ident, 6, 1); - break; + break; case "balance1": case "balance2": case "balance3": @@ -218,7 +220,7 @@ public function RequestAction($Ident, $Value) { case "balance6": $Type = "BAL"; $Number = SubStr($Ident, 7, 1); - break; + break; case "amp1": case "amp2": case "amp3": @@ -227,7 +229,7 @@ public function RequestAction($Ident, $Value) { case "amp6": $Type = "AMP"; $Number = SubStr($Ident, 3, 1); - break; + break; case "mute1": case "mute2": case "mute3": @@ -238,7 +240,7 @@ public function RequestAction($Ident, $Value) { $Number = SubStr($Ident, 4, 1); break; } - + $this->SendDebug(("DBG: send: ".$Type ." ". $Number), $Value,0); $this->SetAudioSettingAM($Number, $Type, $Value); } @@ -247,9 +249,9 @@ public function RequestAction($Ident, $Value) { public function SetAudioSettingAM(int $Number, int $Type , int $Value) { $this->Send("SET,AUDIO,". $Number .",". $Type . ",". $Value .""); - $this->SendDebug(("DBG: send: ". $Number. "," . $Type . "," . $Value), $Value,0); + $this->SendDebug(("DBG: send: ". $Number. "," . $Type . "," . $Value), $Value,0); } - + //private function CreateVariableProfile($ProfileName, $ProfileType, $Suffix, $MinValue, $MaxValue, $StepSize, $Digits, $Icon,$Wert,$Name,$Color) { @@ -261,11 +263,11 @@ private function CreateVariableProfile($ProfileName, $ProfileType, $Suffix, $Min IPS_SetVariableProfileDigits($ProfileName, $Digits); IPS_SetVariableProfileIcon($ProfileName, $Icon); //IPS_SetVariableProfileAssociation($ProfileName, $Wert,$Name,$Icon ,$color); - + } } - - + + //private function CreateVariableProfile($ProfileName, $ProfileType, $Suffix, $MinValue, $MaxValue, $StepSize, $Digits, $Icon,$Wert,$Name,$Color) { private function CreateVariableAssociation($ProfileName, $Wert, $Name, $Icon , $color) { IPS_SetVariableProfileAssociation($ProfileName, $Wert, $Name, $Icon , $color); From b80ea729de3c15669c3ae89acdace7e07b9dae02 Mon Sep 17 00:00:00 2001 From: ESERA-Automation Date: Mon, 3 Sep 2018 17:54:39 +0200 Subject: [PATCH 2/2] update audiomax --- AudioMax Multiroom System/module.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AudioMax Multiroom System/module.json b/AudioMax Multiroom System/module.json index 9983e3d..afc1a1c 100644 --- a/AudioMax Multiroom System/module.json +++ b/AudioMax Multiroom System/module.json @@ -1,5 +1,5 @@ { -"id": "{F566210E-8CFA-466D-86AC-AC884350262A}", +"id": "{F3008344-9C01-4E48-9B47-CEC362B0919D}", "name": "AudioMaxSystem", "type": 3, "vendor": "ESERA-Automation",