private function RefreshLinks()
 {
     if ($this->ReadPropertyInteger("LinkSource") == 0) {
         foreach (IPS_GetChildrenIDs($this->InstanceID) as $Child) {
             if (IPS_GetObject($Child)['ObjectType'] == 6) {
                 IPS_DeleteLink($Child);
             }
         }
         return;
     }
     $present = array();
     foreach (IPS_GetChildrenIDs($this->InstanceID) as $Child) {
         if (IPS_GetObject($Child)['ObjectType'] == 6) {
             $present[] = IPS_GetLink($Child)['TargetID'];
         }
     }
     $create = array_diff(IPS_GetChildrenIDs($this->ReadPropertyInteger("LinkSource")), $present);
     foreach ($create as $Target) {
         if (IPS_GetObject($Target)["ObjectIsHidden"]) {
             continue;
         }
         $Link = IPS_CreateLink();
         IPS_SetParent($Link, $this->InstanceID);
         IPS_SetName($Link, IPS_GetName($Target));
         IPS_SetLinkTargetID($Link, $Target);
     }
 }
	function Entertainment_SetRemoteControl($Id, $Value) {
	   $DeviceName = IPS_GetName(IPS_GetParent($Id));
		if (!isDevicePoweredOnByDeviceName($DeviceName)) {
		  return;
		}
		IPSLogger_Dbg(__file__, 'Set RemoteControl for Device "'.$DeviceName.'": '.$Value);
		SetValue($Id, $Value);
		Entertainment_SetRoomControlByDeviceControlId($Id, $Value);
	}
		/**
		 * @public
		 *
		 * Function um Events zu behandeln, diese Funktion wird vom IPSMessageHandler aufgerufen, um ein aufgetretenes Event 
		 * an das entsprechende Module zu leiten.
		 *
		 * @param integer $variable ID der auslösenden Variable
		 * @param string $value Wert der Variable
		 * @param IPSModulePlayer $module Module Object an das das aufgetretene Event weitergeleitet werden soll
		 */
		public function HandleEvent($variable, $value, IPSModulePlayer $module) {
			$name = IPS_GetName($variable);
			switch($name) {
				case 'Titel': // Sync current Titel of Player
					$module->SyncTitel($value);
					break;
				default:
					throw new IPSComponentException('Event Handling NOT supported for Variable '.$variable.'('.$name.')');
			}
		}
Пример #4
0
	function Entertainment_SetRoomPower($PowerId, $Value, $PowerOnDevices=true) {
	   if (GetValue($PowerId) <> $Value) {
	      IPSLogger_Inf(__file__, 'Set Power for Room "'.IPS_GetName(IPS_GetParent($PowerId)).'" '.bool2OnOff($Value));
			SetValue($PowerId, $Value);
	      Entertainment_SetRoomVisible($PowerId, $Value);
			if ($PowerOnDevices) {
	      	Entertainment_SetDevicePowerByRoomId(IPS_GetParent($PowerId), $Value);
			}
	      Entertainment_SyncRoomControls(IPS_GetParent($PowerId));
	   }
	}
Пример #5
0
	function Entertainment_SetDevicePowerByRoomId($RoomId, $Value=true) {
	   if ($Value) {
			$RoomName    = IPS_GetName($RoomId);
			$DeviceNames = get_DeviceNamesByRoomId($RoomId);
			foreach ($DeviceNames as $DeviceName) {
			   Entertainment_SetDevicePowerByDeviceName($DeviceName, true);
			}
	   } else {
	      Entertainment_PowerOffUnusedDevices();
	   }
	}
	function Delete_Script($scriptId, $filePath) {
		$scriptName = IPS_GetName($scriptId);
		$object     = IPS_GetScript($scriptId);
		$scriptFile = $object['ScriptFile'];

		echo "Remove old Script File $scriptFile\n";
		if (!IPS_DeleteScript($scriptId, false)) {
			echo "Error set deleting Script $scriptId, File=$scriptFile\n";
			exit;
		}
		//if (!unlink(IPS_GetKernelDir().'\\scripts\\'.$scriptFile)) {
		//	echo "Error deleting old Script File '$scriptFile'\n";
		//	exit;
		//}
	}
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'NUT Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('Port', 3493);
     $this->RegisterPropertyInteger('UpdateInterval', 300);
     $this->RegisterPropertyInteger('NomPower', self::default_nomval);
     $this->RegisterPropertyString('IDfield', 'ups.serial');
     $this->RegisterPropertyString('UPSname', '');
     $this->RegisterPropertyString('Host', '');
     $this->RegisterPropertyString('LogFile', '');
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //timer
     $this->RegisterTimer('Update', 0, $this->module_data["prefix"] . '_UpdateEvent($_IPS[\'TARGET\']);');
     //Vars
     $this->RegisterVariableString('Buffer', 'Buffer', "", -1);
     IPS_SetHidden($this->GetIDForIdent('Buffer'), true);
     //Connect Parent
     $this->RequireParent($this->module_interfaces['ClientSocket']);
     $pid = $this->GetParent();
     if ($pid) {
         $name = IPS_GetName($pid);
         if ($name == "Client Socket") {
             IPS_SetName($pid, __CLASS__ . " Socket");
         }
     }
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive() && $this->GetParent() > 0) {
             $this->SetStatus(self::ST_AKTIV);
             $i = $this->GetUpdateInterval();
             $this->SetTimerInterval('Update', $i * 1000);
             //ms
             $this->debug(__FUNCTION__, "Starte Timer {$i} sec");
             $this->init();
         } else {
             $this->SetStatus(self::ST_INACTIV);
         }
     }
 }
Пример #8
0
		protected function AddMessageHeader() {
			// Common Settings
			$this->messageArray[] = 'TA';     // Terminal aus
			$this->messageArray[] = 'AL,0,1'; // Touch löschen
			$this->messageArray[] = 'DL';     // Display leeren
			$this->messageArray[] = 'AS,0';   // Summer aus
			$this->messageArray[] = 'YH,30';  // Helligkeit auf 30
			// Top Line
			$this->messageArray[] = "FP,19,130,130,130"; // Define Color
			$this->messageArray[] = "FE,8,1,19,8,1,7"; // Button Color
			if ($this->rootId <> $this->currentId) $this->messageArray[] = 'AT,1,1,75,25,1,0,C<<';   // Touch Button
			$this->messageArray[] = 'ZF,5'; // Schriftart
			$this->messageArray[] = 'ZZ,1,1'; // SchriftZoom
			$this->messageArray[] = 'ZC,220,5,'.IPS_GetName($this->currentId); // Current Category
			$this->messageArray[] = "FG,8,1,1"; // Line Color
			$this->messageArray[] = 'GR,1,30,480,30'; // Line
			$this->messageArray[] = 'GR,160,30,160,272'; // Line
		}
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'WDE1 Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyString('LogFile', '');
     $this->RegisterPropertyInteger('RainPerCount', 295);
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //Vars
     $this->RegisterVariableString('Buffer', 'Buffer', "", -1);
     IPS_SetHidden($this->GetIDForIdent('Buffer'), true);
     $this->RegisterVariableString('LastUpdate', 'Last Update', "", -4);
     IPS_SetHidden($this->GetIDForIdent('LastUpdate'), true);
     //Timers
     $this->RegisterTimer('ReInit', 60000, $this->module_data["prefix"] . '_ReInitEvent($_IPS[\'TARGET\']);');
     //Connect Parent
     $this->RequireParent($this->module_interfaces['SerialPort']);
     $pid = $this->GetParent();
     if ($pid) {
         $name = IPS_GetName($pid);
         if ($name == "Serial Port") {
             IPS_SetName($pid, __CLASS__ . " Port");
         }
     }
     //call init if ready and activated
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive()) {
             $this->SetStatus(self::ST_AKTIV);
             $this->init();
         } else {
             $this->SetStatus(self::ST_INACTIV);
             $this->SetTimerInterval('ReInit', 0);
         }
     }
 }
	function Entertainment_SendDataBySourceIdx($RoomId, $SourceIdx, $MessageType) {
	   if ($MessageType <> c_MessageType_Action) {
	      return;
		}
	   $RoomName    = IPS_GetName($RoomId);
      $DeviceTypes = get_SourceDeviceTypes($RoomId, $SourceIdx);
      $SourceConf  = get_SourceConfiguration();
      foreach ($DeviceTypes as $DeviceType=>$DeviceName) {
	      $SourceData  = $SourceConf[$RoomName][$SourceIdx][$DeviceType];
         if (array_key_exists(c_Property_CommSrc, $SourceData)) {
         	Entertainment_SendData($DeviceName, c_Control_Source, $SourceData[c_Property_CommSrc], c_Property_CommSrc);
         }
      }
	}
