Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial with own MQTT-Broker - PLS Help #11

Closed
StWiemann opened this issue Mar 26, 2019 · 2 comments
Closed

Tutorial with own MQTT-Broker - PLS Help #11

StWiemann opened this issue Mar 26, 2019 · 2 comments

Comments

@StWiemann
Copy link

StWiemann commented Mar 26, 2019

Hi, I am fairly new to Fiware and I am interested in using an IoT-Agent to collect sensor data from an existing MQTT broker. I am trying to make things work by using this tutorial as a starting point and changing some environmentals in the docker-compose.yml.

The MQTT-broker I'd like to connect to uses root CA, mqtts and user credentials to login. My docker-compose looks like this:

iot-agent:
image: fiware/iotagent-ul:1.7.0
hostname: iot-agent
container_name: fiware-iot-agent
depends_on:
- mongo-db
- mosquitto
networks:
- default
expose:
- "4041"
ports:
- "4041:4041"
environment:
- IOTA_CB_HOST=orion # name of the context broker to update context
- IOTA_CB_PORT=1026 # port the context broker listens on to update context
- IOTA_NORTH_PORT=4041
- IOTA_REGISTRY_TYPE=mongodb #Whether to hold IoT device info in memory or in a database
- IOTA_LOG_LEVEL=DEBUG # The log level of the IoT Agent
- IOTA_TIMESTAMP=true # Supply timestamp information with each measurement
- IOTA_CB_NGSI_VERSION=v2 # use NGSIv2 when sending updates for active attributes
- IOTA_AUTOCAST=true # Ensure Ultralight number values are read as numbers not strings
- IOTA_MONGO_HOST=mongo-db # The host name of MongoDB
- IOTA_MONGO_PORT=27017 # The port mongoDB is listening on
- IOTA_MONGO_DB=iotagentul # The name of the database used in mongoDB
- IOTA_MQTT_HOST=hostaddress.de # The host name of the MQTT Broker
- IOTA_MQTT_PORT=8883 # The port the MQTT Broker is listening on to receive topics
- IOTA_MQTT_PROTOCOL=mqtts
- IOTA_MQTT_USERNAME=Mqtt-Account
- IOTA_MQTT_PASSWORD=Mqtt-Password

- IOTA_PROVIDER_URL=http://iot-agent:4041
healthcheck:
test: curl --fail -s http://iot-agent:4041/iot/about || exit 1

After docker-compose up I do provision a service and a device like in the tutorial and send the c|1 message to the according topic of the motion sensor (/4jggokgpepnvsb2uv4s40d59ov/motion001/attrs). But the IoT-Agent does not receive anything. I guess the connection to the broker fails. Can anyone please tell me what I am doing wrong here (most likely serveral things)? Do these environmentals even work with the iot-agent-ul? I found them in the documentation of the iotagent-json.

Edit: I changed the docker-image to iotagent-json and at least now it connects to the broker.

@jason-fox
Copy link
Member

In general, the tutorials aren't the right place to ask for general FIWARE support - please raise a question on StackOverflow tagged with fiware andiot where it will get a lot more exposure and attention.

You may be hitting the open issue #8 - There was a bug/undocumented change in the latest release of the Ultralight agent - this tutorial is deliberately still using Orion 2.1 and Ultralight 1.7.

The tutorial shows how to listen to an MQTT topic - you can check to see if anything is arriving (or send a spoof measure to check)

You can also check the debug from the IoT Agent to see if the debug log holds anything useful.

- IOTA_LOG_LEVEL=DEBUG

@StWiemann
Copy link
Author

As up to now the IoTA-UL does not support TLS connections for mqtt. This is also addressed by this Issue iotagent-ul/issue/354. I fixed that by having the broker on the same VM and doing a TLS termination with NGINX for all the other mqtt traffic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants