private static final int MOTION_TIME_THRESHOLD = 60; // in seconds
private static final int CAMERA_FPS = 15;
private static final int CHECK_TIME_WAIT = 1; // in seconds
- private static final int SECOND_TO_TURN_ON = 60; // in seconds
+ private static final int SECOND_TO_TURN_ON = -1; // in seconds
private static final int SECOND_TO_TURN_OFF = 1; // in seconds
private static final int LOCK_DOOR = 0;
private static final int UNLOCK_DOOR = 1;
createKeyIoTCloud("alarm", NOT_ACTIVE);
System.out.println("DEBUG: Setting alarm to NOT-ACTIVE!");
}
- // TODO: Just use alarm for now as a status to cloud
+ // TODO: We can extend the usage of other keys to have a complete monitoring system for every device
/*for(SmartthingsSensorSmart smartSensor : smartSensorsSet.values()) {
createKeyIoTCloud("sensor" + Integer.toString(id++), NOT_ACTIVE);
* @return [void] None.
*/
private void updateIoTCloud(String key, IoTString val) {
-
+ // No key creation here!
try {
IoTString iotKey = new IoTString(key);
t1.update();
System.out.println("DEBUG: Initialized smartthings sensor! ID: " + sensorId + " Room ID: " + rm.getRoomID());
senDetectStatus.put(sensorId, false);
System.out.println("DEBUG: Initialized sensor detection to false!");
+ System.out.println("DEBUG: Now sensor ID is being set!");
// Initialize IoTCloud
-// createKeyIoTCloud("sensor" + Integer.toString(sensorId), NOT_ACTIVE);
-// System.out.println("DEBUG: Setting sensor" + sensorId + " to NOT-ACTIVE!");
sen.setId(sensorId++);
+ System.out.println("DEBUG: Set sensor ID to: " + sensorId + "!");
sen.registerCallback(this);
System.out.println("DEBUG: Registered sensor callback!");
} catch (Exception e) {
// Initialize detection to false
camDetectStatus.put(cam, false);
-
- // Initialize IoTCloud
-// createKeyIoTCloud("camera", NOT_ACTIVE);
-// System.out.println("DEBUG: Setting camera to NOT-ACTIVE!");
}
}
// Get and init the alarm (this single alarm set can serve multiple zones / rooms)
Iterator alarmIt = alarmSet.iterator();
AlarmSmart alm = (AlarmSmart) alarmIt.next();
- // Initialize IoTCloud - only 1 alarm
-// createKeyIoTCloud("alarm", NOT_ACTIVE);
-// System.out.println("DEBUG: Setting alarm to NOT-ACTIVE!");
// Initialize the alarm controller, do it here since it only needs to be done once per controller
try {
alm.init();
System.out.println("DEBUG: Initialized alarm!");
- // TODO: Check that this initialization works for multiple times - might be that setZone() only works once!
- //for (RoomSmart room : roomSet.values()) {
- // turnOffAlarms(room.getRoomID());
- // System.out.println("DEBUG: Initialized alarm for room (turn off): " + room.getRoomID());
- //}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("DEBUG: Initialized doorlock! ID: " + doorlockId);
doorlockStatus.put(doorlockId, false);
System.out.println("DEBUG: Initialized doorlock status to false!");
- // Initialize IoTCloud
-// createKeyIoTCloud("doorlock" + Integer.toString(doorlockId), NOT_ACTIVE);
-// System.out.println("DEBUG: Setting doorlock to NOT-ACTIVE!");
doorlock.setId(doorlockId++);
doorlock.registerCallback(this);
System.out.println("DEBUG: Registered doorlock callback!");
// Get and init the alarm (this single alarm set can serve multiple zones / rooms)
Iterator alarmIt = alarmSet.iterator();
AlarmSmart alm = (AlarmSmart) alarmIt.next();
- alm.setZone(zoneId, true, SECOND_TO_TURN_OFF);
+ alm.setZone(zoneId, true, SECOND_TO_TURN_ON);
updateIoTCloud("alarm", ACTIVE);
}
Iterator alarmIt = alarmSet.iterator();
AlarmSmart alm = (AlarmSmart) alarmIt.next();
// Turn this alarm off indefinitely
- alm.setZone(zoneId, false, SECOND_TO_TURN_ON);
+ alm.setZone(zoneId, false, SECOND_TO_TURN_OFF);
updateIoTCloud("alarm", NOT_ACTIVE);
}
*/
public void init() {
+ System.out.println("DEBUG: Stopping here for debug purposes!");
+ while(true) { }
+
// Initialize IoTCloud server
- initIoTCloudServer();
+ /*initIoTCloudServer();
// Iterate over the set of rooms
for (RoomSmart rm : roomSet.values()) {
// Init all Smartthings sensors
initSmartthingsSensors(rm);
- //try {
- // Thread.sleep(5000);
- //} catch (Exception e) {
- // e.printStackTrace();
- //}
-
}
// Init all doorlocks
initDoorLocks();
}
}
- }
+ }*/
}
}