Shutters is a NodeJS project that I've created to command my home shutters from the Web. It's a responsive web application based on Twitter Bootstrap CSS Framework.
At home, I have motorized shutters using the DI-O by Chancon protocol. Has the protocol is quit simple, and the box they sale is quite expensive, I would like to create something using my Raspberry PI to command those shutters. So first, I made this Web App. Then I will create a scheduler to raise or lower them according to the sun rise and sun set...
When used from a mobile, you can only send the command to raise or lower your shutters. When used from a laptop you can add, edit, remove shutters and modify the user information (name, email address, login and password).
Actually all the job is done in the /routes/shutters.js function renderAction. Well it doesn't do anything but that is the place where you are supposed to call the external program to actually do the stuff.
For the list of shutters and the user, I'm using the NeDB. This is a Mongo like in-memory database. The DB content is saved on the HDD in the db directory.
The web framework is Express using Pug templating format.
The password is encrypted using bcrypt.
The authentication is made using Passport and Passport-local.
In order to make this work, follow these steps:
npm install
to download the dependencies- On linux there is the
bin/setup
shell script to add element in databases. update the user setting in the db/database.js more specifically the content of the user object:
var hashed = bcrypt.hashSync('six');
dbs.users.insert([ {
username : 'douglas',
password : hashed,
displayName : 'Douglas SIX',
email : 'six.douglas@gmail.com'
}
update the shutters settings in the db/database.js:
dbs.shutters.insert([ {
name : 'LivingRoom',
displayName : 'Living room',
remoteControlKey : 456123,
open : true
}, {
name : 'DiningRoom',
displayName : 'Dining room',
remoteControlKey : 123456,
open : false
}
Created with Nodeclipse (Eclipse Marketplace, site)
Nodeclipse is free open-source project that grows with your contributions.