Difference between revisions of "MQTTBROKER"

From HSYCO
Jump to navigation Jump to search
Line 64: Line 64:
 
|maxclients
 
|maxclients
 
|64
 
|64
|<n>
+
|n > 0
 
|max number of clients connected simultaneously
 
|max number of clients connected simultaneously
  

Revision as of 10:41, 26 August 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 can have the following format:

<clientid>:username=<username>,password=<password>

E.g.

client123:username=homesensor,password=abc123


Clientid must be present in each line while username and password are optional; if username and password are not present there will be two cases:

  • if default username and password are specified in "hsyco.ini" they will be used by the authentication mechanism
  • if default username and password are not specified in "hsyco.ini" the authentication mechanism is disabled

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
maxclients 64 n > 0 max number of clients connected simultaneously

Datapoints

ID Value R/W Description
connection online R the broker is ready to accept connections from clients
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
client.<clientdId>.lastseen <timestamp> R timestamp of the last message or ping sent by clientId to the broker