VoffCon is a system for controlling devices and appliances from anywere. It is made up by two components. A node server and A device server. The main benefits of this system is your ability to create your own controls and cards, which other users logged in to your system can use to control devices you deside to put on your cards.
The node server
Is a server created with node.js. This server creates webpages which can be viewed in a web browser like Google Chrome, Microsoft Edge and Internet Explorer. If you portforward the server out to the internet you will be able to accsess your devices from anywhere. It uses the Passport authentication middleware to keep your devices from being controlled by everyone. The server provides connections to many devices and uses passport to make sure that the user is authenticated before he is able to give commands to the server running on the devices.
The basics for the node server
This application is a server intended to run on a computer where it can access the esp8266 and esp32 devices which run running a special server program which was developed for this server in mind.
You will need to install the following if you haven't already.
- MongoDb To store users cards, controls and device information. (Install tutorials or installing with package manager )
- Node.js To run the Node server
- Arduino IDE To program the devices.
- Device Core libraries for the device servers running on the two devices listed below. (Install instructions)
Getting up and running
Run the mongodb server
If MongoDb is not installed you will need to install it. See this instructions how to do that here.
Use windows file explorer to:
- Create the folders "C:\data" and "C:\data\db".
- Then Run the mongo server by Double-clicking on the file
Or just use the windows command shell, by typing the following commands.
mkdir C:\data mkdir C:\data\db "C:\Program Files\MongoDB\mongod.exe"
Installing VoffCon node server on Ubuntu 16.04 (Linux) when all prerequisites are missing
Assuming that you do not have Mongodb, nodejs or npm installed. This would be the process you would follow.
Reload local package database
sudo apt-get update
Install the MongoDB packages.
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list sudo apt-get install -y mongodb-org # Create dir to store data and run mongodb sudo mkdir /data sudo mkdir /data/db sudo mongod
sudo apt-get install -y nodejs sudo apt install npm
Install packages which the VoffCon app server uses and running the server
npm install node app
And the go to a modern web browser and visit the url http://localhost:6100 to see VoffCon running.
The Esp8266 Developement Module
The Esp32 Developement Module
Setting up the device server.
Click here to get instructions on how to setup the device server.
More about the system
There are three kinds of users (actors). "administrator", "power user/card creator" and a "normal user".
Has the power to change/modify or delete all cards, and devices. He can also give a user access to a card, or a device, just like a card creator. This user is the only one who can upgrade, downgrade or delete users. He can f.example change a normal user to "administrator" or a "power user". He can also change a power user back to a normal user. He has total control of everything.
Is a person who is able to change or create cards or devices. He needs to know how to upload programs to the devices. He needs to know what a subnet is and basic information about networking. He needs to have access to the routers so he can setup IP addresses for the devices. He is the one who will be adding the available devices for everybody. This person will also be creating control-cards. A power user will become a Card creator when he has created a Card or has been given access to change a card.
A card creator is a power user which has created a control card. He has the power to grant others access to his card. He can grant a normal user access to his card and that will allow the normal user to use his card. The normal user will also be able to press or view controls on his card. A card creator can also grant another power user to have a card creator privileges for his card.
User (normal user)
He knows how to use a browser and he also has recived information from the power user on how the control-cards work. He knows what the cards control and Do's and Don'ts about a device he Is able to control using the control-cards. All knowledge about the control-cards should be supplied by the power user.
A control card is a web-page which the normal user works with. On this card there are buttons or controls which allow the user to change or view the state of the different devices. One card can include controls for many devices. This control card is created by a power user. The creator of the card will also be the one who will give other users access to a card. By default only the user which created the card will have access to the card he created. The creator user can select any user and grant him an access to his card. The card creator is the only one who can modify it(with the exeption of the Administrator). He can grant other power user access to his card giving them the card-creator privileges. No other power user can access his card without the card-creator’s permission.
A Control is a control class which can be used when creating a card. These Controls can be thought of as a library. One control could be f.example DiodeCtrl. DiodeCtrl could be a class which shows an image of a diode which a Card creator can use to display a pins values as a diode. Another control could be a slider which allows the Card creator to provide the user an easy control of a pins value by allowing the user to drag a button on a slider around to change a device pin value. The same user access rules apply to Control as where described in the Control Card section above.
Access to devices
If a user wants to access a device then the system will grant him access if the user is a power user. The system will only give a normal user access to a device through a control card that controls the device.
Later additions to the system / nice to have
- Create a visual/drag'n drop editor, allowing power users create cards more easier.
- Create a visual/drag'n drop editor, allowing power users create controls more easier.
- Show running cards without the VoffCon menu.
VoffCon is a system for controlling devices and appliances from anywhere. It consists of two programs. A “node server” and a “device server”. Copyright (C) 2016 Gudjon Holm Sigurdsson This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Click here for a copy of the licence.
You can contact the author by sending email to firstname.lastname@example.org or by regular post to the address Haseyla 27, 260 Reykjanesbar, Iceland.