Ожидает ответа пользователя

MQTT: Convert data before sent/receive

Tanapol E. 7 лет назад в Server Solutions / UMC Server обновлен Ilya Markov (expert) 7 лет назад 1


My MQTT sent/receive command by string "ON" and "OFF" not 0 1

Is it possible to convert them?

for example

when receive string "ON" from Feedback

just convert to 1

and when send 1 to MQTT Tag just convert and send out "ON" string

Ожидает ответа пользователя


you can use js script for this task. You can subscript to this tag via global listener or event tag change and then convert it.

var device = IR.GetDevice("MQTT")

IR.AddListener(IR.EVENT_TAG_CHANGE, device, function(name, value)
   if (name == "MQTT Feedback")
     if (value == "ON")
       //Here you should set 1 to your varibale
      //Here you should set 0 to your varibale

Сервис поддержки клиентов работает на платформе UserEcho