• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Manually get unipi(/TCP Modbus) data

    Scheduled Pinned Locked Moved Mervis
    3 Posts 2 Posters 1.9k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      lesliejobse
      last edited by lesliejobse

      The issue at hand is that I don't know how to retreive data from the defaultConnections created with the IDE.
      The HMI creates UI's for this and has some way to parse the binary data returned by the service calls.

      My question is how I could do the same?

      So I call:
      127.0.0.1/api.cgi with POST data {"ver":1,"v":["svc://DefaultConnection/916[0,1]]}

      This returns

      {
          "ver": 1,
          "code": "ok",
          "msg": "",
          "v": [
              {
                  "i": "svc://DefaultConnection/916[0,1]",
                  "v": "41CD7936",
                  "q": "good",
                  "t": 636586125890000000
              }
          ]
      }
      

      How can I parse this result into the actual data?
      Or even better, is there another way of retrieving this data?

      Thanks

      1 Reply Last reply
      Reply Quote 0
      • T
        TomasKnot
        last edited by TomasKnot

        Hi @lesliejobse!

        Apologies for the somewhat belated reply. Mervis API replies are based on the sscp protocol; as you probably have figured out already, the "916" is the SSCP id of the variable. You can read these in a plaintext format from a file with the name [project hash].vlist, which should be in your IDE project folder.

        The SSCP ids can be regenerated under certain conditions (the IDE will show a warning when it happens), but they should not be recycled - i.e. your variable can potentially move to a different id if you change its type (or size) in the IDE, but the old id should simply remain invalid, rather than point to another value. This is obviously important if you need to make minor changes to the ST/FBD progam itself.

        In the reply contents the variables correspond to the following:
        i - the variable id, along with the connection path
        v - the variable value in hexadecimal (your value looks like a 32bit float of 25,6, based on the converter here: http://www.binaryconvert.com/result_float.html?hexadecimal=41CD7936)
        q - whether the value is current. this will contain a fault code if due to a communication error the data isn't current (you will receive the data which has been read last)
        t - time in the windows time format, which corresponds to the time when the value was acquired by Mervis from the HW

        There are other means of retrieving the data, but in most respects they are all similar. This is also really the only secure way that the data can be exposed from Mervis.

        Kind Regards,
        Tom

        1 Reply Last reply
        Reply Quote 0
        • T
          TomasKnot
          last edited by

          Would you be willing to share a screenshot of the page if you do make an interesting HMI outside of the generated one? We are very keen to see what people can do with the Mervis HM interface.

          1 Reply Last reply
          Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post