Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Howto Manage different kinds of data coming from the same modbus port

  • Hello everyone,

    I have setup Mango to work with a Zelio Logic through a ModBus TCP communication.
    The Zelio is gathering several types of data (all numerical: temperature, pressure, counts) from its inputs and store them into internal variables.
    I would like to get these values under Mango.

    The problem is that the Zelio has only 4 input(J1XTx)/output ports(O1XTx) in Modbus.
    So I have programmed the Zelio to provide for example:

    • the temperature 1 value at O1XT1 port when the value 1 is written in J1XT1
    • the temperature 2 value at O1XT1 port when the value 2 is written in J1XT1
    • the pressure value ....

    So Mango has to write a specific value in J1XT1 and record the value provided by Zelio at O1XT1.

    The problem is that I can't find the mechanism in Mango to deal with the fact that it is reading different kind of data from a single modbus address and that it has to store them in different data points depending on the value that is written to J1XT1.

    Do you have an idea on how can I do it?

    Thank you very much for your help.

  • create a meta point for each value you need to record
    to the meta point context add the modbus register point and the 'index' register point.

    when the index is equal to the value's index, set the value of the meta point to the value of the modbus register.

  • Thank you very much Craig,

    I had abandoned that possibility because each time the "index" is updated, all the metapoints were activated and hence all the scripts of all the metapoints were executed. Hence a value had to be returned for each metapoint as it is explained in the documentation.

    Exemple for the metapoint storing the data for the index value 2, If I could write the following it would be great:

    if (j1.value == 2) {return o1.value;} else return currentvalue;

    j1 is the index value
    o1 is modbus register

    But I don't think it is possible.

    Following your advice I came back to work and found out an ugly way: causing an error in the scripts of the metapoints that were not concerned by the index value.

    if (j1.value == 2) {return o1.value;} else return true;

    Since the metapoint is numeric, returning a true value causes an error and the previous value of the metapoint is kept. It works!

    The only drawbacks:

    • it's ugly, so if you have a better idea...
    • I had to turn off the notification when there is a script error in the meta data source.

    Thanks a lot


  • @amoulart said:

    if (j1.value == 2) {return o1.value;} else return currentvalue;

    j1 is the index value
    o1 is modbus register

    have you tried:

    if (j1.value == 2) {return o1.value;} else return m1.value;

    j1 is the index value
    o1 is modbus register
    m1 is the meta point

    I know that this could potentially lead to recursion on the meta point update event, but I think I have seen that topic come up before in this forum and mango is smart enough not to trigger a meta point update event when the meta point itself is updated.

    Give it a shot...

    Yes, all the meta point scripts will run every time the index is updated, but that doesn't really matter.

  • :oops:

    Thank very much for your help Craig!

    Unfortunately for me I have a natural tendency to imagine difficulties where there is none...

  • Hello Craig,

    for information,

    actually I understand now why I had a difficulty here.

    In a meta data source, when I create a new numerical point "example", "example" is not available in the script context.
    Even if I save it, open an other point for edition and come back to "example" to edit it, it is still not available in the script context. Saving the data source doesn't help.

    I am forced to close the meta datasource, to reopen it for edition and then only when I edit the newly created point "example" (or any other point), "example" is available in the script context.