Ejemplo n.º 1
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();
	   }
	}
Ejemplo n.º 2
0
	function Entertainment_PowerOffUnusedRoomes() {
	   IPSLogger_Dbg(__file__, 'PowerOff unused Roomes ...');
		$RoomIds =  get_ActiveRoomIds();
		foreach ($RoomIds as $RoomId) {
		   $RoomActice = false;
		   $DeviceNames = get_DeviceNamesByRoomId($RoomId);
			foreach ($DeviceNames as $DeviceName) {
				$RoomActive = isDevicePoweredOnByDeviceName($DeviceName) or $RoomActice;
			}
			if (!$RoomActive) {
			   Entertainment_SetRoomPowerByRoomId($RoomId, false);
			}
		}
	}
	function get_SourceListByDeviceName($DeviceName) {
	   $SourceConfig = get_SourceConfiguration();
	   $SourceList   = array();
	   foreach ($SourceConfig as $RoomName=>$RoomSources) {
	      $RoomId = get_RoomId($RoomName);
	      $CurrentIdx  = get_SourceIdxByRoomId($RoomId);
	      foreach ($RoomSources as $SourceIdx=>$SourceData) {
	   		$DeviceNames = get_DeviceNamesByRoomId($RoomId, $SourceIdx, array(c_Property_Output));
				if (in_array($DeviceName, $DeviceNames)) {
				   if (!array_key_exists($RoomId, $SourceList)) {
				   	$SourceList[$RoomId] = $SourceIdx;
				   }
					if ($CurrentIdx==$SourceIdx) {
				   	$SourceList[$RoomId] = $SourceIdx;
					   break;
					}
				}
	      }
	   }
	   return $SourceList;
	}