Skip to content

i-maintenance/IOT-Adapter

Repository files navigation

IOT-Adapter

Connecting MQTT services with the i-Maintenance Messaging System.

This component subscribes to topics from the Internet of Things Protokoll MQTT and forwards them to the the Apache Kafka message broker, based on semantic interpretation from a SensorThings Server.

The Kafka Adapter based on the components:

Contents

  1. Requirements
  2. Deployment
  3. Configuration
  4. Trouble-Shooting

Requirements

  1. Install Docker version 1.10.0+
  2. Install Docker Compose version 1.6.0+
  3. Clone this repository

Deployment

The IOT-Adapter uses optionally Sensorthings to semantically describe the forwarded data. The later consumage of the sensor data with the suggested DB-Adapter works best with a running and feeded SensorThings Client.

Testing

Using docker-compose:

cd /iot-adapter
docker-compose up --build -d
```Trouble-shooting

The flag `-d` stands for running it in background (detached mode):


Watch the logs with:

```bash
docker-compose logs -f

Deployment in a docker swarm

Using docker stack:

If not already done, add a regitry instance to register the image

cd /iot-Adapter
docker service create --name registry --publish published=5001,target=5000 registry:2
curl 127.0.0.1:5001/v2/

This should output {}:

If running with docker-coTrouble-shootingmpose works, push the image in order to make the customized image runnable in the stack and deploy it:

cd ../iot-Adapter
./start-adapter.sh

Watch if everything worked fine with:

./show-adapter.sh

Configuration

Most configurations are done in the .env file in which all environment variables are set.

For more advanced options, the IOT-Adapter uses a Whitelist (datastreams.json) as well as a Blacklist (blacklist.json). The first one lists any data which should be forwarded into the i-Maintenance Messaging System with its corresponding SensorThings - Datastream-Id. The later lists sensordata that should be ignored by the IOT-Adapter. If data is fetched without being in any of these files, a warning message is produced that will be seen if running:

sudo docker service logs iot-adapter_adapter -f

Trouble-shooting

Can't apt-get update in Dockerfile:

Restart the service

sudo service docker restart

or add the file /etc/docker/daemon.json with the content:

{
    "dns": [your_dns, "8.8.8.8"]
}

where your_dns can be found with the command:

nmcli device show <interfacename> | grep IP4.DNS

Traceback of non zero code 4 or 128:

Restart service with sudo service docker restart

or add your dns address as described above

About

The IOT Adapter converts our 3D printer data into the canonic kafka message bus format.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •