flespi MQTT channel protocol by Gurtam is used to receive messages directly from MQTT broker.
Expected MQTT message payload should be valid JSON object and should contain at least "ident" attribute for unique device identification. Other JSON object attributes like "timestamp", "position.latitude", "position.longitude" are optional. Look into other protocols for suggested attributes names and values.
It is possible to use flespi MQTT broker as a central hub between IoT devices, smart sensors or custom platforms publishers and channel subscriber. In order to use it you need:
- Determine your unique topic that will be used for messages publishing, e.g. "messages/[device]".
- Create flespi token with either no ACL or with MQTT ACL only and possibility to publish to messages/+. Use this token for connecting publishers to flespi MQTT broker.
- Create another flespi token with either no ACL or with MQTT ACL only and possibility to subscribe to messages/+. Use this token for connecting subscribers to flespi MQTT broker.
- You can test both tokens directly from flespi MQTT broker page: one page with first token will publish messages another one should subscribe to # and receive them.
- Then you need to create channel with mqtt protocol and configure it to connect to flespi MQTT broker: uri=mqtt.flespi.io:1883, username=2nd-token, topic=messages/+.
- Enable/start channel and check in toolbox that you have no errors.
- Then you may publish messages from first web-page or directly from you smart sensors and they will appear in the channel and operate according to standard flespi telematics message pipeline - stored in device, re-published, streamed, etc.
It is possible to use just single token with no ACL for simplicity for both publishers and subscribers. Please look into tokens ACL article for more information.
You may also use mqtt protocol to subscribe to messages from another flespi channel, just subscribe it to correct topic, e.g. flespi/message/gw/#, see flespi MQTT-API for more information.