public static void write(PrintWriter writer) {
		writer.println(PPData.FILESET_VERSION);

		for (Room room : Rooms.getRooms()) {
			for (RoomObject obj : room.getObjects()) {
				int manualOn = obj.getManualOn() * 60;
				int manualOff = obj.getManualOff() * 60;

				int jobIndex = -1;

				for (RoomJob job : obj.getJobs()) {
					jobIndex++;
					if (job.isActive()) {
						int fromTime = (job.getHourFrom() * 3600) + (job.getMinuteFrom() * 60);
						int toTime = (job.getHourTo() * 3600) + (job.getMinuteTo() * 60);

						int typeMask = 0x00; // default not dimmable
						int onOffMask = 0x00; // default is off

						int i = Actions.LIST.get(job.getAction()).getValue();


						System.out.println(obj.toString());

						if (obj.toString().equals("Lightning dimmable")) {
							typeMask = 0x80;
							onOffMask = 0xFF;
						} else if (obj.toString().equals("Wall socket on/off") || obj.toString().equals("Lightning on/off")) {
							typeMask = 0x00;
							onOffMask = 0x40;
						} else if (obj.toString().equals("Wall socket always on")) {
							typeMask = 0x40;
							onOffMask = 0x40;
						} else if (obj.toString().equals("Wall socket always off")) {
							typeMask = 0x00;
							onOffMask = 0x00;
						}


						//int action = onOffMask & i + typeMask;
						int action = (onOffMask & i) | typeMask;
								
						int node = (obj.getHcinode() - 1) + (24 * obj.getHci()); 

						int c1 = Conditions.getFromLabel(job.getCondition1()).getValue();
						int c2 = Conditions.getFromLabel(job.getCondition2()).getValue();
						int c3 = Conditions.getFromLabel(job.getCondition3()).getValue();

						int ttl = job.getTTL() * 60;

						writer.println(node + "," + jobIndex + "," + job.getPriority() + "," + c1 + "," + c2 + "," + c3 + "," + fromTime + "," + toTime + "," + ttl + "," + action + "," + manualOn + "," + manualOff);
					}
				}
			}
		}
	}