Exemplo n.º 1
0
	function Entertainment_TurnOffAllRoomesAndDevices() {
	   IPSLogger_Inf(__file__, 'Turn Off all Roomes and Devices');
		$RoomIds =  get_ActiveRoomIds();
	   foreach ($RoomIds as $RoomId) {
			Entertainment_SetRoomPowerByRoomId($RoomId, false);
		}
		Entertainment_PowerOffUnusedDevices();
	}
Exemplo 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_ActiveDeviceNames() {
		$ActiveRoomIds     = get_ActiveRoomIds();
		$ActiveDeviceNames = array();
		foreach ($ActiveRoomIds as $RoomId) {
			$DeviceNames = get_DeviceNamesByRoomId($RoomId);
			foreach ($DeviceNames as $DeviceName) {
				$ActiveDeviceNames[$DeviceName] = $DeviceName;
			}
		}
		return $ActiveDeviceNames;
	}