HiveMQ Edge Protocol Adapters
HiveMQ Edge allows the runtime to connect to any proprietary protocol format and converts it into open standards MQTT. In HiveMQ Edge, the components that contribute this functionality are called 'protocol adapters'. To contribute new protocol adapters, you can create your own module that conforms to the requisite format and build the adapters into your runtime. When contributed, the runtime will manage the lifecycle of these components and allow you to create any number of connections to your devices.
HiveMQ Edge Protocol Adapter Configuration
Adapter instances can be added to the system using API, static configuration, or the user interface.
All 3 mechanisms result in the main config.xml
file being updated with a new element within the <protocol-adapters>
element.
Each adapter type has its own element name which matches the adapter type name in the ProtocolAdapterFactory.
For example, the 'Simulation' protocol has a type of 'simulation' and a <simulation></simulation>
configuration element.
In the adapter configuration, each adapter instance much be identified with a unique <id>
element .
The HiveMQ Edge UI and API automatically validate the uniqueness of the instance. |
HiveMQ Edge Provides the following protocol adapters:
Custom adapters can be built to adapt further protocols to fit your business needs.
Simulation Adapter
The simulation adapter enables the system to be configured to publish messages with random values through the protocol adapter layer at a specific interval. This functionality enables you to observe the behavior of adapters in the system.
The example configuration publishes random data with MQTT quality of service level 1 to the destination topic called 'topic'.
<simulation>
<id>test-simulation-server</id>
<minValue>-10</minValue>
<maxValue>10</maxValue>
<pollingIntervalMillis>5000</pollingIntervalMillis>
<subscriptions>
<subscription>
<destination>test</destination>
<qos>1</qos>
</subscription>
</subscriptions>
</simulation>
Simulation Adapter Properties
Property Name | Default | Mandatory | Description | Format |
---|---|---|---|---|
|
The unique identifier of the selected adapter instance. |
String [a-zA-Z0-9-_] |
||
|
|
Time in milliseconds between the publish operations of the simulator. |
Integer |
|
|
|
Minimum limit for the randomly generated values of the simulator. |
Integer |
|
|
|
Maximum limit for the randomly generated values of the simulator. |
Integer |
|
|
The destination topic to which the adapter publishes. |
String UTF-8 |
||
|
|
The quality of service level the adapter uses for the publish operation. |
Integer |
ModBus (TCP) Adapter
The ModBus adapter enables connections to ModBus slaves via TCP. Currently, the input registers can be read in the range 0-65534 (incl). The connection samples the ModBus slave on the sampling time specified in the configuration. Each connection can be configured to only publish samples when changes in values are detected.
<modbus>
<id>modbus-connection</id>
<port>502</port>
<host>some-ip4-address</host>
<publishChangedDataOnly>true</publishChangedDataOnly>
<publishingInterval>500</publishingInterval>
<subscriptions>
<subscription>
<holding-registers>
<endIdx>1</endIdx>
<startIdx>0</startIdx>
</holding-registers>
<destination>test</destination>
</subscription>
</subscriptions>
<maxPollingErrorsBeforeRemoval>5</maxPollingErrorsBeforeRemoval>
</modbus>
ModBus (TCP) Adapter Properties
Property Name | Default | Mandatory | Description | Format |
---|---|---|---|---|
|
The unique identifier of the selected adapter instance. |
String [a-zA-Z0-9-_] |
||
|
The host or IPv4/IPv6 of the ModBus device. |
URI |
||
|
The port to connect to. |
Integer 1-65535 |
||
|
|
Specifies whether the adapter only publishes data when a field value change is detected. |
Boolean |
|
|
|
Time in milliseconds between samplings. |
Integer |
|
|
A parent element to denote the subscriptions to the holding registers. |
Address range |
||
|
|
The start index (inclusive) of the holding register to read. |
Integer 0-65534 |
|
|
|
The end index (inclusive) of the holding register to read. |
Integer 0-65534 |
|
|
The destination topic to which the adapter publishes. |
MQTT topic |
||
|
|
The quality of service to be used for the publish operation. |
MQTT QoS |
|
|
|
The number of times the adapter attempts to sample while an error condition is detected. If the configured maximum is exceeded, the sampling job ceases to execute until the connection is re-established. |
Integer |
Each sample is published as an array with each 16-bit index encoded as an 2 octet decimal value. |
OPC UA Adapter
The OPC UA adapter enables connections to OPC UA servers. The connection creates subscriptions with the OPC UA server and discovers available nodes on the server.
Subscriptions to OPC nodes can be made to node IDs that represent a value or nodes that represent an object or structure. Only changed values and an initial value when setting up the subscription are published.
{
"value": 1000
}
{
"value": {
"Position_Reached": false,
"Target_Position": 2700,
"Increment": 0,
"Actual_Position": 0,
"Config": {
"Ref_Pos": 0,
"Loop_Value": 0
}
}
}
<opc-ua-client>
<id>opc-example</id>
<uri>opc.tcp://my-opc-server-uri-or-ip:4840</uri>
<subscriptions>
<subscription>
<node>ns=3;s="node-name"</node>
<mqtt-topic>my/mqtt/topic/1</mqtt-topic>
</subscription>
</subscriptions>
</opc-ua-client>
<hivemq>
...
<protocol-adapters>
<opc-ua-client>
<id>full-opc-example</id>
<uri>opc.tcp://my-opc-server-uri-or-ip:4840</uri>
<auth>
<basic>
<username>my-user</username>
<password>secret</password>
</basic>
</auth>
<tls>
<enabled>true</enabled>
<keystore>
<path>/path/to/my/keystore.jks</path>
<password>keystore-password</password>
<private-key-password>key-password</private-key-password>
</keystore>
<truststore>
<path>/path/to/my/truststore.jks</path>
<password>truststore-password</password>
</truststore>
</tls>
<security>
<policy>BASIC256SHA256</policy>
</security>
<subscriptions>
<subscription>
<node>ns=3;s="node-name"</node>
<mqtt-topic>my/mqtt/topic/1</mqtt-topic>
<qos>2</qos>
<message-expiry-interval>60</message-expiry-interval>
<publishing-interval>1000</publishing-interval>
<server-queue-size>1</server-queue-size>
</subscription>
<subscription>
<node>ns=3;i=101</node>
<mqtt-topic>my/mqtt/topic/2</mqtt-topic>
</subscription>
</subscriptions>
</opc-ua-client>
</protocol-adapters>
...
</hivemq>
OPC UA Adapter Properties
Property Name | Default | Mandatory | Description | Format |
---|---|---|---|---|
|
The unique identifier of the selected adapter instance. |
String [a-zA-Z0-9-_] |
||
|
URI of the OPC-UA server to connect to. |
URI |
||
|
|
Authentication mechanism |
||
|
|
TLS configuration |
Boolean |
|
|
|
OPC UA Security Policy to use. |
|
|
|
A parent element to denote the subscriptions to the OPC UA server. |
|||
|
The OPC UA node ID to subscribe to |
OPC UA parsable node identifier.
Example: |
||
|
The MQTT topic to which the changed values are published. |
MQTT topic |
||
|
|
The MQTT Quality of Service to use for the publishes. |
MQTT QoS |
|
|
|
The message expiry in seconds that is used for the MQTT message. |
Integer 1-4294967294 |
|
|
|
OPC UA publishing interval in milliseconds for this subscription on the server. |
Integer >1 |
|
|
|
OPC UA queue size for this subscription on the server. |
Integer >1 |
OPC UA Authentication
HiveMQ Edge supports basic authentication and x509 authentication against OPC UA servers.
OPC UA TLS configuration
HiveMQ Edge supports connections to OPC UA servers with TLS and mutual TLS.
To utilize mTLS, specify a keystore and enable x509
authentication.
<opc-ua-client>
...
<tls>
<enabled>true</enabled>
</tls>
...
</opc-ua-client>
<opc-ua-client>
...
<tls>
<enabled>true</enabled>
<keystore>
<path>/path/to/my/keystore.jks</path>
<password>keystore-password</password>
<private-key-password>key-password</private-key-password>
</keystore>
<truststore>
<path>/path/to/my/truststore.jks</path>
<password>truststore-password</password>
</truststore>
</tls>
...
</opc-ua-client>
Property Name | Default | Mandatory | Description |
---|---|---|---|
|
|
Defines whether TLS is enabled. |
|
|
Keystore that contains the private key and certificate chain for the client certificate. |
||
|
|
Truststore to verify the server certificate against. |
S7 Adapter
The S7 adapter enables connections to Siemens S7 PLCs. Tags and data blocks can be read by the adapter.
S7 PUT/GET must be enabled on the PLC (Programmable Logic Controller), otherwise a connection with the S7 adapter is not possible.
The setting can be found on your TIA Portal in the General tab, under Protection & Security → Connection mechanisms → Permit access with PUT/GET communication from remote partner .
|
<s7>
<id>my-s7-id</id>
<host>my-ip-address-or-host</host>
<port>102</port>
<controllerType>S7_1500</controllerType>
<subscriptions>
<subscription>
<tagName>my-tag-name-1</tagName>
<tagAddress>%I204.0</tagAddress>
<destination>my/topic/1</destination>
<dataType>SINT</dataType>
<qos>1</qos>
</subscription>
</subscriptions>
</s7>
<s7>
<id>my-s7-id</id>
<host>my-ip-addr-or-host</host>
<port>102</port>
<controllerType>S7_1500</controllerType>
<maxPollingErrorsBeforeRemoval>10</maxPollingErrorsBeforeRemoval>
<pollingIntervalMillis>1000</pollingIntervalMillis>
<remoteRack>0</remoteRack>
<remoteSlot>0</remoteSlot>
<remoteRack2>1</remoteRack2>
<remoteSlot2>0</remoteSlot2>
<remoteTsap>0</remoteTsap>
<publishChangedDataOnly>true</publishChangedDataOnly>
<subscriptions>
<subscription>
<tagName>my-tag-name-1</tagName>
<tagAddress>%I204.0</tagAddress>
<destination>my/topic/1</destination>
<dataType>BOOL</dataType>
<qos>1</qos>
<messageHandlingOptions>MQTTMessagePerTag</messageHandlingOptions>
<includeTimestamp>true</includeTimestamp>
<includeTagNames>false</includeTagNames>
</subscription>
<subscription>
<tagName>my-tag-name-2</tagName>
<tagAddress>%I205.0</tagAddress>
<destination>my/topic/2</destination>
<dataType>BOOL</dataType>
<qos>0</qos>
<messageHandlingOptions>MQTTMessagePerTag</messageHandlingOptions>
<includeTimestamp>true</includeTimestamp>
<includeTagNames>true</includeTagNames>
</subscription>
</subscriptions>
</s7>
S7 Adapter Properties
Property Name | Default | Mandatory | Description | Format |
---|---|---|---|---|
|
The unique identifier of the selected adapter instance. |
String [a-zA-Z0-9-_] |
||
|
The host or IPv4/IPv6 of the S7 device. |
URI |
||
|
The port to which the adapter connects. |
Integer 1-65535 |
||
|
The series of the S7 PLC (Programmable Logic Controller). |
one of: |
||
|
|
Specifies whether the adapter only publishes data when a field value change is detected. |
Boolean |
|
|
|
Time in milliseconds between samplings. |
Integer |
|
|
|
The number of times the adapter attempts to sample while an error condition is detected. If the configured maximum is exceeded, the sampling job ceases to execute until the connection is re-established. |
Integer |
|
|
|
Rack value for the remote main CPU. |
Integer |
|
|
|
Slot value for the remote main CPU. |
Integer |
|
|
|
Rack value for the remote secondary CPU. |
Integer |
|
|
|
Slot value for the remote secondary CPU. |
Integer |
|
|
|
Remote TSAP value. The TSAP (Transport Services Access Point) mechanism is used as a further addressing level in the S7 PLC network. Usually, the value is only required for PLCs from the LOGO series. |
Integer |
|
|
|
The quality of service to be used for the publish operation. |
MQTT QoS |
|
|
The destination topic to which the adapter publishes. |
MQTT Topic |
||
|
The name of the selected tag. |
String [a-zA-Z0-9-_] |
||
|
The address of the selected tag. For more information, see S7 Tag Address |
S7 Tag Address |
||
|
|
Specifies whether a server timestamp is included in the resulting MQTT message. |
|
|
|
|
Specifies whether the tag name is included in the resulting MQTT message. |
|
|
|
|
Defines the format of the resulting MQTT message. Either one message per changed tag or one message per subscription with multiple data points per sample |
|
S7 Tag Address
The tag address for an S7 variable can be found in TIA Portal.
PLC (Programmable Logic Controllers) Tags
The address for tags can be found in TIA Portal in the Address
column of the PLC Tags
table .
For PLC tags, this value can be used as it is directly in HiveMQ Edge.
If you cannot get the addresses directly from TIA Portal, you can use the following format to construct the address:
Format for bit addresses:
%<Memory-Area-Code><Byte-Offset>.<Bit-Offset>
Format for byte addresses
%<Memory-Area-Code><Memory-Size-Code><Byte-Offset>
Example: %I205.0
or ´ %QB207
Where the Memory-Area-Code
is one of I
(Inputs), Q
(Outputs), D
(Direct peripheral access), M
(Markers), C
(Counter), T
(Timer), DB
(Data block).
And Memory-Size-Code
describes the size of the variable value.
The codes are X
(1 bit or 8 bytes), B
(1 byte), W
(2 bytes), D
(4 bytes).
For detailed information on which code maps to which type, see S7 Types.
Data blocks
The data block addressing scheme is:
%DB<Data-Block-Number>:<Byte-Offset>.<Bit-Offset>
%DB<Data-Block-Number>:<Byte-Offset>
Example: %DB10:20.0
or %DB10:22
The Data-Block-Number
is displayed in the tree view on the left in your TIA Portal, behind the name of your data block, enclosed in []
brackets or on the top of the data block view.
The Byte-Offset
(and Bit-Offset
) can be found in TIA Portal in the Offset
column in the data block view
Fixed offsets are only available for variables in data blocks if Optimized block access is turned off.
|
The setting for optimizing block access can be found in the properties of the data block in TIA Portal.
S7 Types
Type | Description | Memory size code | MQTT payload example | Value range |
---|---|---|---|---|
|
1 bit |
|
|
|
|
1 byte unsigned |
|
|
|
|
1 byte signed |
|
|
|
|
1 byte unsigned |
|
|
|
|
2 byte signed |
|
|
|
|
2 byte unsigned |
|
|
|
|
4 byte signed |
|
|
|
|
4 byte unsigned |
|
|
|
|
8 byte signed |
|
|
|
|
8 byte unsigned |
|
|
|
|
2 byte unsigned |
|
|
|
|
4 byte unsigned |
|
|
|
|
8 byte unsigned |
|
|
|
|
4 byte floating point signed |
|
|
|
|
8 byte floating point signed |
|
|
|
|
1 byte character |
|
|
ascii alphabet |
|
2 byte character |
|
|
unicode alphabet |
|
ascii string |
|
|
ascii alphabet |
|
unicode string |
|
|
unicode alphabet |
|
4 byte signed, millisecond duration |
|
|
|
|
8 byte signed, nanosecond duration |
|
|
|
|
Date |
|
|
(ISO 8601) |
|
Time of day milliseconds |
|
|
(ISO 8601) |
|
Time of day nanoseconds |
|
|
(ISO 8601) |
|
DateTime milliseconds |
|
|
(ISO 8601) |
|
DateTime nanoseconds |
|
|
(ISO 8601) |
ADS / TwinCAT Adapter
The ADS adapter enables connections to Beckhoff and other TwinCAT 3 capable PLCs.
Please see below for the example configuration.
<ads>
<id>my-ads-id</id>
<host>my-ip-addr-or-host</host>
<port>48898</port>
<targetAmsNetId>2.3.4.5.1.1</targetAmsNetId>
<targetAmsPort>850</targetAmsPort>
<sourceAmsNetId>5.4.3.2.1.1</sourceAmsNetId>
<subscriptions>
<subscription>
<tagName>my-tag-name</tagName>
<tagAddress>MYPROGRAM.MyStringVar</tagAddress>
<destination>my/mqtt/topic</destination>
<dataType>STRING</dataType>
<qos>1</qos>
</subscription>
</subscriptions>
</ads>
<hivemq>
...
<protocol-adapters>
<ads>
<id>asd</id>
<host>172.16.10.54</host>
<port>48898</port>
<targetAmsNetId>2.3.4.5.1.1</targetAmsNetId>
<targetAmsPort>850</targetAmsPort>
<sourceAmsNetId>5.4.3.2.1.1</sourceAmsNetId>
<sourceAmsPort>49999</sourceAmsPort>
<subscriptions>
<subscription>
<tagName>my-tag-name</tagName>
<tagAddress>MYPROGRAM.MyStringVar</tagAddress>
<destination>my/mqtt/topic</destination>
<dataType>STRING</dataType>
<qos>1</qos>
<includeTagNames>false</includeTagNames>
<includeTimestamp>true</includeTimestamp>
<messageHandlingOptions>MQTTMessagePerTag</messageHandlingOptions>
</subscription>
</subscriptions>
<publishChangedDataOnly>true</publishChangedDataOnly>
<pollingIntervalMillis>1000</pollingIntervalMillis>
<maxPollingErrorsBeforeRemoval>10</maxPollingErrorsBeforeRemoval>
</ads>
...
</protocol-adapters>
...
</hivemq>
ADS Adapter Properties
Property Name | Default | Mandatory | Description | Format |
---|---|---|---|---|
|
The unique identifier of the adapter instance. |
String [a-zA-Z0-9-_] |
||
|
The host or IPv4/iIPv6 of the ModBus device. |
URI |
||
|
|
The port to connect to. |
Integer 1-65535 |
|
|
The AMS Net ID of the device to connect to. |
Integer 1-65535 |
||
|
The AMS port number on the device to connect to. |
Integer 1-65535 |
||
|
The AMS Net ID of HiveMQ Edge. |
Integer 1-65535 |
||
|
The local AMS port number HiveMQ Edge uses. |
Integer 1-65535 |
||
|
|
Specifies whether the adapter only publishes data when a field value change is detected. |
Boolean |
|
|
|
Time in milliseconds between samplings. |
Integer |
|
|
|
The maximum number of times the adapter attempts to sample while an error condition is detected. If the configured maximum is exceeded, the sampling job ceases to execute until the connection is re-established. |
Integer |
|
|
|
The quality of service to be used for the publish operation. |
MQTT QoS |
|
|
The destination topic to which the adapter publishes. |
MQTT Topic |
||
|
The name of the selected tag. |
String [a-zA-Z0-9-_] |
||
|
The address of the selected tag. For more information, see ADS Tag Address |
ADS Tag Address |
||
|
The type of the selected tag. For more information, see ADS Types. |
ADS data type |
||
|
|
Specifies whether a server timestamp is included in the resulting MQTT message. |
|
|
|
|
Specifies whether the tag name is included in the resulting MQTT message. |
|
|
|
|
Defines the format of the resulting MQTT message. Either one message per changed tag or one message per subscription with multiple data points per sample |
|
ADS Tag Address
The tag address for ADS is the program name followed by the variable name separated by a dot, in the format <program-name>.<variable-name>
.
Example program:
PROGRAM MAIN
VAR
iCounter : INT := 41;
MiCounter AT %MW2 : INT := 21;
QstrText AT %QB20 : STRING := 'abcdefg';
END_VAR
The variable addresses for the protocol adapter are then:
-
MAIN.iCounter
-
MAIN.MiCounter
-
MAIN.QstrText
ADS Types
Type | Description | MQTT payload example | Value range |
---|---|---|---|
|
1 bit |
|
|
|
1 byte unsigned |
|
|
|
1 byte signed |
|
|
|
1 byte unsigned |
|
|
|
2 byte signed |
|
|
|
2 byte unsigned |
|
|
|
4 byte signed |
|
|
|
4 byte unsigned |
|
|
|
8 byte signed |
|
|
|
8 byte unsigned |
|
|
|
2 byte unsigned |
|
|
|
4 byte unsigned |
|
|
|
8 byte unsigned |
|
|
|
4 byte floating point signed |
|
|
|
8 byte floating point signed |
|
|
|
ascii string |
|
|
|
unicode string |
|
|
|
4 byte unsigned, millisecond duration, UDINT |
|
|
|
8 byte unsigned, nanosecond duration, ULINT |
|
|
|
Date, UDINT |
|
|
|
Date, ULINT |
|
|
|
Time of day milliseconds, UDINT |
|
|
|
Time of day nanoseconds, ULINT |
|
|
|
DateTime milliseconds, UDINT |
|
|
|
DateTime nanoseconds, ULINT |
|
|
EtherNet/IP Adapter
The EtherNet/IP adapter enables connections to Rockwell / Allen-Bradley PLCs (Programmable Logic Controllers) from the ControLogix and CompactLogix series.
<ethernet-ip>
<id>my-eip-id</id>
<ethernet-ip>
<id>my-eip-adapter-id</id>
<host>my-ip-addr-or-host</host>
<subscriptions>
<subscription>
<tagName>my-tag-name</tagName>
<tagAddress>my_tag_name</tagAddress>
<destination>my/mqtt/topic</destination>
<dataType>STRING</dataType>
<qos>1</qos>
</subscription>
</subscriptions>
</ethernet-ip>
</ethernet-ip>
<hivemq>
...
<protocol-adapters>
<ethernet-ip>
<id>my-eip-adapter-id</id>
<host>172.16.10.54</host>
<port>44818</port>
<backplane>1</backplane>
<slot>0</slot>
<subscriptions>
<subscription>
<tagName>my-tag-name</tagName>
<tagAddress>my_tag_name</tagAddress>
<destination>my/mqtt/topic</destination>
<dataType>STRING</dataType>
<qos>1</qos>
<includeTagNames>false</includeTagNames>
<includeTimestamp>true</includeTimestamp>
<messageHandlingOptions>MQTTMessagePerTag</messageHandlingOptions>
</subscription>
</subscriptions>
<publishChangedDataOnly>true</publishChangedDataOnly>
<pollingIntervalMillis>1000</pollingIntervalMillis>
<maxPollingErrorsBeforeRemoval>10</maxPollingErrorsBeforeRemoval>
</ethernet-ip>
...
</protocol-adapters>
...
</hivemq>
EtherNet/IP Adapter Properties
Property Name | Default | Mandatory | Description | Format |
---|---|---|---|---|
|
The unique identifier of the selected adapter instance. |
String [a-zA-Z0-9-_] |
||
|
The host or IPv4/IPv6 of the EtherNet/IP device. |
URI |
||
|
|
The port to connect to. |
Integer 1-65535 |
|
|
|
The ID of the backplane. |
Integer 1-65535 |
|
|
|
The ID of the slot. |
Integer 1-65535 |
|
|
|
Specifies whether the adapter only publishes data when a field value change is detected. |
Boolean |
|
|
|
Time in milliseconds between samplings. |
Integer |
|
|
|
The number of times the adapter attempts to sample while an error condition is detected. If the configured maximum is exceeded, the sampling job ceases to execute until the connection is re-established. |
Integer |
|
|
|
The quality of service to be used for the publish operation. |
MQTT QoS |
|
|
The destination topic to which the adapter publishes. |
MQTT Topic |
||
|
The name of the selected tag. |
String [a-zA-Z0-9-_] |
||
|
The address of the selected tag. For more information, see EtherNet/IP Tag Address . |
EtherNet/IP Tag Address |
||
|
The type of selected tag. For more information, see EtherNet/IP Types. |
EtherNet/IP data type |
||
|
|
Specifies whether a server timestamp is included in the resulting MQTT message. |
|
|
|
|
Specifies whether the tag name is included in the resulting MQTT message. |
|
|
|
|
Defines the format of the resulting MQTT message. Either one message per changed tag or one message per subscription with multiple data points per sample |
|
EtherNet/IP Tag Address
The tag address for EtherNet/IP is the name of the Controller Tag <tag-name>
that is shown in Logix/Studio 5000.
Example: at_int_tag
EtherNet/IP Types
Type | Description | MQTT payload example | Value range |
---|---|---|---|
|
1 bit |
|
|
|
1 byte signed |
|
|
|
1 byte unsigned |
|
|
|
2 byte signed |
|
|
|
2 byte unsigned |
|
|
|
4 byte signed |
|
|
|
4 byte unsigned |
|
|
|
8 byte signed |
|
|
|
8 byte unsigned |
|
|
|
4 byte floating point signed |
|
|
|
8 byte floating point signed |
|
|
|
ascii string |
|
|
|
4 byte unsigned, millisecond duration, UDINT |
|
|
|
8 byte unsigned, nanosecond duration, ULINT |
|
|
HTTP(s) Adapter
The HTTP adapter is useful when data points can be gathered via HTTP even when other IoT protocols are not available or other software systems should be integrated. The HTTP adapter polls data from a configurable endpoint and converts it into an MQTT message.
<protocol-adapters>
...
<http>
<qos>1</qos>
<httpRequestMethod>GET</httpRequestMethod>
<httpConnectTimeout>5</httpConnectTimeout>
<httpRequestBodyContentType>JSON</httpRequestBodyContentType>
<httpPublishSuccessStatusCodeOnly>true</httpPublishSuccessStatusCodeOnly>
<httpHeaders>
<httpHeader>
<name>Authorization</name>
<value>Bearer Some-Token</value>
</httpHeader>
</httpHeaders>
<allowUntrustedCertificates>false</allowUntrustedCertificates>
<maxPollingErrorsBeforeRemoval>10</maxPollingErrorsBeforeRemoval>
<pollingIntervalMillis>1000</pollingIntervalMillis>
<url>http://localhost:8080/metrics</url>
<destination>http-device</destination>
<id>HTTPEndpoint</id>
</http>
...
</protocol-adapters>
HTTP Adapter Properties
Property Name | Default | Mandatory | Description | Format |
---|---|---|---|---|
|
|
Defines whether untrusted HTTP sources such as expired certificates can be accepted. |
|
|
|
|
The number of times the adapter attempts to sample while an error condition is detected. If the configured maximum is exceeded, the sampling job ceases to execute until the connection is re-established. |
Integer > 0 |
|
|
|
Time in milliseconds that the endpoint is polled. |
Integer > 0 |
|
|
The URL to the HTTP server for data requests. |
URL |
||
|
The topic to which the response is published. |
MQTT topic |
||
|
the unique identifier of the protocol adapter. |
String |
||
|
|
The method to be used to make the HTTP request. |
|
|
|
|
The length of time to wait for HTTP response (in seconds). |
Integer > 0 |
|
|
|
Specifies whether to Publish message only when the HTTP code is successful (200 - 299). |
|
|
|
The QoS to be used for publish. |
MQTT QoS |
Property Name | Default | Mandatory | Description | Format |
---|---|---|---|---|
|
The name of the HTTP header. |
String |
||
|
The value of the HTTP header. |
String |
File Adapter
File adapters add functionality to read files from the file system on which HiveMQ Edge runs. The adapter supports different input formats and makes it possible to read information from systems that cannot communicate via the network or defined APIs.
HiveMQ Data Hub can extract specific information from the content of a file or transform a payload to fit your business needs. |
Example configuration to read a file from /tmp/sensor.json
.
<file_input>
<pollingIntervalMillis>1000</pollingIntervalMillis>
<maxPollingErrorsBeforeRemoval>10</maxPollingErrorsBeforeRemoval>
<subscriptions>
<subscription>
<includeTagNames>false</includeTagNames>
<includeTimestamp>true</includeTimestamp>
<messageHandlingOptions>MQTTMessagePerTag</messageHandlingOptions>
<qos>0</qos>
<destination>file</destination>
<filePath>/tmp/sensor.json</filePath>
<contentType>TEXT_JSON</contentType>
<destinationMqttTopic>file</destinationMqttTopic>
<jsonPayloadCreator/>
</subscription>
</subscriptions>
<id>file-input</id>
</file_input>
File Adapter Properties
Property Name | Default | Mandatory | Description | Format |
---|---|---|---|---|
|
|
The number of times the adapter attempts to sample while an error condition is detected. If the configured maximum is exceeded, the sampling job ceases to execute until the connection is re-established. |
Integer > 0 |
|
|
|
Time in milliseconds that the endpoint is polled. |
Integer > 0 |
|
|
The topic to which the response is published. |
MQTT topic |
||
|
the unique identifier of the protocol adapter. |
String |
||
|
The local path to the file to read |
Path |
||
|
The content type of the file. The following types are supported: |
Enum |
Contribute a Custom Adapter
The HiveMQ Edge protocol adapter SDK (Java Doc) can be utilized to implement a custom protocol adapter. For a step-by-step tutorial, see How to Build a File-based Protocol Adapter for HiveMQ Edge.