Component: IoT Made Easy (Comms: IoT/Cloud): Difference between revisions
Appearance
XML import |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (22 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{| style="width:50%" | |||
{| | |||
|- | |- | ||
| width="20%" style="color: gray;" | Author | | width="20%" style="color:gray;" | Author | ||
| Matrix TSL | | Matrix TSL | ||
|- | |- | ||
| width="20%" style="color: gray;" | Version | | width="20%" style="color:gray;" | Version | ||
| 1.0 | | 1.0 | ||
|- | |- | ||
| width="20%" style="color: gray;" | Category | | width="20%" style="color:gray;" | Category | ||
| Comms: IoT/Cloud | | Comms: IoT/Cloud | ||
|} | |} | ||
==IoT Made Easy component== | |||
A component designed to simplify MQTT comms allowing for multiple data streams to be dealt with in a simple manner. Deals with translating values to and from the broker from topic strings into message IDs and numeric values. Works with lots of different MQTT brokers. | |||
== | ==Component Source Code== | ||
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_IoTMadeEasy.fcfx FC_Comp_Source_IoTMadeEasy.fcfx] | |||
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_IoTMadeEasy.fcfx FC_Comp_Source_IoTMadeEasy.fcfx] | |||
== | ==Detailed description== | ||
''No detailed description exists yet for this component'' | |||
==Examples== | |||
''<span style="color:red;">No additional examples</span>'' | |||
==Macro reference== | |||
===Connect=== | |||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''Connect''' | |||
|- | |||
| colspan="2" | Connect to the MQTT Server. Returns the connected state. 0 if not connected, 1 if successful connection, or already connected. | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
===Disconnect=== | |||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''Disconnect''' | |||
|- | |||
| colspan="2" | Disconnects from the MQTT server and the network | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
:[[ | ===ErrorAsString=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''ErrorAsString''' | |||
|- | |||
| colspan="2" | | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Error | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
===GetPayloadFloat=== | |||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''GetPayloadFloat''' | |||
|- | |||
| colspan="2" | Get the Payload of the last received (Read) packet as a floating point value | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
:[[ | ===GetPayloadInteger=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''GetPayloadInteger''' | |||
|- | |||
| colspan="2" | Get the Payload of the last received (Read) packet as a signed long value | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s32-icon.png]] - LONG | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
=== | ===GetPayloadString=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''GetPayloadString''' | |||
|- | |||
| colspan="2" | Get the Payload of the last received (Read) packet as a string value | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Payload | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Size | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
===GetTopicID=== | |||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''GetTopicID''' | |||
|- | |||
| colspan="2" | Compares the topic ID of the last received message with enabled IDs. Returns the topic ID received. | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
===Initialise=== | |||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''Initialise''' | |||
|- | |||
| colspan="2" | Starts up the MQTT component - call this after initialising the NetworkComms component. | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
:'' | ===LastError=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''LastError''' | |||
|- | |||
| colspan="2" | Returns the last error | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
''' | ===Ping=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''Ping''' | |||
|- | |||
| colspan="2" | Ping packet is sent to the server and checks for a reply. If nothing is sent or received within the keep alive period then a ping is required to keep the connection to the server active. Returns non-zero value if successful | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
===PublishFloat=== | |||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''PublishFloat''' | |||
|- | |||
| colspan="2" | Publishes data to the selected topic ID using a floating point value. Returns none zero if successful | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | TopicID | |||
|- | |||
| colspan="2" | The topic ID to publish data to | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT | |||
| width="90%" | Data | |||
|- | |||
| colspan="2" | Data to publish | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
Returns none zero if successful | ===PublishInteger=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''PublishInteger''' | |||
|- | |||
| colspan="2" | Publishes data to the selected topic ID using a signed long integer value. Returns none zero if successful | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | TopicID | |||
|- | |||
| colspan="2" | The topic ID to publish data to | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-s32-icon.png]] - LONG | |||
| width="90%" | Data | |||
|- | |||
| colspan="2" | Data to publish | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
===PublishString=== | |||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''PublishString''' | |||
|- | |||
| colspan="2" | Publishes data to the selected topic ID using a data string. Returns none zero if successful | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | TopicID | |||
|- | |||
== | | colspan="2" | The topic ID to publish data to | ||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Data | |||
|- | |||
: | | colspan="2" | Data string to publish | ||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
= | |||
''' | |||
=== | |||
: | |||
===Read=== | |||
== | {| class="mtx-class-macrotable wikitable" | ||
|- | |||
'' | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" class="mtx-class-macrohead" | '''Read''' | |||
|- | |||
| colspan="2" | Read incoming data. Returns non-zero if packet received. Use GetTopicID and GetPayloadXXX to read the contents. | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
==Property reference== | ==Property reference== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''Properties''' | |||
|- | |||
|- | |||
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | |||
| width="90%" class="mtx-class-propfolder" | MQTT Properties | |||
Port used by MQTT Broker | |- | ||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | LinkTo | |||
|- | |||
| colspan="2" | | |||
Client identifier (Maximum length 20 characters) | |- | ||
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]] | |||
| width="90%" | Host | |||
|- | |||
| colspan="2" | Address of MQTT Broker Can be an IP Address or URL (URL only supported by some hardware platforms) | |||
|- | |||
Maximum time in mS to wait for network responses | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
| width="90%" | Port | |||
|- | |||
| colspan="2" | Port used by MQTT Broker Default 1883 for unencrypted access and 8883 for encrypted access. | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]] | |||
The Keep Alive is the maximum time interval that is permitted to elapse | | width="90%" | Client identifier | ||
|- | |||
between the point at which the Client finishes transmitting one Control Packet | | colspan="2" | Client identifier (Maximum length 20 characters) Must be unique to the broker. | ||
|- | |||
and the point it starts sending the next, measured in seconds. | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
| width="90%" | Network Timeout | |||
|- | |||
| colspan="2" | Maximum time in mS to wait for network responses | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | |||
| width="90%" | Read Timeout | |||
|- | |||
| colspan="2" | Time to wait in ms when waiting for incoming messages | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | |||
| width="90%" | Keep Alive | |||
|- | |||
| colspan="2" | The Keep Alive is the maximum time interval that is permitted to elapse between the point at which the Client finishes transmitting one Control Packet and the point it starts sending the next, measured in seconds. | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Authentication | |||
|- | |||
| colspan="2" | Selects if the broker is open or if the broker requires a username and password. | |||
|- | |||
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | |||
| width="90%" class="mtx-class-propfolder" | Topics | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Number of topics | |||
|- | |||
| colspan="2" | Sets the number of data topics that can be sent or received | |||
|- | |||
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | |||
| width="90%" class="mtx-class-propfolder" | Topic ID: 0 | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]] | |||
| width="90%" | Topic String | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Topic Type | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | |||
| width="90%" class="mtx-class-propfolder" | Topic ID: 1 | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]] | |||
| width="90%" | Topic String | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Topic Type | |||
|- | |||
| colspan="2" | | |||
|} | |||
Latest revision as of 14:37, 13 July 2026
| Author | Matrix TSL |
| Version | 1.0 |
| Category | Comms: IoT/Cloud |
IoT Made Easy component
A component designed to simplify MQTT comms allowing for multiple data streams to be dealt with in a simple manner. Deals with translating values to and from the broker from topic strings into message IDs and numeric values. Works with lots of different MQTT brokers.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_IoTMadeEasy.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_IoTMadeEasy.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
Connect
| Connect | |
| Connect to the MQTT Server. Returns the connected state. 0 if not connected, 1 if successful connection, or already connected. | |
| Return | |
Disconnect
| Disconnect | |
| Disconnects from the MQTT server and the network | |
| Return | |
ErrorAsString
| ErrorAsString | |
| Error | |
| Return | |
GetPayloadFloat
| GetPayloadFloat | |
| Get the Payload of the last received (Read) packet as a floating point value | |
| Return | |
GetPayloadInteger
| GetPayloadInteger | |
| Get the Payload of the last received (Read) packet as a signed long value | |
| Return | |
GetPayloadString
| GetPayloadString | |
| Get the Payload of the last received (Read) packet as a string value | |
| Payload | |
| Size | |
| Return | |
GetTopicID
| GetTopicID | |
| Compares the topic ID of the last received message with enabled IDs. Returns the topic ID received. | |
| Return | |
Initialise
| Initialise | |
| Starts up the MQTT component - call this after initialising the NetworkComms component. | |
| Return | |
LastError
| LastError | |
| Returns the last error | |
| Return | |
Ping
PublishFloat
PublishInteger
PublishString
Read
| Read | |
| Read incoming data. Returns non-zero if packet received. Use GetTopicID and GetPayloadXXX to read the contents. | |
| Return | |