Пример #11
0
	function get_CirclyNameByID($CircleId) {
	   $CircleItem       = IPS_GetName($CircleId);
		$WaterConfig      = get_WateringConfiguration();
		return $WaterConfig[$CircleItem][c_Property_Name];
	}
Пример #12
0
		/**
       * @public
		 *
		 * Refresh der Anzeige
		 *
		 */
		public function RefreshDisplay() {
		   IPSLogger_Trc(__file__, 'Refresh EDIP Display '.IPS_GetName($this->instanceId));
		   $this->AddObjects();
		   $this->OrderObjects();
			$this->StoreObjectData();

			$this->messageArray = array();
			$this->AddMessageHeader();
			$this->AddMessageCategories();
			$this->AddMessageVariables();
			$this->AddMessageValueEdit();
			$this->sendArray($this->messageArray);
		}
	function IPSWatering_AfterActivateWatering($CycleId ,$Value, $Mode) {
		$CircleName = IPS_GetName($CycleId);

	}
Пример #14
0
 private function deviceInstanceExists($name)
 {
     //if ($isUpdate)
     //{
     $children = IPS_GetChildrenIDs($this->InstanceID);
     foreach ($children as $child) {
         if (IPS_InstanceExists($child)) {
             $childInstance = @IPS_GetInstance($child);
             $childInstanceID = $childInstance['InstanceID'];
             $childInstanceName = @IPS_GetName($childInstanceID);
             // Check if it is a Dummy Module and if it has a known device name
             if ($childInstanceName == $name and $childInstance['ModuleInfo']['ModuleID'] == "{485D0419-BE97-4548-AA9C-C083EB82E61E}") {
                 return true;
             }
         }
     }
     return false;
     //} else {
     //	return false;
     //}
 }
Пример #15
0
  public function ApplyData($data) {
    $data = (array)$data;
    $state = (array)$data['state'];

    /*
     * Properties
     */

    $dirty = false;

    $modelid = utf8_decode((string)$data['modelid']);
    $type = utf8_decode((string)$data['type']);
    $name = utf8_decode((string)$data['name']);
    if (IPS_GetProperty($this->InstanceID, 'ModelId') != $modelid) {
      IPS_SetProperty($this->InstanceID, 'ModelId', $modelid);
      $dirty = true;
    }
    if (IPS_GetProperty($this->InstanceID, 'Type') != $type) {
      IPS_SetProperty($this->InstanceID, 'Type', $type);
      $dirty = true;
    }
    if (IPS_GetName($this->InstanceID) != $name) {
      IPS_SetName($this->InstanceID, $name);
      $dirty = true;
    }

    // Setze den Modus
    if (isset($state['ct']) && isset($state['hue'])) {
      // HUE+CT Lamp
      $lightFeature = 0;
    } elseif(isset($state['hue'])) {
      // HUE Lamp
      $lightFeature = 1;
    } elseif(isset($state['ct'])) {
      // CT Lamp
      $lightFeature = 2;
    } else {
      // Lux Lamp
      $lightFeature = 3;
    }

    if (IPS_GetProperty($this->InstanceID, 'LightFeatures') != $lightFeature) {
      IPS_SetProperty($this->InstanceID, 'LightFeatures', $lightFeature);
      $dirty = true;
    }

    if ($dirty) IPS_ApplyChanges($this->InstanceID);

    /*
     * Variables
     */

    $stateId = $this->RegisterVariableBoolean("STATE", "Zustand", "~Switch");
    $this->EnableAction("STATE");
    IPS_SetPosition($stateId, 1);

    $cmId = $this->RegisterVariableInteger("COLOR_MODE", "Modus", "ColorModeSelect.Hue");
    $this->EnableAction("COLOR_MODE");
    IPS_SetPosition($cmId, 2);
    IPS_SetIcon($cmId, 'ArrowRight');

    $briId = $this->RegisterVariableInteger("BRIGHTNESS", "Helligkeit", "~Intensity.100");
    $this->EnableAction("BRIGHTNESS");
    IPS_SetIcon($briId, 'Sun');
    IPS_SetPosition($briId, 5);

    if ($lightFeature == 0 || $lightFeature == 1) {
      $hueId = $this->RegisterVariableInteger("HUE", "Hue");
      IPS_SetHidden($hueId, true);
    } else {
      $delete = @IPS_GetObjectIDByIdent("HUE", $this->InstanceID);
      if ($delete !== false) IPS_DeleteVariable($delete);
    }

    if ($lightFeature == 0) {
      IPS_SetVariableCustomProfile($cmId, 'ColorModeSelect.Hue');
      IPS_SetHidden($cmId, false);
    } else {
      IPS_SetHidden($cmId, true);
    }

    if ($lightFeature == 0 || $lightFeature == 2) {
      $ctId = $this->RegisterVariableInteger("COLOR_TEMPERATURE", "Farbtemperatur", "~Intensity.100");
      $this->EnableAction("COLOR_TEMPERATURE");
      IPS_SetIcon($ctId, 'Bulb');
      IPS_SetPosition($ctId, 4);
    } else {
      $delete = @IPS_GetObjectIDByIdent("COLOR_TEMPERATURE", $this->InstanceID);
      if ($delete !== false) IPS_DeleteVariable($delete);
    }

    if ($lightFeature == 0 || $lightFeature == 1) {
      $colorId = $this->RegisterVariableInteger("COLOR", "Farbe", "~HexColor");
      $this->EnableAction("COLOR");
      IPS_SetPosition($colorId, 3);
      IPS_SetIcon($colorId, 'Bulb');

      $satId = $this->RegisterVariableInteger("SATURATION", utf8_decode("Sättigung"), "~Intensity.100");
      $this->EnableAction("SATURATION");
      IPS_SetIcon($satId, 'Intensity');
      IPS_SetPosition($satId, 6);

    } else {
      $delete = @IPS_GetObjectIDByIdent("COLOR", $this->InstanceID);
      if ($delete !== false) IPS_DeleteVariable($delete);
      $delete = @IPS_GetObjectIDByIdent("SATURATION", $this->InstanceID);
      if ($delete !== false) IPS_DeleteVariable($delete);
    }

    /*
     * Values
     */

    SetValueBoolean($stateId, $state['on']);
    SetValueInteger($briId, round($state['bri'] * 100 / 254));
    if (@$satId) SetValueInteger($satId, round($state['sat'] * 100 / 254));
    if (@$hueId) SetValueInteger($hueId, $state['hue']);
    if (@$ctId) SetValueInteger($ctId, 100 - round(( $state['ct'] - 153) * 100 / 347));

    switch (@$state['colormode']) {
      case 'xy':
      case 'hs':
        $hex = $this->HSV2HEX($state['hue'], $state['sat'], $state['bri']);
        SetValueInteger($colorId, hexdec($hex));
        IPS_SetHidden($colorId, false);
        IPS_SetHidden($satId, false);
        if (@$ctId) IPS_SetHidden($ctId, true);
        if (@$cmId) SetValueInteger($cmId, 0);
        break;
      case 'ct':
        if(@$colorId) IPS_SetHidden($colorId, true);
        if(@$satId) IPS_SetHidden($satId, true);
        IPS_SetHidden($ctId, false);
        SetValueInteger($cmId, 1);
        break;
    }
  }
		/**
		 * @public
		 *
		 * Function um Events zu behandeln, diese Funktion wird vom IPSMessageHandler aufgerufen, um ein aufgetretenes Event 
		 * an das entsprechende Module zu leiten.
		 *
		 * @param integer $variable ID der auslösenden Variable
		 * @param string $value Wert der Variable
		 * @param IPSModuleShutter $module Module Object an das das aufgetretene Event weitergeleitet werden soll
		 */
		public function HandleEvent($variable, $value, IPSModuleShutter $module){
			$name = IPS_GetName($variable);
			throw new IPSComponentException('Event Handling NOT supported for Variable '.$variable.'('.$name.')');
		}
