• Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular

    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 support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

    HTTP modbus data to Mango

    How-To
    4
    17
    1280
    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.
    • R
      Robmalone last edited by

      Hi all,
      I am trying to get modbus data from a Teltonika RUT955 router that has a modbus master & data to server function using HTTP. I can successfully received data on the same PC Mango is installed using Hercules (testing sw) but cannot get mango to receive any data. Here is what Hercules is receiving from the modbus server/router:

      POST /httpds/RUT955 HTTP/1.1
      Host: 192.168.1.129:1883
      Accept: /
      Content-Length: 120
      Content-Type: application/x-www-form-urlencoded

      [{"TS":"27/03/2020 12:33:36","ST":"7007","VR":"[2.388783e+02,]"},{"TS":"27/03/2020 12:33:36","ST":"7501","VR":"[678,]"}]

      and a screenshot of the router setup

      0_1585314483840_15bec896-479e-4d6f-b98e-42634b1d36f4-image.png

      I am trying to receive 2 variables voltage & energy they are denoted by the modbus registers 7007 and 7051.

      I am very new to http so could anyone please tell me how to set up the Mango side so I can get this working? Mango Version is 3.6.4.
      Thanks.
      Rob

      cwangv 1 Reply Last reply Reply Quote 0
      • cwangv
        cwangv @Robmalone last edited by

        @robmalone
        i notice you have 'http(s)' selected, can it be 'http' instead? also, you need to change the modbus port setting inside mango from '502' to '1883' as shown in your screenshot.
        below is where the port setting is in mango.

        0_1585358098587_aaa112dc-90b7-4fb6-bca3-9cdbb5ac43c1-image.png

        hope that helps.

        1 Reply Last reply Reply Quote 0
        • R
          Robmalone last edited by

          Hi and thanks for the reply. The http(s) selection is for both http and https, depends on how you input the URL.
          That screenshot was actually from when I was testing with Hercules with port 1883. I have tried with port 8080 and no port. http://192.168.1.129:8080/httpds and http://192.168.1.129/httpds.

          I am not polling the modbus slave from Mango, the router polls the salve device and then sends the data to Mango by http. Do I still need a modbus data point set up in Mango?

          I have also noticed an error in ma.log which is most likely the root of the issue - WARN 2020-03-27T15:55:58,809 (com.serotonin.m2m2.web.mvc.spring.security.MangoAccessDeniedHandler.handle:53) - Denying access to Mango resource /httpds/ to IP 192.168.1.1
          Do I need to open/allow anything in Mango to allow incoming http?

          Thanks again.

          cwangv 1 Reply Last reply Reply Quote 0
          • cwangv
            cwangv @Robmalone last edited by

            @robmalone
            Yes, you need to create a Modbus tcp/ip data source and points for these to work.

            1 Reply Last reply Reply Quote 0
            • R
              Robmalone last edited by

              Sorry, I'm not sure what you mean.
              Even though the data is being sent to Mango in http format? I dont see how I can? what IP address should I point it to, The 3G router does not have a static public IP? I am not polling the modbus devices from Mango.
              Any ideas how to reslove this error? - WARN 2020-03-27T15:55:58,809 (com.serotonin.m2m2.web.mvc.spring.security.MangoAccessDeniedHandler.handle:53) - Denying access to Mango resource /httpds/ to IP 192.168.1.1

              Thanks.

              cwangv 1 Reply Last reply Reply Quote 0
              • cwangv
                cwangv @Robmalone last edited by

                @robmalone
                I can not help with you about the error code.
                but is the Mango on the same LAN as the PLC? Or are you trying to poll data from a remote site into the Mango?

                1 Reply Last reply Reply Quote 0
                • R
                  Robmalone last edited by

                  At the moment, just for testing purposes, it is in the same lan. Once I get it working it will be used in another location.

                  1 Reply Last reply Reply Quote 0
                  • C
                    craig last edited by

                    Hi Rob,

                    I think you need http receiver since your device is going to POST data to in JSON format mango. It has nothing to do with modbus except in your device you are populating the JSON data with fields from the devices modbus map.

                    1 Reply Last reply Reply Quote 0
                    • MattFox
                      MattFox last edited by

                      Hi gentlemen, hope you don't mind if I join the party, Rob, looking at your config, you're going to want a HTTP JSON Receiver since the body of the message is in JSON.
                      Secondly, configure your whitelist in the datasource settings to allow your Teltonika to send data in by entering it's ip address:
                      192.168.1.1
                      Use * as your device identifier
                      I have learnt you need to amend the format of your JSON. The VR comes through as a broken array. namely: [2.388783e 02,]
                      To set the time, use the unix timestamp option so mango can parse it. %t
                      For ease of the jackson JSON format that mango uses:
                      Change your send url to: http://192.168.1.129/httpds and move the RUT955 or remove it completely
                      I did:

                      {"RUT955":[{"TS":"27/03/2020 12:33:36","ST":7007,"VR":[2.388783e 02,0]},{"TS":"27/03/2020 12:33:36","ST":7501,"VR":[678,0]}]}
                      

                      LASTLY
                      Add a custom header: you need to overwrite the Content-Type: application/x-www-form-urlencoded
                      with:

                      Content-Type: application/json
                      

                      once that's done we can look at your points. So far I can get them parsing with

                      HTTP Parameter name: /RUT955/0/VR for voltage as an alphanumeric point. I cannot parse them as numeric because the format of the register data is a string (text), not a number.

                      Let me know if you can further customise the data. Hope this helps

                      Fox

                      Do not follow where the path may lead; go instead where there is no path.
                      And leave a trail - Muriel Strode

                      1 Reply Last reply Reply Quote 1
                      • R
                        Robmalone last edited by

                        @MattFox Hi Matt,
                        Thanks for the assist. I can see data coming into Mango now using the HTTP receiver listener but that as far as I have got. The JSON output from the router is fairly customizable. What would be the best JSON data for Mango to receive in order to get those 2 data points? The variables I have are Timestamp(%d), Modbus Start Register (%s) (could be useful as its unique to each variable), Register Data(%a).
                        I could do something like {TS:%t, %s : %a} to give on output of:
                        {
                        "7007": "[2.409815e+02,]",
                        "TS": "1585705904"
                        },
                        {
                        "7501": "[91169,]",
                        "TS": "1585705904"
                        }

                        Thanks again MattFox.

                        1 Reply Last reply Reply Quote 0
                        • MattFox
                          MattFox last edited by MattFox

                          @robmalone said in HTTP modbus data to Mango:

                          {
                          "7007": "[2.409815e+02,]",
                          "TS": "1585705904"
                          },

                          This I like; However the issue we have is the format of your numerical data.
                          This sucker:

                          "[2.409815e+02,]",
                          

                          JSON will not parse this because it's a broken array (the ,] denouncing there is nothing in the second array element)
                          Secondly the 2.409815e+02 will be parsed into HTTP as 2.409815e 02 because the '+' is treated as a space.
                          Can you not alter the format of the stored data? secondly if that second element is always empty, can you not associate the affiliated register to always return a 0 so the element isn't left blank?

                          That's all for now. Once you've got through that I'll think you've cracked it.

                          Set up a link via https://webhook.site/ to post your data to; to both view and share. flick me a link via chat and I can look at what you're firing from your router.

                          Fox

                          Do not follow where the path may lead; go instead where there is no path.
                          And leave a trail - Muriel Strode

                          1 Reply Last reply Reply Quote 0
                          • R
                            Robmalone last edited by

                            @MattFox. I have spoken to the router manufacturer and unfortunately the issue with the scientific notation cant be changed at this point. Ill keep at it! Thanks again.

                            MattFox 1 Reply Last reply Reply Quote 0
                            • MattFox
                              MattFox @Robmalone last edited by MattFox

                              @robmalone for a quick fix we could throw together a relay using another program.
                              Are you able to code in other languages?
                              If not I don't mind helping you knock together a quick solution
                              EDIT: Silly me, for the content type header, make it this: no wonder the '+' disappeared...
                              application/json;charset=utf-8
                              Fox

                              Do not follow where the path may lead; go instead where there is no path.
                              And leave a trail - Muriel Strode

                              1 Reply Last reply Reply Quote 0
                              • R
                                Robmalone last edited by

                                @MattFox I'm actually not trained in coding of any languages to be honest. I'm just working thing out as I go, sometimes successfully, sometimes not. I think ill try a couple of other ways before I waste any more of your time.

                                1. The router also has an MQTT sender option so Ill try that first. I suspect I'll run into the same issue with this.
                                2. I can use a different modbus slave device that populates modbus registers with integers instead of float points therefor no decimal places.

                                I might get back to you with some MQTT queries if that's OK. Thanks again for the help.

                                MattFox 1 Reply Last reply Reply Quote 0
                                • MattFox
                                  MattFox @Robmalone last edited by MattFox

                                  @robmalone said in HTTP modbus data to Mango:

                                  I think ill try a couple of other ways before I waste any more of your time.

                                  Trust me, you're not. I enjoy this kind of work. Is your mango version free? I'm confident we can get the data in a two stage process, you'll need a meta point data source and then we can get those points. Trust me this will be easy. Have you finally decided on your data format?

                                  Do not follow where the path may lead; go instead where there is no path.
                                  And leave a trail - Muriel Strode

                                  1 Reply Last reply Reply Quote 1
                                  • R
                                    Robmalone last edited by

                                    Thanks a lot @MattFox. I think I'll try MQTT since its a 3G modem and I believe that should help reduce the data.
                                    Ill take a look over the next day or 2 and get back to you. I am using a free version at home just for testing but we have a 1000 point server we use commercially. Once I get this working at home we will be deploying it for use with the main server.

                                    1 Reply Last reply Reply Quote 0
                                    • MattFox
                                      MattFox last edited by

                                      Righto, I'll be here!

                                      Do not follow where the path may lead; go instead where there is no path.
                                      And leave a trail - Muriel Strode

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post