The Mainflux domain model is based around 3 entities: users, things and channels
user represents the real (human) user of the system
things represents devices and applications connected to Mainflux. There are two types of "things" supported at the moment: device and app. Device is used to represent any physical device connected to the platform. App represents any 3rd party service that uses the platform for message exchange with things.
channel represents a communication channel and serves as message topic that can be consumed by things connected to it
- I will create a user, 2 things and a channel
- then connect things to channels via cli
- and show mqtt (using mosquitto client) and http examples
added depends_on to nginx in docker-compose.yaml
docker-compose up
cli users
cli users create john.doe@acme.org password
cli users token john.doe@acme.org password
set USERTOK=ID
cli things create
cli things create "{\"type\": \"device\", \"name\": \"arduino http\"}" %usertok%
cli things create "{\"type\": \"device\", \"name\": \"beaglebone mqtt\"}" %usertok%
cli things create "{\"type\": \"app\", \"name\": \"mosquitto_sub\"}" %usertok%
cli things get ID %usertok%
cli things get all %usertok%
cli channels create "{\"name\":\"testchan\"}" %usertok%
cli channels get ID %usertok%
cli channels get all %usertok%
cli things connect
cli things connect THINGID CHANNELID %usertok%
cli things connect APPID CHANNELID %usertok%
prepared a clihelper image which includes mosquitto-clients and curl
switch to third cmder panel and show app subscribing to things via mqtt
clihelper mosquitto_sub -u APPID -P THINGKEY -t channels/CHANNELID/messages
switch to cli cmder panel and show things sending un-normalized message via mqtt
clihelper mosquitto_pub -u MQTTTHINGID -P APPKEY -t channels/CHANNELID/messages -m "test"
expects messages in SenML format e.g. message with 2 readings (see rfc8428 for details)
[{"bn":"some-base-name","bt":"1.276020076001e+09","bu":"A","bver":5,"n":"voltage","u":"V","v":"120.1"},{"n":"current","t":-5,"v":1.2},{"n":"current","t":-4,"v":1.3}]
show thing sending senml message via https
clihelper curl --cacert shared/mainflux-server.crt --insecure -X POST -H "Authorization: HTTPTHINGKEY" https://localhost/http/channels/CHANNELID/messages -d "@/root/senml/ex1.json"
Not shown: LoRa adapter or influxdb with reader and writer
+----------+
| |-------------------------------------------+
+----------+ | | +----------+ +----------+ |
| dashflux | ---| | |normalizer| ---| | +----------+
+----------+ | | +----------+ | | +--| things |--+
| | | | | +----------+ |
+----------+ | | +----------+ | | | +----------+ |
| cli | ---| |--- | http | ---| | +--| pgsql | |
+----------+ | | +----------+ | | +----------+ |
| nginx | +----------+ | | |
+----------+ | |--- | mqtt/ws | ---| nats | |
| app |<---| | +----------+ | | +----------+ |
+----------+ | | +----------+ | | +--| pgsql | |
| |--- | ws | ---| | | +----------+ |
+----------+ | | +----------+ | | | +----------+ |
| thing |>---| | +----------+ | | +--| users |--+
+----------+ | |--- | coap | ---| | +----------+
| | +----------+ +----------+ |
| |-------------------------------------------+
+----------+
|
+----------+
| redis |
+----------+
Thanks for the guide, how do you draw this ASCII diagram, from scratch or are there some tools out there