A JavaScript application simulating house setting management. It allows to control following setting: temerature, light, courtines.
When the application starts it downloas saved settings from server (currently the communication is mocked and settings are loaded from /server/data/json file) and propagate the data to a controller. The contrloer allows users to change default setting. When the user changes any parameter then request to the server is send (server endpoints are replaced with satic files stored in server directory e.g. temerature to simulate sucessful responses from the server) and house vizualization is updated.
Following technolgies are being used in the project:
The application needs to be placed in any HTTP server. When it is done the application could be opened via index.html file.
In case of development a new controller follow the steps:
- Extend
/js/utils/ServerApi.jsfiles about methods for requesting and sending the controller data. - Add default value of the controller to
/server/data.jsonfile - Add new file into
serverdirectory which will be requested when a user change the controller value - Extend
/js/app/SensorModel.jsfile about new method and event for broadcasting the controller status change - Go to
index.htmlfile and- Add to
control-panelsection a input which will be used to managing the controller state - In
house-plansection updates rooms markup to present visually setting from the previos point
- Add to
- Create new directory in
/js/controllerswhich will containt all logic related to the new controller - Inside the new directory create following files
- Model file which contains logic executed when controller setting changes
- Panel file which sends event when a user change controller setting and listen on model changes
- Simulation file which listes on model chanages and visualize the changes on a mock
- Controller which esure proper data flow between model, panel and simulation objects