Пример #17
0
 public function ApplyChanges()
 {
     $ipAddress = $this->ReadPropertyString("IPAddress");
     if ($ipAddress) {
         $curl = curl_init();
         curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'http://' . $ipAddress . ':1400/xml/device_description.xml'));
         $result = curl_exec($curl);
         if (!curl_exec($curl)) {
             die('Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($curl));
         }
     }
     //Never delete this line!
     parent::ApplyChanges();
     // Start create profiles
     $this->RegisterProfileIntegerEx("Status.SONOS", "Information", "", "", array(array(0, "Prev", "", -1), array(1, "Play", "", -1), array(2, "Pause", "", -1), array(3, "Stop", "", -1), array(4, "Next", "", -1), array(5, "Transition", "", -1)));
     $this->RegisterProfileInteger("Volume.SONOS", "Intensity", "", " %", 0, 100, 1);
     $this->RegisterProfileInteger("Tone.SONOS", "Intensity", "", " %", -10, 10, 1);
     $this->RegisterProfileInteger("Balance.SONOS", "Intensity", "", " %", -100, 100, 1);
     $this->RegisterProfileIntegerEx("Switch.SONOS", "Information", "", "", array(array(0, "Off", "", 0xff0000), array(1, "On", "", 0xff00)));
     //Build Radio Station Associations according to user settings
     if (!IPS_VariableProfileExists("Radio.SONOS")) {
         $this->UpdateRadioStations();
     }
     // Build Group Associations according Sonos Instance settings
     $allSonosInstances = IPS_GetInstanceListByModuleID("{F6F3A773-F685-4FD2-805E-83FD99407EE8}");
     $GroupAssociations = array(array(0, "none", "", -1));
     foreach ($allSonosInstances as $key => $SonosID) {
         if (@IPS_GetProperty($SonosID, "GroupCoordinator")) {
             $GroupAssociations[] = array($SonosID, IPS_GetName($SonosID), "", -1);
         }
     }
     if (IPS_VariableProfileExists("Groups.SONOS")) {
         IPS_DeleteVariableProfile("Groups.SONOS");
     }
     $this->RegisterProfileIntegerEx("Groups.SONOS", "Network", "", "", $GroupAssociations);
     // End Create Profiles
     // Start Register variables and Actions
     // 1) general availabe
     $this->RegisterVariableString("nowPlaying", "nowPlaying", "", 20);
     $this->RegisterVariableInteger("Radio", "Radio", "Radio.SONOS", 21);
     $this->RegisterVariableInteger("Status", "Status", "Status.SONOS", 29);
     $this->RegisterVariableInteger("Volume", "Volume", "Volume.SONOS", 30);
     $this->EnableAction("Radio");
     $this->EnableAction("Status");
     $this->EnableAction("Volume");
     // 2) Add/Remove according to feature activation
     // create link list for deletion of liks if target is deleted
     $links = array();
     foreach (IPS_GetLinkList() as $key => $LinkID) {
         $links[] = array('LinkID' => $LinkID, 'TargetID' => IPS_GetLink($LinkID)['TargetID']);
     }
     // 2a) Bass
     if ($this->ReadPropertyBoolean("BassControl")) {
         $this->RegisterVariableInteger("Bass", "Bass", "Tone.SONOS", 36);
         $this->EnableAction("Bass");
     } else {
         $this->removeVariableAction("Bass", $links);
     }
     // 2b) Treble
     if ($this->ReadPropertyBoolean("TrebleControl")) {
         $this->RegisterVariableInteger("Treble", "Treble", "Tone.SONOS", 37);
         $this->EnableAction("Treble");
     } else {
         $this->removeVariableAction("Treble", $links);
     }
     // 2c) Mute
     if ($this->ReadPropertyBoolean("MuteControl")) {
         $this->RegisterVariableInteger("Mute", "Mute", "Switch.SONOS", 31);
         $this->EnableAction("Mute");
     } else {
         $this->removeVariableAction("Mute", $links);
     }
     // 2d) Loudness
     if ($this->ReadPropertyBoolean("LoudnessControl")) {
         $this->RegisterVariableInteger("Loudness", "Loudness", "Switch.SONOS", 35);
         $this->EnableAction("Loudness");
     } else {
         $this->removeVariableAction("Loudness", $links);
     }
     // 2e) Balance
     if ($this->ReadPropertyBoolean("BalanceControl")) {
         $this->RegisterVariableInteger("Balance", "Balance", "Balance.SONOS", 38);
         $this->EnableAction("Balance");
     } else {
         $this->removeVariableAction("Balance", $links);
     }
     // 2f Sleeptimer
     if ($this->ReadPropertyBoolean("SleeptimerControl")) {
         $this->RegisterVariableInteger("Sleeptimer", "Sleeptimer", "", 39);
     } else {
         $this->removeVariable("Sleeptimer", $links);
     }
     // 2g Playlists
     if ($this->ReadPropertyBoolean("PlaylistControl")) {
         if (!IPS_VariableProfileExists("Playlist.SONOS")) {
             $this->RegisterProfileIntegerEx("Playlist.SONOS", "Database", "", "", array());
         }
         $this->RegisterVariableInteger("Playlist", "Playlist", "Playlist.SONOS", 22);
         $this->EnableAction("Playlist");
     } else {
         $this->removeVariable("Playlist", $links);
     }
     // 2h) GroupVolume, GroupMembers, MemberOfGroup
     if ($this->ReadPropertyBoolean("GroupCoordinator")) {
         IPS_SetHidden($this->RegisterVariableString("GroupMembers", "GroupMembers", "", 10), true);
         $this->RegisterVariableInteger("GroupVolume", "GroupVolume", "Volume.SONOS", 11);
         $this->EnableAction("GroupVolume");
         $this->removeVariableAction("MemberOfGroup", $links);
     } else {
         $this->RegisterVariableInteger("MemberOfGroup", "MemberOfGroup", "Groups.SONOS", 12);
         $this->EnableAction("MemberOfGroup");
         $this->removeVariableAction("GroupVolume", $links);
         $this->removeVariable("GroupMembers", $links);
     }
     // 2i) Hide/unhide MemberOfGroup depending on presence of GroupCoordinators
     if (sizeof($GroupAssociations) === 1) {
         // hide MemberOfGroup
         foreach ($allSonosInstances as $key => $SonosID) {
             $GroupingID = @IPS_GetVariableIDByName("MemberOfGroup", $SonosID);
             if ($GroupingID) {
                 IPS_SetHidden($GroupingID, true);
             }
         }
     } else {
         // unhide MemberOfGroup
         foreach ($allSonosInstances as $key => $SonosID) {
             $GroupingID = @IPS_GetVariableIDByName("MemberOfGroup", $SonosID);
             if ($GroupingID) {
                 IPS_SetHidden($GroupingID, false);
             }
         }
     }
     // End Register variables and Actions
     // Start add scripts for regular status and grouping updates
     // 1) _updateStatus
     $statusScriptID = @$this->GetIDForIdent("_updateStatus");
     if ($statusScriptID === false) {
         $statusScriptID = $this->RegisterScript("_updateStatus", "_updateStatus", file_get_contents(__DIR__ . "/_updateStatus.php"), 98);
     } else {
         IPS_SetScriptContent($statusScriptID, file_get_contents(__DIR__ . "/_updateStatus.php"));
     }
     IPS_SetHidden($statusScriptID, true);
     IPS_SetScriptTimer($statusScriptID, 5);
     // 2) _updateGrouping
     $groupingScriptID = @$this->GetIDForIdent("_updateGrouping");
     if ($groupingScriptID === false) {
         $groupingScriptID = $this->RegisterScript("_updateGrouping", "_updateGrouping", file_get_contents(__DIR__ . "/_updateGrouping.php"), 99);
     } else {
         IPS_SetScriptContent($groupingScriptID, file_get_contents(__DIR__ . "/_updateGrouping.php"));
     }
     IPS_SetHidden($groupingScriptID, true);
     IPS_SetScriptTimer($groupingScriptID, 300);
     // End add scripts for regular status and grouping updates
 }
	 * Script zur Anbindung des NetPlayers. Dieses Script ist in der Entertainment Konfiguration
	 * Entertainment_Configuration.ips.php als Empfangs Script für den NetPlayer hinterlegt
	 * und wird immer aufgerufen sobald sich die spezifizierte Variable des NetPlayers ändert.
	 *
    * Anbindung des NetPlayers
	 *
	 */

	include_once "Entertainment.inc.php";
	IPSUtils_Include ("NetPlayer.inc.php",                     "IPSLibrary::app::modules::NetPlayer");

	
	IPS_SemaphoreEnter('NetPlayer', 1000);

	if($IPS_SENDER == "Variable") {
	   $variableName = IPS_GetName($IPS_VARIABLE);
		switch ($variableName) {
		   case 'Power':
		      if ($IPS_VALUE) {
					Entertainment_ReceiveData(array(c_Comm_NetPlayer, 'netplayer', 'poweron'), c_MessageType_Info);
				} else {
					Entertainment_ReceiveData(array(c_Comm_NetPlayer, 'netplayer', 'poweroff'), c_MessageType_Info);
				}
		   	break;
		   case 'RemoteControl':
		      $ControlId = get_ControlIdByDeviceName(c_Device_NetPlayer, c_Control_RemoteSourceType);
		   	if (GetValue(NP_ID_CONTROLTYPE) <> GetValue($ControlId)) {
		      	IPSLogger_Com(__file__, "Receive RemoteControlType ".GetValue(NP_ID_CONTROLTYPE)." for NetPlayer");
					Entertainment_ReceiveData(array(c_Comm_NetPlayer, 'netplayertype', (string)GetValue(NP_ID_CONTROLTYPE)), c_MessageType_Info);
				} else {
		      	Entertainment_RefreshRemoteControlByDeviceName(c_Device_NetPlayer);
Пример #19
0
}
$HMDevices = IPS_GetInstanceListByModuleID("{EE4A81C6-5C90-4DB7-AD2F-F6BBD521412E}");
$HMAdresses = array();
foreach ($HMDevices as $HMDevice) {
    $HMAdresses[] = IPS_GetProperty($HMDevice, "Address");
}
foreach ($HMCcuAddress as $Key) {
    $HMParent = $HMSockets[$Key];
    if (IPS_GetInstance($HMParent)['InstanceStatus'] != 102) {
        if (IPS_GetInstance($HMParent)['InstanceStatus'] >= 200) {
            if (@IPS_ApplyChanges($HMSocket) === false) {
                echo "Homematic-Socket (" . IPS_GetName($HMParent) . ") mit der InstanzID " . $HMParent . " konnte nicht reaktiviert werden." . PHP_EOL;
            }
        }
        if (IPS_GetInstance($HMParent)['InstanceStatus'] != 102) {
            echo "Homematic-Socket (" . IPS_GetName($HMParent) . ") mit der InstanzID " . $HMParent . " ist nicht aktiv." . PHP_EOL;
            echo "  Überspinge alle Geräte dieser CCU" . PHP_EOL;
            echo "--------------------------------------------------------------------" . PHP_EOL;
            continue;
        }
    }
    //    $interfaces = ReadCCUInterfaces($IP);
    $xml = ReadCCUDevices($Key);
    if ($xml[0] === false) {
        die($xml[1]);
    }
    foreach ($xml->Room as $Room) {
        $Rooms[utf8_decode((string) $Room['Name'])] = GetOrCreateCategoryByName($RaumCat, utf8_decode((string) $Room['Name']));
    }
    if ($OhneRaum) {
        $Rooms['# Ohne Raum'] = GetOrCreateCategoryByName($RaumCat, '# Ohne Raum');
Пример #20
0
	function Entertainment_SetDeviceControlByRoomControlId($RoomControlId, $Value) {
		$DeviceControlId = get_DeviceControlIdByRoomControlId($RoomControlId);
		if ($DeviceControlId !== false) {
		   Entertainment_SetDeviceControl($DeviceControlId, $Value);
		} else {
		   IPSLogger_Err(__file__, 'No DeviceControl found for RoomControlId='.$RoomControlId.', Name="'.IPS_GetName($RoomControlId).'"');
		}
	}
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'WS300PC Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('RecordInterval', 5);
     $this->RegisterPropertyInteger('WS300PCInterval', 300);
     $this->RegisterPropertyString('LogFile', '');
     //$this->RegisterPropertyString('WSWinFile', '');
     $this->RegisterPropertyInteger('Altitude', 0);
     $this->RegisterPropertyInteger('RainPerCount', 295);
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //willi profile
     if (!IPS_VariableProfileExists('WS300_Willi')) {
         IPS_CreateVariableProfile('WS300_Willi', 1);
         //integer
         IPS_SetVariableProfileAssociation('WS300_Willi', 0, 'Sunny', 'Sun', -1);
         IPS_SetVariableProfileAssociation('WS300_Willi', 1, 'some Clouds', 'Cloud', -1);
         IPS_SetVariableProfileAssociation('WS300_Willi', 2, 'Cloudy', 'Cloud', -1);
         IPS_SetVariableProfileAssociation('WS300_Willi', 3, 'Rainy', 'Drops', -1);
     }
     //Vars
     $this->RegisterVariableInteger('RecCount', 'History Record Count');
     $this->RegisterVariableString('Last', 'Last History Record');
     $this->RegisterVariableString('Buffer', 'Buffer', "", -1);
     IPS_SetHidden($this->GetIDForIdent('Buffer'), true);
     $this->RegisterVariableBoolean('isPolling', 'isPolling', "", -2);
     IPS_SetHidden($this->GetIDForIdent('isPolling'), true);
     $this->RegisterVariableString('Config', 'Config Record', "", -3);
     IPS_SetHidden($this->GetIDForIdent('Config'), true);
     $this->RegisterVariableString('LastUpdate', 'Last Update', "", -4);
     IPS_SetHidden($this->GetIDForIdent('LastUpdate'), true);
     //Timers
     $this->RegisterTimer('ReInit', 60000, $this->module_data["prefix"] . '_ReInitEvent($_IPS[\'TARGET\']);');
     $this->RegisterTimer('Update', 0, $this->module_data["prefix"] . '_UpdateEvent($_IPS[\'TARGET\']);');
     //Connect Parent
     $this->RequireParent($this->module_interfaces['SerialPort']);
     $pid = $this->GetParent();
     if ($pid) {
         $name = IPS_GetName($pid);
         if ($name == "Serial Port") {
             IPS_SetName($pid, __CLASS__ . " Port");
         }
     }
     //call init if ready and activated
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive() && $this->HasActiveParent()) {
             $this->SetStatus(self::ST_AKTIV);
             $i = $this->GetWS300pcInterval();
             $this->SetTimerInterval('Update', $i * 1000);
             //ms
             $this->SetTimerInterval('ReInit', 60000);
             $this->init();
             SetValueInteger($this->GetIDForIdent('RecCount'), 0);
             $this->GetWS300pcInterval();
         } else {
             $this->SetStatus(self::ST_INACTIV);
             $this->SetTimerInterval('ReInit', 0);
             $this->SetTimerInterval('Update', 0);
         }
     }
 }
Пример #22
0
	function Entertainment_SetSource($SourceId, $Value, $MessageType=c_MessageType_Action) {
	   if (GetValue($SourceId) <> $Value) {
		   $RoomId = IPS_GetParent($SourceId);
		   $SourceName = get_SourceName($RoomId, $Value);
		   IPSLogger_Inf(__file__, 'Set Source "'.$SourceName.'" of Room '.IPS_GetName($RoomId));
			SetValue($SourceId, $Value);
			if (!IsRoomPoweredOn($RoomId)) {
				Entertainment_SetRoomPowerByRoomId($RoomId, true, false);
			}
			Entertainment_SetDeviceControlByRoomId($RoomId, c_Control_Muting, false);
		   Entertainment_SetDevicePowerByRoomId($RoomId, true);
		   Entertainment_SendDataBySourceIdx($RoomId, $Value, $MessageType);
         Entertainment_SyncRoomControls($RoomId);
			Entertainment_PowerOffUnusedDevices();
		}
	}
Пример #23
0
 /**
  * Die folgenden Funktionen stehen automatisch zur Verfügung, wenn das Modul über die "Module Control" eingefügt wurden.
  * Die Funktionen werden, mit dem selbst eingerichteten Prefix, in PHP und JSON-RPC wiefolgt zur Verfügung gestellt:
  *
  * 
  */
 protected function CreateProfileIR($NumberIRCodes)
 {
     //$irprofilname = str_replace(' ','',(trim(IPS_GetName(IPS_GetInstance($this->InstanceID)["InstanceID"])))); //Profilname darf keine Leerzeichen enthalten !!!!
     $irprofilname = str_replace(' ', '', trim(IPS_GetName($this->InstanceID)));
     //Profilname darf keine Leerzeichen enthalten !!!!
     $profilname1 = $irprofilname . "1.AIOIR";
     $profilname2 = $irprofilname . "2.AIOIR";
     $profilname3 = $irprofilname . "3.AIOIR";
     $profilname4 = $irprofilname . "4.AIOIR";
     // Start create profiles
     if ($NumberIRCodes <= 32) {
         $end = $NumberIRCodes - 1;
         $this->RegisterProfileIRCodes($profilname1, "Keyboard", 0, $end, $NumberIRCodes);
         //Variablen anlegen
         //Generelle Variablen
         $this->RegisterVariableInteger("IRCODES1", "IR Codes", $profilname1, 29);
         $this->EnableAction("IRCODES1");
     } elseif ($NumberIRCodes <= 64 && $NumberIRCodes > 32) {
         $end = $NumberIRCodes - 33;
         $this->RegisterProfileIRCodes($profilname1, "Keyboard", 0, 31, $NumberIRCodes);
         $this->RegisterProfileIRCodes($profilname2, "Keyboard", 32, $end, $NumberIRCodes);
         //Variablen anlegen
         //Generelle Variablen
         $this->RegisterVariableInteger("IRCODES1", "IR Codes", $profilname1, 29);
         $this->EnableAction("IRCODES1");
         $this->RegisterVariableInteger("IRCODES2", "IR Codes", $profilname2, 30);
         $this->EnableAction("IRCODES2");
     } elseif ($NumberIRCodes <= 96 && $NumberIRCodes > 64) {
         $end = $NumberIRCodes - 65;
         $this->RegisterProfileIRCodes($profilname1, "Keyboard", 0, 31, $NumberIRCodes);
         $this->RegisterProfileIRCodes($profilname2, "Keyboard", 32, 63, $NumberIRCodes);
         $this->RegisterProfileIRCodes($profilname3, "Keyboard", 64, $end, $NumberIRCodes);
         //Variablen anlegen
         //Generelle Variablen
         $this->RegisterVariableInteger("IRCODES1", "IR Codes", $profilname1, 29);
         $this->EnableAction("IRCODES1");
         $this->RegisterVariableInteger("IRCODES2", "IR Codes", $profilname2, 30);
         $this->EnableAction("IRCODES2");
         $this->RegisterVariableInteger("IRCODES3", "IR Codes", $profilname3, 31);
         $this->EnableAction("IRCODES3");
     } elseif ($NumberIRCodes <= 100 && $NumberIRCodes > 96) {
         $end = $NumberIRCodes - 97;
         $this->RegisterProfileIRCodes($profilname1, "Keyboard", 0, 31, $NumberIRCodes);
         $this->RegisterProfileIRCodes($profilname2, "Keyboard", 32, 63, $NumberIRCodes);
         $this->RegisterProfileIRCodes($profilname3, "Keyboard", 64, 95, $NumberIRCodes);
         $this->RegisterProfileIRCodes($profilname4, "Keyboard", 96, $end, $NumberIRCodes);
         //Variablen anlegen
         //Generelle Variablen
         $this->RegisterVariableInteger("IRCODES1", "IR Codes", $profilname1, 29);
         $this->EnableAction("IRCODES1");
         $this->RegisterVariableInteger("IRCODES2", "IR Codes", $profilname2, 30);
         $this->EnableAction("IRCODES2");
         $this->RegisterVariableInteger("IRCODES3", "IR Codes", $profilname3, 31);
         $this->EnableAction("IRCODES3");
         $this->RegisterVariableInteger("IRCODES4", "IR Codes", $profilname4, 32);
         $this->EnableAction("IRCODES4");
     }
 }
		/**
		 * @public
		 *
		 * Liefert eine Liste aller installierten Module
		 *
		 * @return string[] Liste der installierten Module
		 */
		public function GetInstalledModules() {
			$childrenIds = IPS_GetChildrenIDs($this->instanceId);
			$result = array();
			foreach ($childrenIds as $id) {
				$result[IPS_GetName($id)] = GetValue($id);
			}
			return $result;
		}
	function get_RoomId($RoomName) {
	   $RoomIds = IPS_GetChildrenIDs(c_ID_Roomes);
	   foreach ($RoomIds as $RoomId) {
	      if (IPS_GetName($RoomId)==$RoomName) {
	         return $RoomId;
	      }
	   }
	   return false;
	}
	 * @{
	 *
	 * @file          IPSWatering_ActivationTimer.ips.php
	 * @author        Andreas Brauneis
	 * @version
	 * Version 2.50.1, 11.03.2012<br/>
	 *
	 * Starten der Bewässerungs Kreise zu den vorgegebenen Zeiten
	 *
	 */

	 /** @}*/

	include_once "IPSWatering.inc.php";

   $CircleName         = IPS_GetName($_IPS['EVENT']);
   $categoryId_Circles = IPSUtil_ObjectIDByPath('Program.IPSLibrary.data.modules.IPSWatering.WaterCircles');
   $CircleId           = IPS_GetCategoryIDByName($CircleName, $categoryId_Circles);
   $ControlId          = get_ControlId(c_Control_Active, $CircleId);

	$WaterConfig = get_WateringConfiguration();

	// Wert von Bewässerungs Sensor ermitteln
	$SensorLimit = GetValue(get_ControlId(c_Control_Sensor, $CircleId));
	$SensorValue = false;
	if (array_key_exists(c_Property_Sensor, $WaterConfig[$CircleName])) {
		$SensorPath  = $WaterConfig[$CircleName][c_Property_Sensor];
		if ($SensorPath <> '') {
			$SensorId    = IPSUtil_ObjectIDByPath($SensorPath);
			if ($SensorId===false) {
			   IPSLogger_Wrn(__file__, "Specified Sensor '$SensorPath' could NOT be found");
Пример #27
0
	 * @author        Andreas Brauneis
	 * @version
	 * Version 2.50.1, 31.01.2012<br/>
	 *
	 * Dieses Script wird von Events aufgerufen, um die EDIP Steuerung über Änderungen an den
	 * gerade angezeigten Daten zu informieren.
	 * Angelegt werden die Events von der EDIP Steuerung selbst, sobald eine entsprechende Variable
	 * visualisiert wird.
	 * Voraussetzung für den Refresh mit Event ist, dass der Konfigurations Parameter EDIP_CONFIG_REFRESHMETHOD
	 * auf dem Wert EDIP_REFRESHMETHOD_EVENT steht.
	 *
	 */

	include_once "IPSEDIP.class.php";

	$eventName = IPS_GetName($_IPS['EVENT']);

	foreach (IPSEDIP_GetConfiguration() as $configId=>$configData) {
		if (substr($eventName,0,strlen($configId))==$configId) {

			if ($configData[EDIP_CONFIG_REFRESHMETHOD]==EDIP_REFRESHMETHOD_EVENT or
			    $configData[EDIP_CONFIG_REFRESHMETHOD]==EDIP_REFRESHMETHOD_BOTH) {

				$result = IPS_SemaphoreEnter($configId, 0);
				if (!$result) {
				   IPSLogger_Trc(__file__, "Refresh is already in Process - ignore ...");
					return;
				}
				IPSLogger_Trc(__file__, "Refresh EDIP by Event=$eventName");
				IPS_Sleep(1000);
				IPS_SemaphoreLeave($configId);
Пример #28
0
 private function ReadBatteryStates()
 {
     $InstanzIDsListAll[] = IPS_GetInstanceListByModuleID("{A89F8DFA-A439-4BF1-B7CB-43D047208DDD}");
     // FHT
     $InstanzIDsListAll[] = IPS_GetInstanceListByModuleID("{2FD7576A-D2AD-47EE-9779-A502F23CABB3}");
     // FS20 HMS
     $InstanzIDsListAll[] = IPS_GetInstanceListByModuleID("{EE4A81C6-5C90-4DB7-AD2F-F6BBD521412E}");
     // HomeMatic
     $InstanzIDsListAll[] = IPS_GetInstanceListByModuleID("{101352E1-88C7-4F16-998B-E20D50779AF6}");
     // Z-Wave
     $a = 0;
     $l = 0;
     foreach ($InstanzIDsListAll as $InstanzIDsList) {
         foreach ($InstanzIDsList as $InstanzID) {
             $InstanzHersteller = IPS_GetInstance($InstanzID);
             $InstanzHersteller = $InstanzHersteller["ModuleInfo"]["ModuleName"];
             switch ($InstanzHersteller) {
                 case "FHT":
                     $InstanzHersteller = "FHT";
                     break;
                 case "HMS":
                     $InstanzHersteller = "HMS";
                     break;
                 case "HomeMatic Device":
                     $InstanzHersteller = "HomeMatic";
                     break;
                 case "Z-Wave Module":
                     $InstanzHersteller = "Z-Wave";
                     break;
             }
             //FHT
             $VarID = @IPS_GetObjectIDByIdent('LowBatteryVar', $InstanzID);
             if ($VarID !== false and $InstanzHersteller == "FHT") {
                 $Var = IPS_GetVariable($VarID);
                 $VarLastUpdated = $Var["VariableUpdated"];
                 $VarLastUpdatedDiffSek = time() - $VarLastUpdated;
                 $DeviceID = IPS_GetProperty($InstanzID, "Address");
                 $LowBat = GetValueBoolean($VarID);
                 if ($LowBat === true) {
                     $Batterien_AR["Alle"][$a]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Alle"][$a]["Batterie"] = "LEER";
                     $Batterien_AR["Alle"][$a]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Alle"][$a]["ID"] = $DeviceID;
                     $Batterien_AR["Alle"][$a]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $Batterien_AR["Leer"][$l]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Leer"][$l]["Batterie"] = "LEER";
                     $Batterien_AR["Leer"][$l]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Leer"][$l]["ID"] = $DeviceID;
                     $Batterien_AR["Leer"][$l]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Leer"][$l]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Leer"][$l]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $a++;
                     $l++;
                 } else {
                     $Batterien_AR["Alle"][$a]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Alle"][$a]["Batterie"] = "OK";
                     $Batterien_AR["Alle"][$a]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Alle"][$a]["ID"] = $DeviceID;
                     $Batterien_AR["Alle"][$a]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $a++;
                 }
             }
             //FS20 HMS
             $VarID = @IPS_GetObjectIDByIdent('LowBatteryVar', $InstanzID);
             if ($VarID !== false and $InstanzHersteller == "HMS") {
                 $Var = IPS_GetVariable($VarID);
                 $VarLastUpdated = $Var["VariableUpdated"];
                 $VarLastUpdatedDiffSek = time() - $VarLastUpdated;
                 $DeviceID = IPS_GetProperty($InstanzID, "DeviceID");
                 $LowBat = GetValueBoolean($VarID);
                 if ($LowBat === true) {
                     $Batterien_AR["Alle"][$a]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt") == true) {
                         if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                             $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                             $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                             $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                         }
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Alle"][$a]["Batterie"] = "LEER";
                     $Batterien_AR["Alle"][$a]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Alle"][$a]["ID"] = $DeviceID;
                     $Batterien_AR["Alle"][$a]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $Batterien_AR["Leer"][$l]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Leer"][$l]["Batterie"] = "LEER";
                     $Batterien_AR["Leer"][$l]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Leer"][$l]["ID"] = $DeviceID;
                     $Batterien_AR["Leer"][$l]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Leer"][$l]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Leer"][$l]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $a++;
                     $l++;
                 } else {
                     $Batterien_AR["Alle"][$a]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Alle"][$a]["Batterie"] = "OK";
                     $Batterien_AR["Alle"][$a]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Alle"][$a]["ID"] = $DeviceID;
                     $Batterien_AR["Alle"][$a]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $a++;
                 }
             }
             //HomeMatic
             $VarID = @IPS_GetObjectIDByIdent('LOWBAT', $InstanzID);
             if ($VarID !== false and $InstanzHersteller == "HomeMatic") {
                 $Var = IPS_GetVariable($VarID);
                 $VarLastUpdated = $Var["VariableUpdated"];
                 $VarLastUpdatedDiffSek = time() - $VarLastUpdated;
                 $DeviceID = substr(IPS_GetProperty($InstanzID, "Address"), 0, -2);
                 $LowBat = GetValueBoolean($VarID);
                 if ($LowBat === true) {
                     $Batterien_AR["Alle"][$a]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Alle"][$a]["Batterie"] = "LEER";
                     $Batterien_AR["Alle"][$a]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Alle"][$a]["ID"] = $DeviceID;
                     $Batterien_AR["Alle"][$a]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $Batterien_AR["Leer"][$l]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Leer"][$l]["Batterie"] = "LEER";
                     $Batterien_AR["Leer"][$l]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Leer"][$l]["ID"] = $DeviceID;
                     $Batterien_AR["Leer"][$l]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Leer"][$l]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Leer"][$l]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $a++;
                     $l++;
                 } else {
                     $Batterien_AR["Alle"][$a]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Alle"][$a]["Batterie"] = "OK";
                     $Batterien_AR["Alle"][$a]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Alle"][$a]["ID"] = $DeviceID;
                     $Batterien_AR["Alle"][$a]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $a++;
                 }
             }
             //Z-Wave
             $VarID = @IPS_GetObjectIDByIdent('BatteryLowVariable', $InstanzID);
             if ($VarID !== false and $InstanzHersteller == "Z-Wave") {
                 $Var = IPS_GetVariable($VarID);
                 $VarLastUpdated = $Var["VariableUpdated"];
                 $VarLastUpdatedDiffSek = time() - $VarLastUpdated;
                 $DeviceID = IPS_GetProperty($InstanzID, "NodeID");
                 $LowBat = GetValueBoolean($VarID);
                 if ($LowBat === true) {
                     $Batterien_AR["Alle"][$a]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Alle"][$a]["Batterie"] = "LEER";
                     $Batterien_AR["Alle"][$a]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Alle"][$a]["ID"] = $DeviceID;
                     $Batterien_AR["Alle"][$a]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $Batterien_AR["Leer"][$l]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle3TB"));
                         $Batterien_AR["Leer"][$l][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Leer"][$l]["Batterie"] = "LEER";
                     $Batterien_AR["Leer"][$l]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Leer"][$l]["ID"] = $DeviceID;
                     $Batterien_AR["Leer"][$l]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Leer"][$l]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Leer"][$l]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $a++;
                     $l++;
                 } else {
                     $Batterien_AR["Alle"][$a]["Name"] = $this->Umlaute_Ersetzen(IPS_GetName($InstanzID));
                     if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr1NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle1TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr2NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabelle2TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                         $ParentID = $this->ParentIDermitteln("ParentNr3NS", $InstanzID);
                         $ParentNameTabelle = $this->Umlaute_Ersetzen($this->ReadPropertyString("NameParentTabell3TB"));
                         $Batterien_AR["Alle"][$a][$ParentNameTabelle] = $this->Umlaute_Ersetzen(IPS_GetName($ParentID));
                     }
                     $Batterien_AR["Alle"][$a]["Batterie"] = "OK";
                     $Batterien_AR["Alle"][$a]["Hersteller"] = $InstanzHersteller;
                     $Batterien_AR["Alle"][$a]["ID"] = $DeviceID;
                     $Batterien_AR["Alle"][$a]["Hersteller_ID"] = $InstanzHersteller . " - " . $DeviceID;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateTimestamp"] = $VarLastUpdated;
                     $Batterien_AR["Alle"][$a]["LetztesVarUpdateVorSek"] = $VarLastUpdatedDiffSek;
                     $a++;
                 }
             }
         }
     }
     if (isset($Batterien_AR)) {
         //Array sortieren, doppelte Einträge entfernen und neu durchnummerieren
         foreach ($Batterien_AR["Alle"] as $nr => $inhalt) {
             $nameALLE[$nr] = strtolower($inhalt["Name"]);
             if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                 $nameParent1ALLE[$nr] = $this->Umlaute_Ersetzen(strtolower($inhalt[$this->ReadPropertyString("NameParentTabelle1TB")]));
             }
             if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                 $nameParent2ALLE[$nr] = $this->Umlaute_Ersetzen(strtolower($inhalt[$this->ReadPropertyString("NameParentTabelle2TB")]));
             }
             if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                 $nameParent3ALLE[$nr] = $this->Umlaute_Ersetzen(strtolower($inhalt[$this->ReadPropertyString("NameParentTabelle3TB")]));
             }
             $batterieALLE[$nr] = strtolower($inhalt["Batterie"]);
             $herstellerALLE[$nr] = strtolower($inhalt["Hersteller"]);
             $idALLE[$nr] = strtolower($inhalt["ID"]);
             $herstelleridALLE[$nr] = strtolower($inhalt["Hersteller_ID"]);
             $lastupdatetsALLE[$nr] = strtolower($inhalt["LetztesVarUpdateTimestamp"]);
             $lastupdatevsALLE[$nr] = strtolower($inhalt["LetztesVarUpdateVorSek"]);
         }
         //Nach was soll das Array sortiert werden?
         if ($this->ReadPropertyString("ArraySortierWert") == "name") {
             array_multisort($nameALLE, SORT_ASC, $Batterien_AR["Alle"]);
         } elseif ($this->ReadPropertyString("ArraySortierWert") == "parentname1") {
             if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                 array_multisort($nameParent1ALLE, SORT_ASC, $Batterien_AR["Alle"]);
             } else {
                 array_multisort($nameALLE, SORT_ASC, $Batterien_AR["Alle"]);
             }
         } elseif ($this->ReadPropertyString("ArraySortierWert") == "parentname2") {
             if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                 array_multisort($nameParent2ALLE, SORT_ASC, $Batterien_AR["Alle"]);
             } else {
                 array_multisort($nameALLE, SORT_ASC, $Batterien_AR["Alle"]);
             }
         } elseif ($this->ReadPropertyString("ArraySortierWert") == "parentname3") {
             if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                 array_multisort($nameParent3ALLE, SORT_ASC, $Batterien_AR["Alle"]);
             } else {
                 array_multisort($nameALLE, SORT_ASC, $Batterien_AR["Alle"]);
             }
         } elseif ($this->ReadPropertyString("ArraySortierWert") == "batterie") {
             array_multisort($batterieALLE, SORT_ASC, $Batterien_AR["Alle"]);
         } elseif ($this->ReadPropertyString("ArraySortierWert") == "hersteller") {
             array_multisort($herstellerALLE, SORT_ASC, $Batterien_AR["Alle"]);
         } elseif ($this->ReadPropertyString("ArraySortierWert") == "id") {
             array_multisort($idALLE, SORT_ASC, $Batterien_AR["Alle"]);
         } elseif ($this->ReadPropertyString("ArraySortierWert") == "letztesupdts") {
             array_multisort($lastupdatetsALLE, SORT_ASC, $Batterien_AR["Alle"]);
         }
         $Batterien_AR["Alle"] = $this->Array_UniqueBySubitem_Sort($Batterien_AR["Alle"], "Hersteller_ID");
         $Batterien_AR["Alle"] = array_merge($Batterien_AR["Alle"]);
         if (isset($Batterien_AR["Leer"])) {
             foreach ($Batterien_AR["Leer"] as $nr => $inhalt) {
                 $nameLEER[$nr] = strtolower($inhalt["Name"]);
                 if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                     $nameParent1LEER[$nr] = $this->Umlaute_Ersetzen(strtolower($inhalt[$this->ReadPropertyString("NameParentTabelle1TB")]));
                 }
                 if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                     $nameParent2LEER[$nr] = $this->Umlaute_Ersetzen(strtolower($inhalt[$this->ReadPropertyString("NameParentTabelle2TB")]));
                 }
                 if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                     $nameParent3LEER[$nr] = $this->Umlaute_Ersetzen(strtolower($inhalt[$this->ReadPropertyString("NameParentTabelle3TB")]));
                 }
                 $batterieLEER[$nr] = strtolower($inhalt["Batterie"]);
                 $herstellerLEER[$nr] = strtolower($inhalt["Hersteller"]);
                 $idLEER[$nr] = strtolower($inhalt["ID"]);
                 $herstelleridLEER[$nr] = strtolower($inhalt["Hersteller_ID"]);
                 $lastupdatetsLEER[$nr] = strtolower($inhalt["LetztesVarUpdateTimestamp"]);
                 $lastupdatevsLEER[$nr] = strtolower($inhalt["LetztesVarUpdateVorSek"]);
             }
             //Nach was soll das Array sortiert werden?
             if ($this->ReadPropertyString("ArraySortierWert") == "name") {
                 array_multisort($nameLEER, SORT_ASC, $Batterien_AR["Leer"]);
             } elseif ($this->ReadPropertyString("ArraySortierWert") == "parentname1") {
                 if ($this->ReadPropertyBoolean("NamenParentObjekt1CB") == true) {
                     array_multisort($nameParent1LEER, SORT_ASC, $Batterien_AR["Leer"]);
                 } else {
                     array_multisort($nameLEER, SORT_ASC, $Batterien_AR["Leer"]);
                 }
             } elseif ($this->ReadPropertyString("ArraySortierWert") == "parentname2") {
                 if ($this->ReadPropertyBoolean("NamenParentObjekt2CB") == true) {
                     array_multisort($nameParent2LEER, SORT_ASC, $Batterien_AR["Leer"]);
                 } else {
                     array_multisort($nameLEER, SORT_ASC, $Batterien_AR["Leer"]);
                 }
             } elseif ($this->ReadPropertyString("ArraySortierWert") == "parentname3") {
                 if ($this->ReadPropertyBoolean("NamenParentObjekt3CB") == true) {
                     array_multisort($nameParent3LEER, SORT_ASC, $Batterien_AR["Leer"]);
                 } else {
                     array_multisort($nameLEER, SORT_ASC, $Batterien_AR["Leer"]);
                 }
             } elseif ($this->ReadPropertyString("ArraySortierWert") == "batterie") {
                 array_multisort($batterieLEER, SORT_ASC, $Batterien_AR["Leer"]);
             } elseif ($this->ReadPropertyString("ArraySortierWert") == "hersteller") {
                 array_multisort($herstellerLEER, SORT_ASC, $Batterien_AR["Leer"]);
             } elseif ($this->ReadPropertyString("ArraySortierWert") == "id") {
                 array_multisort($idLEER, SORT_ASC, $Batterien_AR["Leer"]);
             } elseif ($this->ReadPropertyString("ArraySortierWert") == "letztesupdts") {
                 array_multisort($lastupdatetsLEER, SORT_ASC, $Batterien_AR["Leer"]);
             }
             $Batterien_AR["Leer"] = $this->Array_UniqueBySubitem_Sort($Batterien_AR["Leer"], "Hersteller_ID");
             $Batterien_AR["Leer"] = array_merge($Batterien_AR["Leer"]);
         }
         return $Batterien_AR;
     } else {
         return false;
     }
 }
