A prototype REST-ful Home Automation system to remotely control devices at home, built in javascript. Runs in the browser.
AutoHome provides the following functionality:
- Add a device to the system.
- Remove a device from the system.
- List all devices in the system.
- Create a task for a device.
Note: Currently the system is not persistent i.e. if you refresh your browser, all data is lost. The data only lasts for the session.
Conversely speaking, you can just refresh your browser to reset the system :D
- Clone this repository.
- For macOS
git checkout macOS
, use master branch for windows. - Run
docker-compose up
from the root directory. - From your browser, go to
http://192.168.99.100:3000/
, this is where the application console exists.
Note: The specific IP address is used because the application is developed on a windows system.
If for some reason the application can not be built by docker-compose, follow the steps below:
- Clone this repository.
- From the root of the repository,
cd ./device/
npm install
npm i -g browserify
npm i -g mocha
(skip this step if you don't want to run tests)mkdir ./public/build
mkdir ./test
(skip this step if you don't want to run tests)browserify public/javascripts/listDevice.js --standalone listDevices > public/build/list.js
browserify public/javascripts/addDevice.js --standalone addDevice > public/build/addDevice.js
browserify public/javascripts/createTask.js --standalone performTask > public/build/task.js
browserify public/javascripts/removeDevice.js --standalone remove > public/build/remove.js
browserify public/utils/test.js --standalone testDeviceApi > public/build/test.js
browserify public/javascripts/xterms.js > public/build/bundle.js
npm start
- Go to
http://localhost:3000
for the application console.
Note: As the application is built on windows machine, the IP assigned to docker containers is 192.168.99.100
. The default docker build uses this address, so for manual build, this address needs to be replaced with localhost
in the following places:
device/public/javascripts/addDevice.js
device/public/javascripts/createTask.js
device/public/javascripts/listDevices.js
device/public/javascripts/removeDevices.js
device/utils/test.js
device/test/test-e2e.js
(skip this step if you don't want to run tests)
- Install the application by either using docker-compose or manually.
- Start the application.
- From the root of the repository,
npm test
(note that you need to have a fresh build of application)
The web console supports these basic commands:
list
: Lists all the devices currently available in the automation system. Syntax:list
add
: Adds a single device to the automation system. The name must not contain whitespace. Syntax:add <name of device>
task
: Creates task for a device. The task can not have whitespaces. Syntax:task <device_name> <task>
remove
: Removes specified device from the automation system. The name must not contain whitespace. Syntax:remove <device_name>
test
: Returns a string if the automation system is online. Syntax:test
help
: Prints in-console help.
As the application is built on windows machine, the master branch will work for windows, for macOS build, checkout the macOS branch and
run docker-compose up
from the root. Manual build remains the same with the exception of changing the programmed IP from 192.168.99.100
to localhost
.