Difference between revisions of "MQTTBROKER"

From HSYCO
Jump to navigation Jump to search
Line 109: Line 109:
 
On publish messages you can specify:
 
On publish messages you can specify:
 
*'''topic name'''
 
*'''topic name'''
*'''message itself'''
+
*'''message'''
 
*'''QoS required for the message'''
 
*'''QoS required for the message'''
 
Other fields will be ignored
 
Other fields will be ignored
  
 
==== Disconnect ====
 
==== Disconnect ====

Revision as of 09:41, 24 July 2019

This driver acts as an MQTT broker for Hsyco. It can connect with many clients but can only receive messages without forwarding them.

HSYCO Configuration

Add the MQTTBROKER I/O Server in the I/O Servers section of the Settings and set its parameters:

Authentication

  • Username: optional default username for clients
  • Password: optional default password for clients

Authentication file

Under the hsyco root directory must be present a file named "mqttbroker.ini" which can contain a series of line, each line represents the credentials of a client and must have the following format:

"clientid":username="username",password="password"

Options

ID Default Values Description
startupevents true true generate IO events also during the driver’s start-up phase
false start generating events only after HSYCO is aligned with the current status of the system
acceptunknown false true accept connection from clients whose id isn't specified in mqttbrokerauth.ini
false doesn't accept connection from clients whose id isn't specified in mqttbrokerauth.ini
localport 1883 <portNumber> local port for incoming client connection

Datapoints

ID Value R/W Description
connection online R the broker accepted a connection from a client
offline R initialization of the driver failed or loop cycle failed
client.<clientId>.connected 1 R clientId is connected to the broker
0 R clientId isn't connected to the broker
client.<clientId>.topic.<topicName> <message> R clientId published a message on topicName

TYPES OF MESSAGE

Each message must be encoded as UTF-8 strings

Connection

On connection message you can specify:

  • client identifier
  • username
  • password
  • keep-alive interval

Other fields will be ignored

Publish

On publish messages you can specify:

  • topic name
  • message
  • QoS required for the message

Other fields will be ignored

Disconnect