Skip to content

Latest commit

 

History

History

2019.05 - Project Lamp Barcella

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Project Lamp - Barcella Elettricittà

In May 2019 we presented the project at Elettricittà fair, organised by Barcella Elettroforniture at the Bergamo Exhibition Center. We did some improvements for the occasion: we realized a new Telegram bot, simpler and easier to use, and a new web app, to control the lamps also with a computer, using a web browser. Here you can find all you need to run the project. We used the same Arduino sketch made last year, so you can refer here.

Raul and Cristian at the project fair booth Raul and Cristian at the project fair booth.

Setting up the server

python3 -m venv env
source env/bin/activate
pip install -r requirements.txt

In app.py: edit BOT_TOKEN with your Telegram bot token, generated by @BotFather.
If you want to use the web app outside localhost, insert in ALLOWED_IPS the IPs of the clients you want authorize.
Please note that there isn't any kind of authentication system, the clients you insert here will have full control, and they can also get your Telegram bot token. This could be improved, but for our usage it was fine.
Open sqlite.db with an editor, like that, and update the table lamps according to the IPs of your Arduino.

Starting the server

source env/bin/activate
python app.py &
python telegram.py &

Setting up the client

npm install

In src/main.js: edit SERVER_HOST with the IP of the server where app.py is running.

Starting the client

npm start               # allow only access from localhost
HOST=0.0.0.0 npm start  # allow access outside localhost

The client run on port 8080, so you can use it by typing http://[YOUR_IP]:8080 in your web browser.