Need help with config of MQTT channel.

Scenario:
Siemens LOGO-PLC connected via Modbus to Teltonica router RUT240.
Router via Olivia wireless SIMcard and ZeroTier VPN connected to the world.
( direct modbus communication is working well, visu + control )
Target now:
collect, save and analytic of sensor data.
Therefor I have setup the MQTT and send Modbus data on the RUT240.
This data is aleady arriving in flespi broker and on the MQTT board with client as subscriber I can see the following message payload:
{"ID":"10","TS":"1613035994","ST":"101","VR":"[273,23,443,643,-40,245,18,-2]"}
"VR:" contains the modbus data from the sensors as array.
I have now tried to setup a MQTT channel with the same client parameters as the client on the MQTT board.
But how to extract the "VR:" array from the message payload and even more better how extract array items into self defined parameters (varaibles) for save and analytic ?

    roadrunner250
    In your example "VR" field is sent as a string - it makes impossible to fetch particular items from it.
    Correct payload should look like:
    {"ID":"10","TS":"1613035994","ST":"101","VR":[273,23,443,643,-40,245,18,-2]}
    I this case it could be possible to fetch array items with custom naming scheme of MQTT channel.

      [{"ID":10,"TS":1613040474,"ST":101,"VR":[264,47,-6,645,-15,155,43,173]}]
      Better now ? 😃

      • namo replied to this.

        this are the possible settings on the router:

          roadrunner250
          This one should go.
          The best format would be {"ID":10,"TS":1613040474,"ST":101,"VR":[264,47,-6,645,-15,155,43,173]}, but if the router can not be configured to send messages in this format, you may try to set up naming scheme for this format either.
          Needs to be tested.

            Corrected the JSON format on the router and activated option "Send as object" on the router.
            Now its working perfect 😄
            Will go ahead with data storgae and analyse ....
            thks
            Oliver

              Write a Reply...