Used Datasets (HomeA Weather, UMass Smart* Dataset - 2017 release)
-
Install Python3.10 (and pip)
-
Install Ganache
-
Install Mosquitto Broker
-
Linux:
$ sudo apt install -y mosquitto $ sudo systemctl start mosquitto
-
macOS:
$ brew install mosquitto $ brew services start mosquitto
-
Windows: visit mosquitto.org
-
-
Set virtual environment
-
Linux/macOS:
$ python3.10 -m venv venv $ source venv/bin/activate
-
Windows:
$ py -3.10 -m venv venv $ .\venv\Scripts\activate
-
-
Install Requirements
$ pip3 install -r requirements.txt
-
Django Migrations
$ cd django_website $ python manage.py makemigrations core $ python manage.py migrate
-
Blockchain
# Change directory: $ cd blockchain/ # Compile Solidity: $ python compile_contract.py # Deploy compiled contract: $ python deploy.py # Run event handler: $ python event_handler.py
-
Test event handler by adding data blockchain
$ python add_sensor_data.py
Should you see the event message and its data, then blockchain has been successfully set up.
-
-
Run Mosquitto Broker service on
localhost:1883
-
Run Ganache on
localhost:7545
-
In Terminal
-
Run django server:
$ python manage.py runserver
- visit Admin Panel (username=admin | password=admin)
-
Run
blockchain/event_handler.py
(pushes notification to django from blockchain) -
Run
blockchain/subscriber.py
(subscribes to broker) -
Run
blockchain/publisher.py
(publishes to broker)
-
-
Now you should have a data flow!