1

I need to get the temperature and humidity values and store them into a AWS timestream table as values, so that i can use them in Grafana.

How could i retrieve those numbers-values in a usable format instead of string array? I tried to retrieve only temperature with no success:

SELECT (SELECT temperature FROM data.value.device_list) as temp FROM   MyAWSTopic 

The received MQTT payload is the following:

{
  "time": 1651066698,
  "mac": "30:ae:7b:e2:23:72",
  "from": "BLE",
  "to": "GATEWAY",
  "data": {
    "attribute": "mod.device_list",
    "mac": "20:ae:7c:e2:28:72",
    "value": {
      "device_list": [
        {
          "modelstr": "MDSensor",
          "sensortype": "Temperature_Humdity",
          "connectable": 1,
          "ble_addr": "E5:02:C5:79:F2:C4",
          "temperature": "26.392",
          "scan_rssi": -35,
          "addr_type": 1,
          "scan_time": 1651064693,
          "dev_name": "DBeacon",
          "data": "02010608FF5904555B454360573756E426561636F6E",
          "humidity": "35.119",
          "connect": 0
        }
      ]
    }
  },
  "deviceCode": "aws_device_code",
  "type": "reportAttribute"
  }

And this is the result i get : [{"temperature":"26.073"},{},{},{}]

Generated table

vatech696
  • 31
  • 3
  • What language are you using? What have you tried? This looks to be simple JSON parsing which should be pretty simple in most languages. – hardillb Apr 27 '22 at 16:54
  • i am creating a rule in AWS-IoT. i also tryed the select statement as: SELECT data.value.device_list.temperature FROM TopicName with no result – vatech696 Apr 27 '22 at 17:05
  • Hello, welcome. Please allow me to suggest you to read https://stackoverflow.com/help/how-to-ask . I'm sure you'll get help having your question edited according to the instructions. Best luck. – statosdotcom Apr 29 '22 at 15:25

0 Answers0