Пример #29
0
 private function _NewName($Name)
 {
     if (IPS_GetName($this->InstanceID) != trim($Name)) {
         IPS_SetName($this->InstanceID, trim($Name));
     }
 }
Пример #30
0
 public function joinZone()
 {
     $joinzonename = GetValueFormatted($this->GetIDForIdent("JoinZone"));
     if ($joinzonename != "Off") {
         $allboseinstances = IPS_GetInstanceListByModuleID("{4836EF46-FF79-4D6A-91C9-FE54F1BDF2DB}");
         foreach ($allboseinstances as $key => $value) {
             $instancename = IPS_GetName($value);
             if ($instancename == $joinzonename) {
                 $zonemasterip = IPS_GetProperty($value, "DeviceIP");
                 $zonemasterid = IPS_GetProperty($value, "DeviceID");
             }
         }
         $zonememberip = $this->ReadPropertyString("DeviceIP");
         $zonememberid = $this->ReadPropertyString("DeviceID");
         // check if masterdevice is on
         $timeout = $this->ReadPropertyString("Timeout");
         $deviceip = $zonemasterip;
         try {
             if ($timeout && Sys_Ping($deviceip, $timeout) != true) {
                 throw new Exception("Device " . $deviceip . " is not available");
             }
             include_once __DIR__ . "/bose_soundtouch_api.php";
             $bosedevice = new BoseSoundTouchAPI($deviceip);
             $result = $bosedevice->getDeviceNowPlayingAPI();
             $devicemode = $result["devicemode"];
             if ($devicemode != "Standby") {
                 $joinzone = $bosedevice->setDeviceZoneAPI($zonemasterip, $zonemasterid, $zonememberip, $zonememberid);
             } else {
                 SetValue($this->GetIDForIdent("JoinZone"), false);
             }
         } catch (Exception $e) {
             echo $e->getMessage();
         }
     }
 }