Giter Site home page Giter Site logo

edo-pasto / iotproject2022 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 70.88 MB

This Repo refers to my final project of Internet of Thingd of the related course of the University of Genova, A.Y. 2021/2022

License: MIT License

JavaScript 46.59% HTML 17.42% Shell 35.99%
actuators architecture context-broker css devices fiware html internet-of-things iot iot-platform

iotproject2022's Introduction

INSTRUCTIONS

PASTORINO EDOARDO,

Matricola: 5169595,

Internet Of Things

Requirements

Download and install Docker (https://www.docker.com/products/docker-desktop/) Download and install Node.js (https://nodejs.org/it/download/) Download and install DB Browser for Sqlite (https://sqlitebrowser.org/dl/)

npm install parcel axios mqtt http sqlite3

Start the project

For starting the MQTT Broker, the Orion Context Broker and the IoT agent of Fiware we have to run the following command in the prompt in the directory of the project:

./services start

if you have to first create all the services:

./services create

Start the U.I.

For starting the user interfaces we have to run in the terminal (for example in the terminal of VSCode) the command:

parcel index.html

and go the the URL: http://localhost:1234

Start the dummy devices

For starting a dummy devices we have first to run the following command using node:

node {FileName.js}

for example:

node waterSensorMQTT.js

After that, the sensor is listening for the start command that is activated by the button on the user interface. The dummy devices are waterSensorMQTT.js, airSensorMQTT.js, TemperatureSensorMQTT.js, humiditySensorMQTT.js and the actuator IrrigatorMQTT.js

Start the Subscribers

For showing the measures sent by the sensor we can start the subscriber of fiware with this command:

docker run -it --rm --name mqtt-subscriber \
  --network fiware_default efrecon/mqtt-client sub -h mosquitto -t "/#"

For registering the measure in an external database (IOTProjectDB.db) we have to start another subscriber that read the published data and write them on the DB:

node SubscriberMQTT.js

Get Data with curl

For getting the data of device we have to use curl, for example for the waterSensor:

curl -G -X GET \
  'http://localhost:1026/v2/entities/urn:ngsi-ld:WaterSensor:001' \
  -d 'type=Sensor' \
  -H 'fiware-service: openiot' \
  -H 'fiware-servicepath: /'

Links

iotproject2022's People

Contributors

edo-pasto avatar

Watchers

 avatar

Forkers

trellixvulnteam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.