CyberSmart is a system designed to control and manage locations within your home by utilising a range of low cost hardware and Open Source Software solutions. This project is being developed as a University Group Project. The goal of this project is to create a low-cost, low-resource, eco-friendly Smart Home System. Our solution to this is to use a RESTful backend sitting on a hub that calls out to RESTful endpoints of nodes on the network, in order to update their state. In turn, each endpoint on the network polls every half an hour with a state update and timestamp. Each aspect of the system has been designed as a Microservice, allowing for interoperability with other systems.
- NodeJS - For creating a fast, lightweight solution for RESTful web servers! All APIs have been developed in Node.
- ReactJS - For creating an easy to work with UI design solution. The Frontend design has been developed in ReactJS.
- Python - For hardware level interaction (GPIO pins).
- Raspberry Pi Foundation - For consistently providing great quality hardware at brilliant prices! All CyberSmarts Nodes use the Raspberry Pi Zero, running Jessie Pixel Headless and the main hub uses a Raspberry Pi 3 Model B
- Lubuntu - For creating a neat, lightweight OS solution. The main hub uses Lubuntu.
- Locations API - For handling of Locations
- Devices API - For the handling of Devices
- Logger API - For creating logs
- Mobile App - For the Mobile App
- Database - CyberSmart Database
- User Interface - CyberSmart User Interface
- Node - CyberSmart Nodes (Plugs)
- The Slackers - Group Name
- Signal-Fire - Lead Developer
- DeanoLingardo - UI Design & Development
- Brandon P - App Development
- Jafoolly - UX & Hardware Design
- gilesbain - AI & Data Analysis
- GNU-GPL - Have fun bros!
This route returns all Locations in the given database context. It takes no parameters. The possible returns are:
200 - OK
: This means the request was successful. It should return an array of JSON Objects with all Locations in the database.404 - Not Found
: This means the request failed or no Locations were found.500 - Server Error
: This means something went wrong with the function being called in the controller.
This route returns all Locations within a given location. It takes one parameter, Location name. The possible returns are:
200 - OK
: This means the request was successful. It should return an array of JSON Objects with all Locations in the given location.404 - Not Found
: This means the request failed or no Locations were found in the location.500 - Server Error
: This means something went wrong with the function being called in the controller.
This route finds a Location by its ID. It takes on parameter, ID, which must be passed in in the format /<id>
in the URL.
The possible returns are:
200 - OK
: This means the request was successful. It should return a JSON Object containing information about the Location with the ID requested.404 - Not Found
: This means the request failed or no Location with the ID requested were found.500 - Server Error
: This means something went wrong with the function being called in the controller.
This route inserts a new Location into the database. It can take five parameters. These are:
name
:String
Required
state
:Number
Required
Default
:0
active
:Boolean
Required
Default
:0
date_added
:Date
Default
: Date.now The possible returns are:
201 - Created
: This means a new entry was created in the Location table of the database.401 - Unauthorized
: This means the request was unauthorized and the Location was not inserted into the database.500 - Server Error
: This means the request failed, resulting in a Server Error.
This route calls the delete Location by ID function in the Delete handler. The possible parameters are:
id
: The ID of the Location being deleted The possible returns are:200 - OK
- The function executed successfully, resulting in the deletion of a Location.401 - Unauthorized
: This means the request was unauthorized, meaning something went wrong.500 - Server Error
: This means something went wrong with the delete function, resulting in a server crash.
This route calls the delete Location by name function in the Delete handler. The possible parameters are:
name
: The name of the Location being deleted The possible returns are:200 - OK
- The function executed successfully, resulting in the deletion of a Location.401 - Unauthorized
: This means the request was unauthorized, meaning something went wrong.500 - Server Error
: This means something went wrong with the delete function, resulting in a server crash.
This method searches the database for all Locations. If none found or an error, it rejects the request. It takes no parameters. If the request succeeds, all Locations in the database will be returned.
This method searches the database for any Locations matching the ID of the id parameter. If no Locations are found or an error occurs, the request is rejected. If the request succeeds, the Location matching that ID will be returned.
This method adds a Location to the database, given a Location object. The Location object is then parsed into a newLocation object. If it fails to add a Location to the database, the request is rejected and the method fails. If the request succeeds, it will return the created Location.
This method finds a Location given an ID and updates the state. If no Location is found or an error occurs, the request is rejected. If the request succeeds, it will return the Location matching the given ID and its updated state.
This method finds a Location given an ID and sets the property active
to false. If there is an error during execution or the result is null, the method fails and is rejected.
If the method executes correctly, it sets active to false on the given Location.
This method finds a Location given a name and sets the property active
to false. If there is an error during execution or the result is null, the method fails and is rejected.
If the method executes correctly, it sets active to false on the given Location.