ibm-cloudmqttiotmendix

How to subscribe for device events in Mendix?


I have a device on IBM cloud IoT platform and I want to subscribe mendix to its events... I am using MQTT client form mendix app store for subscribing to device events.

Project Explorer:

enter image description here

Micro Flow enter image description here

MQTT Subscription

enter image description here

I have also debug the micro-flow it is giving me value of output variable named variable = false

enter image description here

and I have noticed that whenever app is started it is logs

subscribe: iot-2/type/TemperatureSensorSimulator/id/TemperatureSensorSimulator_1/mon as highlighted in micro-flow screenshot.

All I want is my mendix app to be subscribed to a device on IBM watson IoT platform and show me events sent by device to IBM IoT platform. Can Anyone tell me how can I do this in mendix?

I have already subscribed to events in nodejs app everything is fine. App is showing me events in log. I think I am doing something wrong in mendix micro-flow. I have pasted all the screenshots here. Any help in this regard will be highly appreciated

Thanks in Advance.


Solution

  • First, you need to make sure that you use an API-Key/token to connect and then you need to correct the topic to which you subscribe. The rule is:

    iot-2/type/device_type/id/device_id/evt/event_id/fmt/format_string
    

    So, yours should be:

    iot-2/type/TemperatureSensorSimulator/id/TemperatureSensorSimulator_1/evt/mon/fmt/json
    

    You should be fine afterwards.