• header.categories
    • header.recent
    • header.tags
    • header.popular
    • register
    • login

    Retrieving values table from sensor graphs

    scheduled pinned locked moved Getting Started
    3 posts 2 posters 1.5k views 1 watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • M offline
      MTBHuw
      global:last-edited-by,

      Another post from me I'm afraid. Is there a way to extract a table of readings from the sensor graphs, whether as a text file, csv etc.?

      jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
      • jkandasaJ offline
        jkandasa @MTBHuw
        global:last-edited-by,

        @mtbhuw This feature yet to implement on https://github.com/mycontroller-org/mycontroller/issues/361

        This might help you https://forum.mycontroller.org/topic/79/temperature-min-max-avg

        one-reply-to-this-post last-reply-time reply quote 0
        • M offline
          MTBHuw
          global:last-edited-by, jkandasa

          Thanks, I tried running the script:

          var myImports = new JavaImporter(java.io, java.lang, java.util, java.text);
          
          with(myImports) {
          var sVar = mcApi.uidTag().getByUid("temp-outside").getResource(); // Get sensor variable object with UidTag api
          var minMaxData = mcApi.metric().getSensorVariableMetricDouble(sVar, 0,1479833863195); //(sensor-variable-object, from-timestamp, to-timestamp)
          }
          

          changing "temp-outside" to my own uidTag for my sensor. It worked but seemed to return a lot more information than needed, although I see that the value (distance) is there, but among a lot of unwanted data. Is there a way of extracting just time/distance from this? Here's a sample of what was returned....

          {
            "sVar": {
              "id": 7,
              "sensor": {
                "id": 8,
                "sensorId": "1",
                "type": "S_DISTANCE",
                "name": "",
                "lastSeen": 1509978854438,
                "node": {
                  "id": 10,
                  "eui": "1",
                  "gatewayTable": {
                    "id": 1,
                    "enabled": true,
                    "name": "Serial Gateway",
                    "networkType": "MY_SENSORS",
                    "state": "UP",
                    "statusMessage": "Connected Successfully",
                    "statusSince": 1509967019993,
                    "type": "SERIAL",
                    "properties": {
                      "br": 115200,
                      "rdr": "jSerialComm",
                      "rf": 30,
                      "txDelay": 0,
                      "dr": "Auto",
                      "pn": "/dev/ttyACM0"
                    }
                  },
                  "name": "Distance Sensor",
                  "version": "1.0",
                  "type": "S_ARDUINO_NODE",
                  "libVersion": "2.1.1",
                  "state": "UP",
                  "lastSeen": 1509978855129,
                  "properties": {
                    "hbTx": 1509978436346
                  },
                  "registrationState": "REGISTERED",
                  "smartSleepEnabled": false
                },
                "variableTypes": [
                  "Distance"
                ],
                "idforVariables": 8
              },
              "variableType": "V_DISTANCE",
              "metricType": "DOUBLE",
              "timestamp": 1509978853779,
              "value": "151",
              "previousValue": "150",
              "unitType": "U_DISTANCE",
              "readOnly": false,
              "offset": 0,
              "priority": 100,
              "properties": {
                "marginRight": 20,
                "color": "#ff7f0e",
                "interpolate": "linear",
                "subType": "line",
                "marginBottom": 60,
                "useGlobal": true,
                "type": "lineChart",
                "marginTop": 5,
                "marginLeft": 65
              },
              "metricsGraph": {
                "id": 5,
                "metricName": "Distance",
                "type": "lineChart",
                "interpolate": "linear",
                "subType": "line",
                "color": "#ff7f0e"
              }
            },
            "myImports": {},
            "minMaxData": {
              "variable": {
                "id": 7,
                "sensor": {
                  "id": 8,
                  "sensorId": "1",
                  "type": "S_DISTANCE",
                  "name": "",
                  "lastSeen": 1509978854438,
                  "node": {
                    "id": 10,
                    "eui": "1",
                    "gatewayTable": {
                      "id": 1,
                      "enabled": true,
                      "name": "Serial Gateway",
                      "networkType": "MY_SENSORS",
                      "state": "UP",
                      "statusMessage": "Connected Successfully",
                      "statusSince": 1509967019993,
                      "type": "SERIAL",
                      "properties": {
                        "br": 115200,
                        "rdr": "jSerialComm",
                        "rf": 30,
                        "txDelay": 0,
                        "dr": "Auto",
                        "pn": "/dev/ttyACM0"
                      }
                    },
                    "name": "Distance Sensor",
                    "version": "1.0",
                    "type": "S_ARDUINO_NODE",
                    "libVersion": "2.1.1",
                    "state": "UP",
                    "lastSeen": 1509978855129,
                    "properties": {
                      "hbTx": 1509978436346
                    },
                    "registrationState": "REGISTERED",
                    "smartSleepEnabled": false
                  },
                  "variableTypes": [
                    "Distance"
                  ],
                  "idforVariables": 8
                },
                "variableType": "V_DISTANCE",
                "metricType": "DOUBLE",
                "timestamp": 1509978853779,
                "value": "151",
                "previousValue": "150",
                "unitType": "U_DISTANCE",
                "readOnly": false,
                "offset": 0,
                "priority": 100,
                "properties": {
                  "marginRight": 20,
                  "color": "#ff7f0e",
                  "interpolate": "linear",
                  "subType": "line",
                  "marginBottom": 60,
                  "useGlobal": true,
                  "type": "lineChart",
                  "marginTop": 5,
                  "marginLeft": 65
                },
                "metricsGraph": {
                  "id": 5,
                  "metricName": "Distance",
                  "type": "lineChart",
                  "interpolate": "linear",
                  "subType": "line",
                  "color": "#ff7f0e"
                }
              }
            }
          }
          
          one-reply-to-this-post last-reply-time reply quote 0
          • first-post
            last-post

          0

          online

          644

          users

          532

          topics

          3.4k

          posts
          Copyright © 2015-2025 MyController.org | Contributors | Localization