Материал из for iRidium developers
Перейти к: навигация, поиск
Эта страница является переводом страницы MQTT. Перевод выполнен на 100%.

Other languages:
English • ‎русский


The driver is meant to control MQTT equipment. To understad the driver, use the project example:

download the examples:


Description

iRidium for MQTT is a set of tools to create an interface to control Smart home or office on the basis of MQTT equipement. It realizes commands of MQTT protocol.


Connection

Control panels (iOS, Android, Windows, Mac) can control BACnet equipment only via MQTT controller.


MqttConnection.png

Adding the driver manually

Add MQTT driver to your project from database


  1. Launch iRidium Studio and create a new iRidium project
  2. Open DEVICE BASE side panel and find BACnet driver. Drag and drop MQTT to PROJECT DEVICE PANEL


MQTTAddDevice.png

Adding MQTT driver


Indicate the controller address in iRidium project otherwise it will not work.


Connection settings

When the driver is added to the project, specify the connection settings.

MQTTDriverParams.png
  • Host - IP address
  • Port - port
  • Login - user's login (if set on the bus)
  • Password - user's password(if set on the bus)
  • MQTT version - Protocol version on a bus
  • Client ID - client identificator
  • Keep Alive -
  • Clean -
  • SSL - turn on/off encription


Change of Connection Settings

You need the possibility to change connection properties when you disconnect from the Wi-Fi network of the automation object and start using 3G or another Wi-Fi network. To maintain control of the object you need to switch from the local to public IP-address of the Internet router.

The switch is not automatic. You have to select the connection mode. For remote acces you have to make ports for controlling the automation system public. In order to do that you have o set up the Port Forwarding service on your Internet router. VPN can provide protected connection.


1 Download the template (*.js) (right-click button: "Save object as ..."), add the template in the script editor with the buttonIcon Scripts.png (+) Add Script from file


2 Set up script properties as it is shown in the example:

function Internal_1() {
IR.GetDevice('MQTT').SetParameters({Host: "192.168.0.95", Port: 5001, MQTTVersion: "4", ClientID: "client1", KeepAlive: 20, Clean: true, Login: "admin", Password: "admin"});
}
function External_1() {
IR.GetDevice('MQTT').SetParameters({Host: "215.110.10.10", Port: 5001, MQTTVersion: "4", ClientID: "client1", KeepAlive: 20, Clean: true, Login: "admin", Password: "admin"});
}

Copy the driver name from Projeсt Device Panel - the list of properties has to be copied from the example.


3 Select the button which will be responsible for the switch of Internal and External properties. Open Macros Editor for the Press event (Object Properties > Programming), select the Script Call command and add it by double-clicking on it. Select the name of the function which will be activated by the button:

Script call internal-external.png

Now each pressing on the button will apply the corresponding connection properties.


Commands & Feedbacks

Commands and feedback channels have to be assigned to graphic items to control equipment:

  • A command is assigned to a graphic item.
  • Feedback channel is assigned to a graphic item to display the variable state.


To assign commands or channels to graphic items use the drag&drop method.


To send a command, drag it on a graphic item. To display feedback, drag the channel on the graphic item and indicate where to output the value (Value):

SendValue.png


Settings

To configure the command or feedback, you must set the following fields:

  • 'Topic' is the path
  • 'Value Type' is the value type


Value Types

type description
Boolean

logic type (true, false)

Signed 8-bit signed 8-bit value
Unsigned 8-bit Unsigned 8-bit value
Signed 16-bit Signed 16-bit value
Unsigned 16-bit Unsigned 16-bit value
Signed 32-bit Signed 32-bit value
Float 32-bit Float 8-bit value
Unsigned 32-bit Unsigned 32-bit value
Signed 64-bit Signed 64-bit value
Float 64-bit Float 64-bit value
Unsigned 64-bit Unsigned 64-bit value
String String