mqtt

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.

Below is the list of parameters that can appear in the messages received by the channel via mqtt protocol. In most parameters, the name consists of tags split by dots: tag1.tag2.tag3.tag4... Each tag defines a certain area of an application, e.g. any parameter that contains mileage data has the 'mileage' tag in the name and any parameter related to fuel control contains the 'fuel' tag. By default JSON fields of the message received by a channel via this protocol can only contain the below-specified parameters. Any additional parameter will be prefixed by the "custom" tag, e.g. "custom.unspecified-name".

Name Type Unit Description
channel_id number ID of channel that received message
custom Any custom parameter
ident string Device unique identificator and optional password
timestamp number seconds Message timestamp
No results found.