## BEST in IoT [Miroslav "mirek" Biňas](https://bletvaska.github.io) / [**BEST Summer**](https://mpc-edu.sk/sk)
[![mirek](images/mirek.na.hackathone.jpg)](https://bletvaska.github.io)
## What is IoT?
> Internet of Things (IoT) means any smart device with ability to communicate via Internet. > -- _by [iotbuzzer.com](https://iotbuzzer.com/what-is-iot-top-10-definitions-overview/)_
## IoT is built on data
* **data producers** (sensors) * **data consumers** (actuators)
![Smart Waste Service](images/smart.waste.service.jpg)
## IoT is also about... * hardware * low power * communication * data (data science, (time series) db) * updates (ota) * security
## IoT is abou Additional Value
[![Node-RED Logo](images/logo-node.red.png)](https://nodered.org)
## What is Node-RED I.? > [Node-RED](https://nodered.org) is a **visual tool** for **wiring** the Internet of Things. (2016) > **Flow-based programming** for the Internet of Things. (2017) > **Low-code programming** for **event-driven applications**. (2019)
## What is Node-RED II.? > [Node-RED](https://nodered.org) is a **programming tool** for **wiring** together hardware devices, APIs and online services in new and interesting ways. (2022) > The easiest way to **collect**, **transform** and **visualize** real-time data. ([homepage](https://nodered.org))
## And besides that... * open source (for free) * platform independent ([nodejs](https://nodejs.org/)) * runs in browser
### "Traditional" Requirements for IoT Solution Development * Low-level programming skills * Hardware design expertise * Understanding of electronics * Knowledge of complex APIs for external service integration * Experience with Time Series Databases (TSDBs) * Knowledge of Data Analytics (DA) and Machine Learning (ML) for extracting insights from stored data
[Node-RED](https://nodered.org) handles the technical aspects of your solution, allowing you to focus on your workflow.
## Running Node-RED 1. start [Node-RED Docker Container](https://hub.docker.com/r/nodered/node-red) ```bash $ docker container run --rm -it \ --publish 1880:1880 \ --volume node_red_data:/data \ --name nodered \ nodered/node-red ``` 2. open browser at [`http://localhost:1880`](http://localhost:1880)
## Hello world!
## What is FBP? > **Flow-Based Programming** is a programming paradigm that defines applications as **networks** of "black box" processes, which exchange data across predefined **connections** by **message passing**, where the connections are specified **externally** to the processes. ([Wikipedia](https://en.wikipedia.org/wiki/Flow-based_programming))
## The Message ```json { "_msgid": "89cbb063.7f7a7", "payload": "Hello world!", "topic": "Greetings!" } ```
## Meteo Servis ([inspiration](https://meteo.skola.sk/meteostanica/?id=22))
[![node-red-contrib-web-worldmap](images/worldmap.node.gif)](https://flows.nodered.org/node/node-red-contrib-web-worldmap) [node-red-contrib-web-worldmap](https://flows.nodered.org/node/node-red-contrib-web-worldmap)
[![OpenWeatherMap.org](images/logo-openweathermap.png)](https://openweathermap.org) * node: [node-red-node-openweathermap](https://flows.nodered.org/node/node-red-node-openweathermap) * API key: `b85449dbf5d71ab387d93367c7f1b790` * [current weather data in a machine-readable format](http://api.openweathermap.org/data/2.5/weather?units=metric&q=dolny%20kubin,sk&appid=b85449dbf5d71ab387d93367c7f1b790) * HTTP protocol (REST API) * JSON format
## MQTT
![How MQTT Works](images/how.mqtt.works.png) Notes: * https://www.eclipse.org/community/eclipse_newsletter/2014/october/article2.php
### What else can Node-RED do? * Build custom web applications * Create custom REST APIs * Develop custom dashboards * Integrate with database systems * Connect to external services (e.g., Twitter and many others) * Develop custom nodes (natively in JavaScript or in Python) * and much more
## Questions?
## Resources * [Node-RED homepage](https://nodered.org) * [resulting flow](resources/flow-meteoserice.json) * [Node-RED channel on YouTube](https://www.youtube.com/channel/UCQaB8NXBEPod7Ab8PPCLLAA)