Logo Logo en
  • iRidi Pro
    Основные компоненты
    • Приложение i3 Pro
    • iRidi Pro Server
    • iRidi Studio
    • iRidium studio v. 1.3.8 (устаревшая версия)
    Java Script в iRidi
    • Руководство
    • Справочник
    • Примеры
    • JS драйвера
    другие
    • Личный Кабинет
    • iRidium Cloud
    • iRidium Transfer
    • Push-уведомления
    • Лучшая практика
    Лицензирование
    • Лицензирование и передача проекта
    • Оффлайн-лицензирование
    • Активация iRidi Pro Server
  • Продукты
    i3 lite
    • Приложение i3 lite
    • Регистрация и лицензирование
    • Сервер
    • Модули
    KNX Home Server
    • Приложение i3 KNX
    • KNX Home Server
    BUS77 HOME SERVER
    • Приложения Bus77 Home и Bus77 Lite
    • Bus77 Home Server
    Решения
    • BYOD - решение для гостиниц
    • Портал жителя - решение для МКД
    iRidi SCADA
    • iRidi SCADA
  • Bus77
    НАСТРОЙКА BUS77
    • Основы Bus77
    • Приложения Bus77 Home и Bus77 Lite
    • Работа с драйвером Bus77 в iRidi Studio
    • Настройка шины Bus77 в iRidi Studio
    ПРОТОКОЛ BUS77
    • Характеристики CAN (Bus77)
    • Описание протокола
    • Исходники на GitHub
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
  • Поддерживаемое оборудование
    Драйверы
    • Список драйверов
    • ProAV драйвера
    • AV & Custom Systems
    • JS драйвера
    • Сторонние драйвера и фриланс
    Протоколы и интерфейсы
    • Голосовое управление
    • 1-Wire
    • BACnet IP
    • Bus77
    • KNX
    • KNX IP BAOS
    • Weinzierl kBerry
    • Microsoft Exchange
    • Modbus
    • MQTT
    • NFC
    • ODBC
    • Onvif
    • SIP
    • SNMP
    • Wake On Lan
    • Z-Wave
    • ZigBee
    Производители
    • AMX
    • AVCiT
    • Beckhoff ADS
    • Biamp Tesira
    • Bluesound
    • Casambi
    • BSS Harman
    • Clipsal
    • ControlArt 7Port
    • Crestron
    • DigiBird
    • Domintell
    • Duotecno
    • EIDE
    • EPSNET
    • Global Cache
    • HDL Buspro
    • Helvar
    • IEAST
    • INELS BUS
    • INELS Wireless
    • Intesis
    • Kleger
    • Kramer VIA
    • Kramer 3000
    • Larnitech
    • Legrand Netatmo
    • LG TV
    • Lutron
    • Lutron Homeworks QS
    • MyHome
    • Nest
    • Novastar
    • Panasоnic PTZ
    • Philips Dynalite
    • PJLink
    • Satel
    • SamsungTV
    • Sonos
    • Somfy
    • SpinetiX
    • Televic Conference
    • TIS
    • Tion
    • URRI
    • Velbus
    • Velocio
    • Vinteo
    • WyreStorm
    • WiiM
    • Xicato
    • Yamaha
    • ZONT
    • Z-Wave.me
    Протестированное оборудование
    • Панель HDL S57
    • Панель HDL S10
    • SIP-домофон
    • Akuvox
    • Arlight
    • Divus
    • QBic TD-1050 PRO
    • QBic TD-1060 Slim
    • QBic TD-1070
    • Sigur
    • Uni-Ubi
    • Velocio
  • Оборудование iRidi

    Серверы
    • HS Сервер
    • ProAV Control Processor Basic
    • ProAV Control Processor Advanced
    • Спецификация контроллеров UMC
    • Настройка контроллера UMC C2
    • Настройка контроллера UMC C3
    • Настройка контроллера HDL IntelliCenter 2 (UMC C4)
    Модули расширения
    • I-PX-RS1
    • I-PX-RS4
    • I-PX-IR3
    KNX
    • KNX Home Server
    • KNX IP Interface
    Панели управления
    • iRidium Panel 7
    • Touch Panel P3
    • Touch Panel P6
    • Touch Panel P8
    • Touch Panel P10
    • Tabletop Touch Panel 10
    • AV Remote Control
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
    • Differences
