• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. glamprecht
    3. Topics

    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 Mango 5 Documentation Website
    G
    • Profile
    • Following 0
    • Followers 0
    • Topics 12
    • Posts 28
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by glamprecht

    • G

      Drop down DataSources instead of Watchlist

      Dashboard Designer & Custom AngularJS Pages
      • • • glamprecht
      2
      0
      Votes
      2
      Posts
      1.2k
      Views

      phildunlapP

      Hi glamprecht,

      You can use a parameter of type data source. Then you can use that data source object in crafting the RQL for the query on the 1 watchlist it would take to achieve what I think you're asking.

      Go to the Watchlist Builder, make a new point query watchlist
      0_1544643861891_step1.png

      Add a data source parameter
      0_1544643899633_step2.png

      Refer to the value of that parameter, which in this case is a data source object, in the RQL query. I am using the Data Source XID for I need to use the interpolated value {{DS.xid}} to get that xid from the data source model.
      0_1544643923734_step3.png

      Profit!
      0_1544643934663_step4.png

    • G

      Mango XHR request failed

      User help
      • • • glamprecht
      2
      0
      Votes
      2
      Posts
      1.1k
      Views

      Jared WiltshireJ

      @glamprecht There should be an error logged in your ma.log file (find it under System Status in the Administration menu). Please post this.

      You can try using the "Bulk data point edit" page in the new UI if you are on a recent version of Mango.

    • G

      Multiplicand and Augend on HTTP Receiver

      Mango Automation general Discussion
      • • • glamprecht
      6
      0
      Votes
      6
      Posts
      1.8k
      Views

      phildunlapP

      Wont using virtual serial port limit this connection to 1 stream, ie 1 PI ?

      Yes, good suspicion!

      Yes I have control over the HTTP messages, so I can add anything to that,

      Great! So I would set up an HTTP receiver with only one point, Let's say its parameter name is 'data' (or maybe just d, for short). Then I'll publish to the receiver messages like

      POST / HTTP/1.1 User-Agent: Mango M2M2 HTTP Sender publisher Content-Length: 31 Content-Type: application/x-www-form-urlencoded Host: 127.0.0.1 Connection: Keep-Alive Expect: 100-continue Accept-Encoding: gzip,deflate data=s1z56.78+s2z78.90+s3z12.34

      And put the http receiver point with Parameter name "data" into the context of a script like,

      var sensorTransforms = this.sensorTransforms; if(typeof this.sensorTransforms === 'undefined') { this.sensorTransforms = sensorTransforms = { //Use this map of sensor identifiers to transformation functions to // manipulate the value of the data s1: function(val) { return val*2 + 3; }, s2: function(val) { return val*6 - 12; }, s3: function(val) { return Math.pow(val, 2); } }; } function createPoint(identifier) { var newDp = JSON.parse(JsonEmport.dataPointQuery( 'eq(xid,DP_BaseQueueProcessorNumeric)')).dataPoints[0]; newDp.enabled = true; newDp.pointLocator.varName = identifier; newDp.name = "Sensor " + identifier; delete newDp.xid; //To generate a new XID, //or encode your own XID for reference elsewhere JsonEmport.doImport( JSON.stringify({"dataPoints": [newDp]}) ); } //Because there is a slight asynchrony, we need to track where we got to in the data // queue, so we'll use a context point for that. var unprocessedMessages = data.pointValuesSince(tracker.time); var lastTs = 0; for(var k = 0; k < unprocessedMessages.length; k+=1) { var sensorData = unprocessedMessages[k].stringValue.split(" "); for(var j = 0; j < sensorData.length; j+=1) { var pointData = sensorData[j].split("z"); if(typeof this[pointData[0]] === 'undefined' ) { createPoint(pointData[0]); } if( pointData[0] in sensorTransforms ) this[pointData[0]].set( sensorTransforms[pointData[0]](Number(pointData[1])) ); else this[pointData[0]].set( Number(pointData[1]) ); } lastTs = unprocessedMessages[k].time; } //Update the timestamp we have processed unto if(lastTs !== 0) tracker.set(!tracker.value, lastTs);

      And here's the JSON for the script and the base points (you will probably need to define a cron for the scripting data source, as the feature to have a scripting data source only be driven by context point updates has been added to 3.5 (which should see some sort of alpha release today or very soon). You would probably also need to create a "Numeric_All-Data" data point template. It also has the JSON for the HTTP receiver I tested with

      { "dataSources":[ { "xid":"DS_306b3fdc-b914-4187-9a4c-0024be71d52e", "name":"DataQueueProcessor", "enabled":false, "type":"SCRIPTING", "alarmLevels":{ "SCRIPT_ERROR":"URGENT", "DATA_TYPE_ERROR":"URGENT", "POLL_ABORTED":"URGENT", "LOG_ERROR":"URGENT" }, "purgeType":"YEARS", "updateEvent":"CONTEXT_UPDATE", "context":[ { "varName":"data", "dataPointXid":"DP_97ba3ae9-f9ca-4b36-a557-b07fc89824f1", "updateContext":true } ], "logLevel":"NONE", "cronPattern":"", "executionDelaySeconds":0, "historicalSetting":false, "script":"var sensorTransforms = this.sensorTransforms;\nif(typeof this.sensorTransforms === 'undefined') {\n this.sensorTransforms = sensorTransforms = {\n \/\/Use this map of sensor identifiers to transformation functions to\n \/\/ manipulate the value of the data\n s1: function(val) { return val*2 + 3; },\n s2: function(val) { return val*6 - 12; },\n s3: function(val) { return Math.pow(val, 2); }\n };\n}\n\nfunction createPoint(identifier) {\n var newDp = JSON.parse(JsonEmport.dataPointQuery(\n 'eq(xid,DP_BaseQueueProcessorNumeric)')).dataPoints[0];\n newDp.enabled = true;\n newDp.pointLocator.varName = identifier;\n newDp.name = \"Sensor \" + identifier;\n delete newDp.xid; \/\/To generate a new XID,\n \/\/or encode your own XID for reference elsewhere\n JsonEmport.doImport( JSON.stringify({\"dataPoints\": [newDp]}) );\n}\n\n\/\/Because there is a slight asynchrony, we need to track where we got to in the data\n\/\/ queue, so we'll use a context point for that.\nvar unprocessedMessages = data.pointValuesSince(tracker.time);\nvar lastTs = 0;\nfor(var k = 0; k < unprocessedMessages.length; k+=1) {\n var sensorData = unprocessedMessages[k].stringValue.split(\" \");\n for(var j = 0; j < sensorData.length; j+=1) {\n var pointData = sensorData[j].split(\"z\");\n if(typeof this[pointData[0]] === 'undefined' ) {\n createPoint(pointData[0]);\n }\n if( pointData[0] in sensorTransforms )\n this[pointData[0]].set( sensorTransforms[pointData[0]](Number(pointData[1])) );\n else\n this[pointData[0]].set( Number(pointData[1]) );\n }\n lastTs = unprocessedMessages[k].time;\n}\n\n\/\/Update the timestamp we have processed unto\nif(lastTs !== 0)\n tracker.set(!tracker.value, lastTs);\n", "scriptPermissions":{ "customPermissions":"", "dataPointReadPermissions":"superadmin,superadmin", "dataPointSetPermissions":"superadmin,superadmin", "dataSourcePermissions":"superadmin,superadmin" }, "editPermission":"", "purgeOverride":false, "purgePeriod":1 }, { "xid":"DS_bcd20bf3-a723-4631-a5ce-77f409e54a46", "name":"DataQueueReceiver", "enabled":true, "type":"HTTP_RECEIVER", "alarmLevels":{ "SET_POINT_FAILURE":"URGENT" }, "purgeType":"YEARS", "setType":"PUBLISHER", "dateFormat":"DATE_FORMAT_BASIC", "deviceIdWhiteList":[ "*" ], "ipWhiteList":[ "*.*.*.*" ], "setPointUrl":"", "editPermission":"", "purgeOverride":false, "purgePeriod":1 } ], "dataPoints":[ { "xid":"DP_97ba3ae9-f9ca-4b36-a557-b07fc89824f1", "name":"Data Message", "enabled":true, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"INSTANT", "purgeType":"YEARS", "pointLocator":{ "dataType":"ALPHANUMERIC", "binary0Value":"", "includeTimestamp":true, "parameterName":"data", "setPointName":"", "settable":false }, "eventDetectors":[ ], "plotType":"STEP", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"TABLE", "limit":10 }, "dataSourceXid":"DS_bcd20bf3-a723-4631-a5ce-77f409e54a46", "defaultCacheSize":1, "deviceName":"DataQueueReceiver", "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":"PLAIN", "useUnitAsSuffix":true, "unit":"", "renderedUnit":"", "suffix":"" }, "tolerance":0.0 }, { "xid":"DP_60527aba-6569-451a-91a7-9b1c1c940811", "name":"Queue Timestamp Tracker", "enabled":true, "loggingType":"ON_CHANGE", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"INSTANT", "purgeType":"YEARS", "pointLocator":{ "dataType":"BINARY", "contextUpdate":false, "settable":true, "varName":"tracker" }, "eventDetectors":[ ], "plotType":"STEP", "rollup":"NONE", "unit":"", "templateXid":"Binary_Default", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"TABLE", "limit":10 }, "dataSourceXid":"DS_306b3fdc-b914-4187-9a4c-0024be71d52e", "defaultCacheSize":1, "deviceName":"DataQueueProcessor", "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":"BINARY", "oneColour":"black", "oneLabel":"one", "zeroColour":"blue", "zeroLabel":"zero" }, "tolerance":0.0 }, { "xid":"DP_BaseQueueProcessorNumeric", "name":"Base Numeric Sensor Point", "enabled":false, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"AVERAGE", "purgeType":"YEARS", "pointLocator":{ "dataType":"NUMERIC", "contextUpdate":false, "settable":true, "varName":"notEnabledBaseDataPoint" }, "eventDetectors":[ ], "plotType":"SPLINE", "rollup":"NONE", "unit":"", "templateXid":"Numeric_All_Data", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"IMAGE", "timePeriodType":"DAYS", "numberOfPeriods":1 }, "dataSourceXid":"DS_306b3fdc-b914-4187-9a4c-0024be71d52e", "defaultCacheSize":1, "deviceName":"DataQueueProcessor", "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, "unit":"", "renderedUnit":"", "format":"0.00" }, "tolerance":0.0 } ] }

      Choosing space and the letter z for my value delimiters was arbitrary (but saved me some HTTP encoding in my nc testing by hand). You can use anything properly query-string-encoded as your delimiters except the @ which is used when timestamps are transmitted. You would just need to adjust the script accordingly.

      Also I should mention there's an outstanding issue where HTTP receivers don't get messages coming in over IPv6. This means prefer 127.0.0.1 to localhost, as localhost may be ::1 and get bounced by the whitelist. https://github.com/infiniteautomation/ma-core-public/issues/107

      Sounding like a reasonable direction?

    • G

      How to refresh image by time or by click

      User help
      • • • glamprecht
      2
      0
      Votes
      2
      Posts
      1.2k
      Views

      phildunlapP

      Hi glamprecht,

      The solution is likely similar to the self-refreshing image solution here: https://forum.infiniteautomation.com/topic/3428/img-refresh

      Simply modify some variable that is in the ng-src of the image as a parameter and it should re-request the image without having to reload the whole page.

    • G

      Mango can monitor 6 phases power & 127 sensors in a 1U device.

      Hardware
      • • • glamprecht
      2
      0
      Votes
      2
      Posts
      1.7k
      Views

      JoelHaggarJ

      Very nice, it would be great if you can write up a case study for the main website. https://infiniteautomation.com/case-studies-landing/

    • G

      Event Handlers not saving after Mango 3

      User help
      • • • glamprecht
      3
      0
      Votes
      3
      Posts
      1.2k
      Views

      G

      This worked. Thank you.

    • G

      Opening image based on datapoint value under watch list

      Dashboard Designer & Custom AngularJS Pages
      • • • glamprecht
      4
      0
      Votes
      4
      Posts
      1.6k
      Views

      Jared WiltshireJ

      @glamprecht said in Opening image based on datapoint value under watch list:

      I can now see how to get the point value. Likewise I can get the dataSourceXid like this:
      (designer.points | filter:{name:'Camera_name'}:true | maFirst).dataSourceXid)

      Instead of using the value as in the past, I would now like to get the last digits of the IP address of the dataSourceXid (being an SNMP datasource)

      I can see how to access the datapoint through designer.points ,but I cannot figure out how to access the datasource and its address?

      You would have to retrieve the data source by its XID for each data point, there's not an easy way of doing this. I would recommend using the bulk data point editor to set a tag on each of your datapoints and use this tag instead.

    • G

      Thumbnail image

      User help
      • • • glamprecht
      4
      0
      Votes
      4
      Posts
      1.9k
      Views

      phildunlapP

      The Image is sort of in the database. The HTTP Image source will save your images into Mango/web/WEB-INF/filedata/ and save file information into the database as a string. You certainly can use an HTML component to load a remote image for your graphical view, as well.

    • G

      Mango Crashes

      Mango Automation general Discussion
      • • • glamprecht
      5
      0
      Votes
      5
      Posts
      2.5k
      Views

      JoelHaggarJ

      You can do a top and look for a java process. The PID should match the the one in the MA_HOME/bin/ma.pid file.

      You can check to see if that PID file is there. If Mango crashed that file could still be there even though Mango isn't running. If the file isn't there then it probably means something shut Mango down or killed it's process and the ma.pid file was removed.

    • G

      Handling Bit Fields

      User help
      • • • glamprecht
      4
      0
      Votes
      4
      Posts
      2.2k
      Views

      JoelHaggarJ

      It's ok to use the same variable name in multiple meta data points as variable names are isolated to each script and not shared between them.

    • G

      Error: Unable to resolve constructor for: 'dijit.ColorPalette

      User help
      • • • glamprecht
      8
      0
      Votes
      8
      Posts
      3.2k
      Views

      G

      I found the problem, although the cause is still unknown. There are 3 mobile operator networks in South Africa. Connecting to the mango server over the internet via Vodacom causes this error that prevent datasources from being created at all using any browser on any operating system. The mobile operator must be filtering some Ajax or HTML headers.

    • G

      Using HTTP Retriever to retrieve data using HTTP GET

      User help
      • • • glamprecht
      4
      0
      Votes
      4
      Posts
      2.3k
      Views

      JoelHaggarJ

      Right, this works exactly as you describe so to work with that data logger you would need one data source per 5 data points.