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

Json timstamp pattern (MQTT data source)


  • Hi

    I'm trying to setup MQTT data source to recive time-stamped value. My Json example is as follows:

    {
    "post":[20191223131022, 10]
    }

    Where 20191223131022 is the timestamp and 10 is the value.

    I've setup my DS as follows:
    0_1577104728149_9cab462b-e434-4a67-9445-8c8474e2f962-image.png

    However I'm not getting the value, though I'm not getting any error message either.

    When I change subscription topic type from Jason with Timestamp to Jason (no other changes made) I receive the data (timestamped to time when recived) so the issue seems to be only that it does not get the timestamp pattern or timestamp in Json right.

    Thankful for assistance to get the timestamp issue right.


  • @nathanRona your JSON format doesn't seem right. I'm not 100% sure how to handle arrays but if you can change the format to this it will work:

    {
      "post": {
         "0": "20191223131022",
         "1": 10  
      }
    }
    

    I would suggest this as it makes more sense:

    {
      "post": {
         "date": "20191223131022",
         "value": 10  
      }
    }
    

    and then set your JSON pointer for value to /post/value and the time pointer to post/date.


  • Changed is at described but still same result, i.e. if I set type to Jason with Timestamp I don't get any values and if I set to Jason I get the value.

    0_1577175581187_d175da4c-b16e-45b2-98b4-32e5ee204c5a-image.png

    0_1577175619487_46f71fa8-7578-4ef6-a6a0-d4dca9d41647-image.png

    Btw the array handling that I used is according to example give in help for MQTT ds
    0_1577175699363_012bbea5-a1d2-4f62-9247-d82148effbce-image.png

    In addition I would like if possible to get multiple samples in single MQTT message (with diffrent time-stamps). Is that possible? How should JSON be formatted?


  • @nathanRona I just did a quick test against test.mosquitto.org and was able to publish and receive JSON with Timestamp based values. I'm posting the JSON config so you can import it and see for yourself. I can't see exactly what is wrong with your setup but this confirms that it does in fact work. In the configuration I'm providing there are 2 data points, when you set the value for one it will publish to the receiving topic of the other.

    {
      "dataSources":[
        {
          "xid":"DS_b911d1a5-dcfd-424d-ab07-77134185f2a8",
          "name":"Test.Mosquitto.ORG Client",
          "enabled":true,
          "type":"MqttClient",
          "alarmLevels":{
            "DATA_SOURCE_EXCEPTION_EVENT":"URGENT",
            "MQTT_CONNECTION_FAILURE_EVENT":"URGENT",
            "MQTT_PUBLISH_FAILURE_EVENT":"URGENT",
            "POINT_READ_EXCEPTION_EVENT":"URGENT",
            "MQTT_UNKNOWN_TOPIC":"IGNORE",
            "POINT_WRITE_EXCEPTION_EVENT":"URGENT"
          },
          "purgeType":"YEARS",
          "brokerUri":"tcp:\/\/test.mosquitto.org:1883",
          "x509CaCrt":"",
          "clientId":"Mango Automation MQTT Client 148709547341099",
          "userName":"",
          "userPassword":"",
          "topicFilters":"infiniteautomation\/test\/#",
          "autoReconnect":true,
          "cleanSession":true,
          "keepAliveInterval":60,
          "connectionTimeout":30,
          "qosType":"EXACTLY_ONCE",
          "editPermission":"",
          "purgeOverride":false,
          "purgePeriod":1
        }
      ],
      "dataPoints":[
        {
          "xid":"DP_ba31c77f-9c4f-4f02-802c-afcfae830441",
          "name":"number",
          "enabled":true,
          "loggingType":"ALL",
          "intervalLoggingPeriodType":"MINUTES",
          "intervalLoggingType":"AVERAGE",
          "purgeType":"YEARS",
          "pointLocator":{
            "dataType":"NUMERIC",
            "subscribeTopicType":"JSON_WITH_TIMESTAMP",
            "subscribeJsonTimestampPath":"\/ts",
            "subscribeJsonTimestampPattern":"yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSX",
            "subscribeJsonValuePath":"\/d",
            "subscribeTopic":"infiniteautomation\/test\/number",
            "publishTopicType":"JSON_WITH_TIMESTAMP",
            "publishJsonTimestampName":"ts",
            "publishJsonTimestampPattern":"yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSX",
            "publishJsonTimestampZone":"UTC",
            "publishJsonValueName":"d",
            "publishTopic":"infiniteautomation\/test\/set\/number"
          },
          "eventDetectors":[
          ],
          "plotType":"STEP",
          "rollup":"NONE",
          "unit":"s",
          "simplifyType":"NONE",
          "chartColour":"",
          "chartRenderer":{
            "type":"IMAGE",
            "timePeriodType":"DAYS",
            "numberOfPeriods":1
          },
          "dataSourceXid":"DS_b911d1a5-dcfd-424d-ab07-77134185f2a8",
          "defaultCacheSize":1,
          "deviceName":"Test.Mosquitto.ORG Client",
          "discardExtremeValues":false,
          "discardHighLimit":1.7976931348623157E308,
          "discardLowLimit":-1.7976931348623157E308,
          "intervalLoggingPeriod":1,
          "intervalLoggingSampleWindowSize":0,
          "overrideIntervalLoggingSamples":false,
          "preventSetExtremeValues":false,
          "purgeOverride":false,
          "purgePeriod":1,
          "readPermission":"",
          "setExtremeHighLimit":1.7976931348623157E308,
          "setExtremeLowLimit":-1.7976931348623157E308,
          "setPermission":"",
          "tags":{
          },
          "textRenderer":{
            "type":"ANALOG",
            "useUnitAsSuffix":true,
            "format":"0.00"
          },
          "tolerance":0.0
        },
        {
          "xid":"DP_0460c207-8a22-4b7c-92b6-ab70c1c41d1c",
          "name":"number-recieve",
          "enabled":true,
          "loggingType":"ALL",
          "intervalLoggingPeriodType":"MINUTES",
          "intervalLoggingType":"INSTANT",
          "purgeType":"YEARS",
          "pointLocator":{
            "dataType":"NUMERIC",
            "subscribeTopicType":"JSON_WITH_TIMESTAMP",
            "subscribeJsonTimestampPath":"\/ts",
            "subscribeJsonTimestampPattern":"yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSX",
            "subscribeJsonValuePath":"\/d",
            "subscribeTopic":"infiniteautomation\/test\/set\/number",
            "publishTopicType":"JSON_WITH_TIMESTAMP",
            "publishJsonTimestampName":"ts",
            "publishJsonTimestampPattern":"yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSX",
            "publishJsonTimestampZone":"UTC",
            "publishJsonValueName":"d",
            "publishTopic":"infiniteautomation\/test\/number"
          },
          "eventDetectors":[
          ],
          "plotType":"STEP",
          "rollup":"NONE",
          "unit":"s",
          "simplifyType":"NONE",
          "chartColour":"",
          "chartRenderer":{
            "type":"IMAGE",
            "timePeriodType":"DAYS",
            "numberOfPeriods":1
          },
          "dataSourceXid":"DS_b911d1a5-dcfd-424d-ab07-77134185f2a8",
          "defaultCacheSize":1,
          "deviceName":"Test.Mosquitto.ORG Client",
          "discardExtremeValues":false,
          "discardHighLimit":1.7976931348623157E308,
          "discardLowLimit":-1.7976931348623157E308,
          "intervalLoggingPeriod":15,
          "intervalLoggingSampleWindowSize":0,
          "overrideIntervalLoggingSamples":false,
          "preventSetExtremeValues":false,
          "purgeOverride":false,
          "purgePeriod":1,
          "readPermission":"",
          "setExtremeHighLimit":1.7976931348623157E308,
          "setExtremeLowLimit":-1.7976931348623157E308,
          "setPermission":"",
          "tags":{
          },
          "textRenderer":{
            "type":"ANALOG",
            "useUnitAsSuffix":true,
            "format":"0.00"
          },
          "tolerance":0.0
        }
      ]
    }