iRidium mobile web-site
Содержание
    Инструменты‌
    • Сведения о странице
    • Постоянная ссылка
    • Версия для печати
    • Спецстраницы
    • Связанные правки
    • Ссылки сюда
    Login / Create Account
    Материал из for iRidium developers
    Перейти к: навигация, поиск
    Эта страница является переводом страницы CloudMQTT. Перевод выполнен на 100%.

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

    Содержание

    • 1 Connecting Modbus TCP devices to MQTT cloud services
      • 1.1 Description of example
      • 1.2 Setting CloudMQTT
      • 1.3 Setting iRidium server
        • 1.3.1 Setting MQTT driver
        • 1.3.2 Setting Modbus TCP driver
        • 1.3.3 Gateway between MQTT and Modbus TCP drivers
        • 1.3.4 Unmanaged gateway
      • 1.4 Setting i3 pro project
      • 1.5 Testing projects

    Connecting Modbus TCP devices to MQTT cloud services


    MQTT has advantages of a telemetry protocol: it provides data exchange between devices (clients) in conditions on unreliable or unstable connection. Devices can disconnect from the net and when they are connected back, the MQTT-broker definetely sends a message.

    Different cloud services with MQTT broker, such as, Azure IoT Suite by Microsoft or AWS IoT by Amazon have become quite popular.

    You can connect devices that do not support MQTT to MQTT cloud services, using iRidium server as a gateway.


    Description of example


    Download a project example

    iRidium server is used to connect Modbus TCP devices to MQTT cloud service. A panel for which a separate graphical interface is developed is also connected to the service. Thus, there appears a capability to control devices in Modbus TCP network remotely via MQTT telemetry protocol.

    CloudMQTT scheme(1).png


    Setting CloudMQTT

    CloudMQTT suggests different buying plans.

    You can select a free plan - Cute Cat, that provides a virtual server (not dedicated), 5 users (max), 5 acl rules, 5 connections and 10 Kbit/s traffic. It is not recommended for commercial use. But it is suitable for testing and hobbies.

    1 Register at CloudMQTT web-site and log in with your login and password.

    2 Click "Create New Instance" button.

    CloudMQTT01.png

    3 Set the name of instance, a plan and the server location (Data Center). Click "Create New Instance".

    CloudMQTT02.png

    4 Click on the name of the created instance to go to its settings.

    CloudMQTT03.png

    5 All data required for connection to the cloud service are displayed in the DETAILS tab.

    CloudMQTT04.png


    Setting iRidium server

    Setting MQTT driver

    1 Create a server project.

    2 Add MQTT driver to a project.

    MQTT01(1).png

    3 Set the driver according to the DETAILS tab of the instance in the CloudMQTT service:

    • Host - address of the service instance (Server)
    • Port - instance port:
      • 13816 (unprotected connection),
      • 23816 (SSL protected connection),
      • 33816 (WebSocket protected connection; not supported by iRidium pro)
    • Login - login to access instance (User)
    • Password - password to access instance (Password)
    • Client ID - ID of MQTT-client, a unique name for each MQTT device
    • SSL - encrypting method:
      • Disable
      • TLS 1.2 (recommended)
      • SSL 2.3
      • SSL 3.0 (not supported by CloudMQTT)


    More: Setting connection parameters to MQTT.


    4 Create a required number of channels and tags. Set each channel and tag.

    MQTT02.png

    CloudMQTT allows to set any line to Topic parameter. It is recommended to set Topic in the standard hierarchic form that looks like an address line of a file system, for example,

    /place/device_name/group_name/parameter_name


    More: Setting parameters of MQTT channels and feedback.


    Setting Modbus TCP driver

    1 Add Modbus TCP driver in the project.

    2 Set connection parameters.

    3 Create the required number of commands and tags in the driver.

    4 Set each command and tag according to the task.


    Gateway between MQTT and Modbus TCP drivers

    1 Add a script to the project:

    var driver1 = IR.GetDevice("MQTT");       // name of a driver 1
    var driver2 = IR.GetDevice("Modbus TCP"); // name of a driver 2
     
    var gatemap = {
    // Tag name                Channel name
      "Door_switch"         : "MQTT_Door_switch",
      "Ring_button"         : "MQTT_Ring_button",
      "Outdoor_temperature" : "MQTT_Outdoor_temperature",
      "Indoor_temperature"  : "MQTT_Indoor_temperature",
      "MQTT_Lock"           : "Lock",
      "MQTT_Siren"          : "Siren",
      "MQTT_Dimmer_R"       : "Dimmer_R",
      "MQTT_Dimmer_G"       : "Dimmer_G",
      "MQTT_Dimmer_B"       : "Dimmer_B",
      "MQTT_Dimmer_ON"      : "Dimmer_ON"
    }; 
     
    IR.AddListener(IR.EVENT_TAG_CHANGE, driver1, function(name, value) {
      if (gatemap[name]) {
        driver2.Set(gatemap[name], value);
      }	
    });
    IR.AddListener(IR.EVENT_TAG_CHANGE, driver2, function(name, value) {
      if (gatemap[name]) {
        driver1.Set(gatemap[name], value);
      }	
    });

    2 Remember to set correct names of drivers that are connected via a gateway and the gateway map.

    The gateway map (gatemap variable) is a list of corresponding pairs of tag and channel names of two different drivers. Data are exchanged between these pairs of tags and channels. More pair can be added to the list.


    Unmanaged gateway

    Method of managed gateway between drivers was described above. It required a gateway map of tags and channels. In a managed gateway you can set which data can be sent from a tag of one driver to a channel of another driver and which data can't be sent.

    A simpler script can be used that does not require a gateway map. In this case the gateway is unmanaged and all data is sent from tags to channels. It's obligatory that tag names of one driver are identical to channel names of another driver and vice versa.

    1 Give identical names to tags of MQTT drivers and channels of Modbus TCP driver, and to tags of Modbus TCP driver and channels of MQTT driver accordingly.

    2 Delete the previous script and add the following script instead of it:

    // Assign the same names to tags of first driver and to channels of second driver,
    // and accordingly - to tags of second drivers and to channels of first driver. 
    var driver1 = IR.GetDevice("MQTT");       // name of a driver 1
    var driver2 = IR.GetDevice("Modbus TCP"); // name of a driver 2
     
    IR.AddListener(IR.EVENT_TAG_CHANGE, driver1, function(name,value) {
      driver2.Set(name, value);
    });
    IR.AddListener(IR.EVENT_TAG_CHANGE, driver2, function(name,value) {
      driver1.Set(name, value);
    });

    3 It is enough to give driver names in this script.


    Setting i3 pro project

    1 Create a panel project.

    2 Add MQTT driver to a project.

    3 Set connection to CloudMQTT service the way it was done in a server project, that is, enter the same connection parameters of MQTT driver(Host, Port, Login, Password). Set another Client ID for CloudMQTT service to distinguish connecting clients from one another.

    4 Create a required number of commands and tags. Variables that are commands on the server must be tags on a panel and vice versa. Tags on the server must correspond to commands on a panel.

    5 Set Topic and Value Type parameters of tags and commands the same was as the corresponding server channels.

    6 Create a graphic interface. Assign commands and tags of MQTT driver to graphic items by events or relations.

    CloudMQTT GUI(2).png


    Testing projects

    1 Launch a server project and a panel project in any order. You can use i3 pro Emulator and iRidium server for Windows.

    2 Go to CONNECTIONS tab of CloudMQTT instance. The state of MQTT connections is displayed in this tab.

    CloudMQTT05.png

    3 Go to WEBSOCKET UI tab that is used for testing by developers. Here you can see all received MQTT-messages and send them.

    CloudMQTT06.png

    4 You can use any emulator of Modbus TCP server, for example, this free one Modbus PLC Simulator to test a project.

    In the given example all publishers and subscribers have full access rights ti MQTT topics. But you can create rules and limitations in USERS & ACL tab of CloudMQTT instance.

    Источник — «https://dev.iridi.com/index.php?title=CloudMQTT/en&oldid=53729»
    About us
    Company
    Team
    History
    Philosophy
    Rewards
    Partnership
    Our partner
    Partnership Programs
    Apply for partnership
    products
    iRidium pro
    iRidium lite
    iRidium gate
    iRidium server
    Loads
    iRidium pro
    iRidium lite
    Other version
    Marketing materials
    Support
    On-line courses/Video
    Recommended equipment
    Other version
    iRidium pro
    Documentation
    FAQ
    Forum
    iRidium lite
    Documentation
    Forum
    Projects
    Standart projects
    Smart buildings
    Smart house
    Special solution
    Find a dealer
    News
    Youtube
    Twitter
    VK
    Logo
    contact@iridi.com
    +7 (499) 322-73-29

    Privacy policy