Group 14 - EEL 4914/5 - Senior Design Summer/Fall 19
####################################################

Home Security and Automation System
************************************

Project Description
--------------------

Popularity of smart home systems are on the rise, but many are extremely expensive. We realized that the idea of a smart home already has many subsystems for monitoring activity, so we decided to combine an automated home system with a safety system for an all-in-one interface. It will be comparatively low-cost to other automated home systems and include security functionality such as fire detection, front-door identification, and light management.

Goals & Objectives
===================

The main goal of this project is to make the daily life of our end-user easier. We want our users, to be able to control most of the devices in their household and to receive alerts about them in an efficient and simple manner. We also another important goal to build a low power system. In this way, we are able to provide the customer with a low-cost system and at the same time we can monitor the household power usage to further reduce energy costs.


:Authors:
          - Avery Stevenson - Photonic Science and Engineering
          - Felix Henriquez - Computer Engineering
          - Guilherme Costa - Computer Engineering
          - Matthew Allen - Computer Engineering

How to build this project locally
---------------------------------

1. Make sure you are using Python Version 3+

2. Create a virtual environment

3. From the terminal window, do:
::
	pip install -r requirements.txt
5. Next change directory to:
::
	"/Backend/SD-HSAS/"
6. Run the following command:
::
	python manage.py makemigrations
7. Run the following command:
::
	python manage.py migrate
8. Finally, run:
::
	python manage.py runserver
| 9. If you navigate to http://127.0.0.1:8000 the server should be running
10. Also, if you want to test admin functions you can do the following from the terminal:
::
	python manage.py createsuperuser
| 11. Then you can navigate to http://127.0.0.1:8000/admin

What is included in this build
-------------------------------

1. Account Creation
2. Account Login
3. View/Edit Profile
4. Ability to add Light (Switches)
5. Ability to edit Lights Location
6. Ability to delete Lights
7. Ability to add Outlets
8. Ability to edit Outlets Location
9. Ability to delete Outlets
10. Ability to add HVAC System
11. Ability to edit HVAC
12. Ability to delete HVAC
13. Ability to Add Fire Detection System
14. Ability to edit Fire Detection System
15. Ability to delete Fire Detection System
16. Ability to Add Motion Sensor System
17. Ability to edit Motion Sensor System
18. Ability to delete Motion Sensor System
19. Ability to delete user account
20. MongoDB
21. AWS

Models
------

 Fire Detector
1. sn - Integer
2. deviceType - Char
3. status - Char
4. pin - Integer
5. owner_id - Integer

 HVAC
1. sn - Integer
2. deviceType - Char
3. setTemperature - Integer
4. temperature - Integer
5. on - Integer
6. humidity - Integer
7. cooling - Integer
8. owner_id - Integer

 Switch
1. sn - Integer
2. deviceType - Char
3. status - Char
4. location - Char
5. owner_id - Integer

 Motion Sensor
1. sn - Integer
2. status - Char
3. pin - Integer
4. owner - Integer
5. light_rel_id - Switch Object
6. timemout - Integer

 Outlets
1. sn - Integer
2. status - Integer
3. location - Char
4. owner_id - Integer

API Endpoints
-------------

Although the API is not being used I left the endpoints available for ease of testing. Also, keep in mind that authentication is not implemented.

GET/POST:
::
	/api/switch/
	/api/outlets/
	/api/hvac/
	/api/fd/
	/api/ms/

PUT/DELETE:
::
	/api/switch/id/
	/api/outlets/id/
	/api/hvac/id/
	/api/fd/id/
	/api/ms/id/

ATTENTION
----------------------

In order for this code to run properly AWS and MongoDB Atlas credentials are needed!

Videos
-------

| UV Sensor Test with Stovetop
1. https://youtu.be/4DY4OAkEjuw

| UV Sensor Test with Stovetop
2. https://youtu.be/J_8T9Ewe9KM

| UV Sensor Test with Lighter
3. https://youtu.be/Z_3NRNLcpPc

| LED Toggle Test
4. https://youtu.be/0MOsSevO9-g

| IR Sensor Test with Stovetop
5. https://youtu.be/xVL0gwX6X90

| IR Sensor Test with Pan
6. https://youtu.be/w-xQOVGP3dg

| IR Sensor Test with Lighter:
7. https://youtu.be/yn8FZJh9vn0

| Fire Detector 1ft:
8. https://youtu.be/LxkvcKRcQLc

| Fire Detector 2ft:
9. https://youtu.be/t9DCv1Y6tlk
