Maintainer’s Manual

Mobile-Controlled Lighting

Team 13

Saumil Kasbekar / Feasibility Analyst
SayaliSakhalkar / Software Architect
Anuradha Saini / Life Cycle Planner
Priyank Mishra / Project Manager
SagarSarda / Requirements Engineer
Ashutosh Kale / Prototyper
CoreyStall / Requirements Engineer/Shaper

04/30/2014

  1. Installation Instructions

●Install putty and winscp

For installing winscp please refer here:

For installing putty please refer here:

Before doing there steps please log into putty and winscp using the server credentials

●Install Node.js

  1. Download the package lists from the repositories and "updates" them to get information on the newest versions of packages and their dependencies

sudo apt-get update

  1. Install nodejs

sudo apt-get install nodejs

  1. Install node package manager (npm)

sudo apt-get install npm

●Install and run Mongo DB

  1. Download the package lists from the repositories and "updates" them to get information on the newest versions of packages and their dependencies

sudo apt-get update

  1. Install mongodb latest stable version

sudo apt-get install –y mongodb-org

  • Install redis client

npm install redis

2. Deploy Instructions

1. Copy and paste the server code in the home directory of the server. The root level of the directory looks like this

In order to keep the server running forever we need to install the forever library

To install nodejs forever library: sudo npm install forever

  • Install all the dependent packages and modules

Go to the root of the directory. Root directory is where package.json file exists.

Run npm install.

  • Run the server

forever start app.js

  • Stop the server

forever stop 0

  1. Ports

All the ports for various different applications are maintained in the server code

The server runs on port 3000

The MQTT server runs on port 4000

Mongo DB runs on local host and port is 27017

The ports for the applications are specified in the following files

Database local host URL:

config/database.js

Application Port: 3000

Specified in app.js in the home directory

MQTT server Port: 4000

Specified in mqtt/mqttserver_aes.js

All the ports are specified in the source code.

  1. Database Scripts

To connect to the database run the following command in putty

mongo localhost:27017/brave-backend

To clean up the database run the following scripts after connecting to the database

  1. Delete the entire contents of the database

db.gateways.remove({})

db.users.remove({})
db.accesstokens.remove({})

db.refreshtokens.remove({})

db.gates.remove({})

db.groups.remove({})

  1. Remove a particular user from the database

db.users.remove({email:"xxxxxxxxx"})

Specify the email of the user you want to remove

  1. Remove a particular gateway from the database

db.gateways.remove({serialNumber:”xxxxxxxxx”})

*This will permanently remove the data from the database.

  1. View contents of the database

Data stored in the database can be viewed through putty. After you connect to the database using mongo localhost:27017/brave-backend command, you can view the data stored in different files using the following commands

  • For users : db.users.find()
  • For gateways: db.users.find()
  • For accesstokens: db.accesstokens.find()
  • For groups: db.groups.find()
  1. To see data of a particular user : db.users.find({email:”xxxxxxxxx”})
  1. To see data of a particular gateway : db.gateways.find({serialNumber:”xxxxxxxxxxx”})
  1. Backup Server

Backing up the server code can be done through WinSCP. In order to back up the server codes please follow the following steps

  • Log into the WinSCP with the server credentials
  • From the root level select all the files and right click
  • Choose download and select the directory you want to download
  • Click ok and all the server code will be saved to the directory you choose

*WinSCP gives the option to “download and delete” & “download”. Choose download.

  1. Future Development
  • MQTT and updation of “all switch status” in the server through MQTT.
  • AES authentication between the gateway and the server during the gateway configuration.
  • If multiple devices are logged in the same gateway with the same user id and if one device logs out, right now all the devices get logged out. This needs to be fixed in future.
  • Add switch to a particular room/floor.
  • Add User management feature to the app.
  • Add authentication in the android app with AES or MD5.
  • Replace input gateway id screen with the new Drop down list for add gateway. The drop-down list for add gateway is wonderfully done. Change itto input the gateway id.I think in the future, the drop-down list should only show the gateway IDs that are connected in the same network (SSID) as the mobile device instead of the server, but I don’t know if this is possible to do.
  • If I have 2 switches, one has image, one doesn’t.If I deleted the switch with image, that image will automatically assign to the one without image.

1

Mobile-Controlled Lighting