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 Devices 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 Devices in the database.404 - Not Found
: This means the request failed or no Devices were found.500 - Server Error
: This means something went wrong with the function being called in the controller.
This route returns all Devices 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 devices in the given location.404 - Not Found
: This means the request failed or no Devices were found in the location.500 - Server Error
: This means something went wrong with the function being called in the controller.
This route returns all connected Devices. It takes no parameters and returns a list of connected devices. The format of the returned items is as follows:
IP
String
MAC
String
The possible returns are:
200 - OK
: This means Devices were found and have been returned.404 - Not found
: This means no Devices were found and the request failed.500 - Server Error
: This means there was a server error during the request, causing the request to fail.
This route finds a Device 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 Device with the ID requested.404 - Not Found
: This means the request failed or no Device 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 Device into the database. It can take five parameters. These are:
name
:String
Required
location
: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 Device table of the database.401 - Unauthorized
: This means the request was unauthorized and the Device was not inserted into the database.500 - Server Error
: This means the request failed, resulting in a Server Error.
This route updated a Devices state given an ID and a State. The ID must be the same as the _id of a Device in the database. The parameters are:
_id
: The ID of the Device having its state altered.state
: The state can be a 1 or a 0, 1 forON
and 0 forOFF
The possible resturns are:200 - OK
: This means the state of the Device was successfully altered.401 - Unauthorized
: This means the request failed and the Devices state was not altered.500 - Server Error
: This means there was an unexpected crash with the method being called by this controller.
This route calls the delete device function in the Delete handler. The possible parameters are:
_id
: The ID of the Device being deleted The possible returns are:200 - OK
- The function executed successfully, resulting in the deletion of a Device.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 Devices. If none found or an error, it rejects the request. It takes no parameters. If the request succeeds, all Devices in the database will be returned.
This method searches the database for any Devices matching the ID of the id parameter. If no Devices are found or an error occurs, the request is rejected. If the request succeeds, the Device matching that ID will be returned.
This method searches the database for any Devices in the given location. If no Devices are found or an error occurs, it rejects the request. If the request succeeds, all Devices in the location will be returned.
This method performs the ARP command in order to resolve the connected devices and their hardware addresses.
This method adds a Device to the database, given a device object. The Device object is then parsed into a newDevice object. If it fails to add a Device to the database, the request is rejected and the method fails. If the request succeeds, it will return the created Device.
This method finds a Device given an ID and updates the state. If no Device is found or an error occurs, the request is rejected. If the request succeeds, it will return the Device matching the given ID and its updated state.
This method finds a Device given an ID and deletes it. 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 Device.