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.

  • Reflection use for datasource host

    6
    0 Votes
    6 Posts
    2k Views
    phildunlapP
    No, it's a reference to the variable in Java directly.
  • Listing email alerts for a specific device

    8
    0 Votes
    8 Posts
    3k Views
    phildunlapP
    As is in the thread, it's a scripting data source. It's JavaScript that invokes the Java directly. I didn't supply the intended cron pattern, though, probably something like 0 0 0 * * ? for that thread, but maybe someone wants an 8 AM summary instead?
  • Angular question in a master slave Mango publisher environment

    4
    0 Votes
    4 Posts
    2k Views
    E
    @etantonio said in Angular question in a master slave Mango publisher environment: The architecture seems to be ok in this way but my problem is on master side, I've no idea about how to use the returning masterControlEnabled=0 from the slave to the master in order to switch off the upgrade request from the master to the slave. this is my solution to this: <md-button ng-if="TRK_9_1_master_control_enabled.value==1" ng-init="TRK_9_1_upgrade.setValue(0)" ng-click="TRK_9_1_upgrade.setValue(1)" class="md-raised" title="Upgrade">Upgrade</md-button> <md-button ng-if="TRK_9_1_master_control_enabled.value==0 && TRK_9_1_upgrade.value==1" class="md-raised md-pressed" title="Upgrading">Upgrading</md-button>
  • Script Side Functions list

    2
    0 Votes
    2 Posts
    1k Views
    phildunlapP
    Hi Matias, To a full list, that's a very large question! I assume you mean scripting data sources, meta points, event handlers, excel reports and such. Scripts can invoke Java code, so they can do most anything! The most authoritative documentation for the possibilities within the Mango codebase would be our Github: https://github.com/infiniteautomation/ma-core-public Of course, there are some script utilities that are documented in the contextual help, or here: https://help.infiniteautomation.com/about-mango-java-script So far as the actual task you mention, I need to make some scripts verifying the last login time of some users You have a couple options of varying complexity. Query for user login events and check that the users in question have logged in at whatever is the appropriate time period. While there is not an events script utility yet, I have answered questions about querying the events from scripts before on the forum. for instance this thread which sends an email of the last day's DATA_POINT type event: https://forum.infiniteautomation.com/topic/3147/email-last-day-s-events Have an event handler on user login events zero out a virtual data point that increments on some interval and has a limit detector that sends an email they've not logged in for X period of time. Since all user login events would be handled by the same event handler it will take some scripting to parse which user has logged in from the evt.message or use a no update detector on that point and set it to the login time when they login. Put a button on a dashboard that they have to hit to zero out their time-since-active incrementing virtual point which has the limit detector, like (2), or the button updates a point with a no update detector. Script for (2), in an event handler for user login events to get the username: //English translation only, some other regex or string splitting if other language var username = /User (.*?) logged in/.exec(event.message)[1];
  • Formatting 'converted' point values

    8
    0 Votes
    8 Posts
    3k Views
    Jared WiltshireJ
    @richard-mortimer said in Formatting 'converted' point values: I'd be curious as to the other reasons, to see whether there would be valid reasons to suggest a change to this? If you change the suffix as I suggested you will see the change anywhere that the point value is displayed, i.e. on any dashboard (without explicitly formatting it), on any report, on any email, on any built in Mango page such as Watchlists etc. You also get the benefits that <ma-point-value> provides such as the popup Craig mentioned, the flash on change, the unreliable indicator, the event indicator and the red cross hatching when the data point is disabled etc.
  • Changing class based on data point value

    13
    0 Votes
    13 Posts
    3k Views
    richard.mortimerR
    @jared-wiltshire - cheers for that ... I'm still within the great leap of faith from PHP to Angular ... Richard
  • Datafile issue

    3
    0 Votes
    3 Posts
    2k Views
    phildunlapP
    Hi Jérôme, @jérôme-girard said in Datafile issue: Sorry for the question :) A bug in my class caused this error. No worries! Thanks for sharing the resolution. Sorry I didn't have the time to take a peak when this was posted. I don't generally click people's links. Better to paste the class and sample data on the forum I think.
  • Find datapoint value from one week ago

    3
    0 Votes
    3 Posts
    2k Views
    richard.mortimerR
    Thanks, I've got the following code which displays the current time, and one week ago: <ma-now update-interval="1 SECONDS" output="time"></ma-now> {{ time }}<br /> {{ time | maMoment:'subtract':7:'days' }} but I'm not sure how to put it in the statistics part, the following fails: <ma-point-statistics point-xid="DP_349842" from="time" to="time | maMoment:'subtract':7:'days'" statistics="statsObj"></ma-point-statistics> as does wrapping it in braces, am I following the right syntax? [edit] Looks like I had the right syntax (albeit with the dates the wrong way around): <ma-point-statistics point-xid="DP_349842" from="time | maMoment:'subtract':7:'days'" to="time" statistics="fuel1"></ma-point-statistics> The issue was with the value I was selecting: (Last week: {{ fuel1.minimum.value }}) is correct (Last week: {{ fuel1.average.value }}) is not .... Cheers Richard
  • Ideas/suggestions for auto creating data points

    Moved
    9
    0 Votes
    9 Posts
    3k Views
    phildunlapP
    That's during validation, right? Unfortunately for the email handler they're not quite the same. You could have a little preamble like this, if(typeof evt === 'undefined') evt = event; if(typeof event === 'undefined') event = evt; I did fix this for 3.6, adding event into the runtime of the Email Handler as an EventInstanceWrapper, and evt as the EventInstance in validation.
  • Script Execution Delays

    2
    0 Votes
    2 Posts
    1k Views
    phildunlapP
    Hi bkeppel, welcome to the forum! I have tried to write a sleep function The JavaScript environment in Mango provide a sleep function, RuntimeManager.sleep(milliseconds) Pseudocode is as follows: If startTimer = True and it has been 10s since startTimer has been set to True, set startRules = true. Note: I currently have startTimer enabled to udate context. It sounds to me like what you want is to put a "State" event detector on the startTimer point, having a 10 second duration (to ensure it's been in the start timer state for 10 seconds), and then create an event handler to do the control that you would like to do after the event becomes active (eliminating the need to sleep in the script). You should do what makes sense to you though, if knowing about the existing sleep function is enough to achieve what you're working on.
  • Accumulator has downward steps

    4
    0 Votes
    4 Posts
    2k Views
    phildunlapP
    I could see how on my.pointValueBefore(my.time) could run into issues in a history generation without use of the cache control, so my.pointValueBefore(my.time, true) If the logic you want is return my.value + (power.past(MINUTE,1).average/60); I think we should approach from why this would not be working. Have you tried generating history for return (power.past(MINUTE,1).average/60); to ensure you're getting the positive values? That simple form is what I think would be the right way to write it.
  • PointValue with question mark(?) register

    3
    0 Votes
    3 Posts
    2k Views
    A
    I think something on the very beggining of the scripting tests was recorded in the history and was tricking the new values. I copied the DP to a new fresh one, and it worked. Thanks!
  • Unable to display value from Meta data point

    9
    0 Votes
    9 Posts
    3k Views
    B
    well, problem was "raw" display setting (thank you @Jared-Wiltshire) among other things. Used range display on his and @CraigWeb's advice - works great. Thanks, all!
  • Arrow function in global script

    5
    0 Votes
    5 Posts
    2k Views
    CraigWebC
    Hence the removal of RhinoJS from the help documents. My bad I probably should of looked first.
  • 0 Votes
    4 Posts
    2k Views
    P
    @phildunlap @craigweb Thank you both. This time the error was mine. I thought the point was multistate, but I now realize it was numeric rendered as a range. So I exported its historic values, changed the point type, then imported the values back in. It works now. The containsKey() example in the Mango Javascript help also works. In the past some of the examples did not work or were not consistent with new back-end functionality. I have not checked the other examples.
  • Create an Email Template for Event Handler

    8
    0 Votes
    8 Posts
    3k Views
    M
    Thanks !! That did the trick...
  • Mango JavaScript : Standard deviation

    5
    0 Votes
    5 Posts
    2k Views
    K
    Done very good solution Thank you
  • Not a function

    18
    0 Votes
    18 Posts
    5k Views
    phildunlapP
    @Pedro After even further discussion we will be adding the get() function back in. It will work for multistate and binary points to get the StartsAndRuntime object for that state, and it will return a 0 starts, 0 proportion, 0 runtime object for states that did not occur. To check if a state is present in a statistics object, therefore, one can check that (if they feel it is distinct to their scripts' logic) by .past(HOUR, 1).startsAndRuntime[true] == null Sorry for any inconvenience this caused. Edit: Here is the example from the JavaScript help internal to Mango, var stats = b.past(MONTH, 2); var sar = stats.get(false).proportion; //get the proportion of time in false whether or not false occurred var stateNotNull = stats.getStartsAndRuntime().containsKey(false); //see if false occurred and here is the help page's example, https://help.infiniteautomation.com/about-mango-java-script/ return b.past(MONTH, 2).get(false).proportion;
  • 0 Votes
    2 Posts
    1k Views
    phildunlapP
    Hi 12137022, welcome to the forum! Is it possible to receive data from hmc5883l (i2c) sensors, through a raspberry pi 3. This question is outside the scope of this forum. It probably is possible, I would expect there are guides out there for doing I2C on an RPi and possibly the specific sensor. And maybe someone here will know, too. Treat this data on python and send it directly, without having to send it to a database? What do you mean? Mango can have points that do not log, and you could just have a list in python that grows until you run out of memory. So, yes, that is possible, whichever you are seeking to avoid databases with. I would like to monitor the sensors in real time and display in a graphical interface. Once you've gotten your values into Python, you can queue them in a simple list and publish them to Mango all sorts of ways. This seems like it's duplicating the very recent question: https://forum.infiniteautomation.com/topic/3737/import-values-from-python-script
  • 0 Votes
    9 Posts
    3k Views
    phildunlapP
    No worries, glad it's working for ya!