Facility Control

 View Only
  • 1.  email notification on parameter change

    Posted 11-20-2014 21:14
    Hello,

    In short, I wonder if anyone would be able to point me towards a solution for creating a script for email notification on a specific parameters change in Dashboard. For example, we have a couple of SFS-8622-A for our main and backup TX feeds. If the SDI input signal probe parameter would change from 'OK' to 'none*, it would be nice to have it fire off an email saying that there is an issue.

    I know that this could be achieved via SNMP, but as most of you probably already knows, the 'SIMPLE' in SNMP is actually quite cumbersome and esoteric to work with.

    /Martin


  • 2.  RE: email notification on parameter change

    Posted 12-05-2014 15:10
    Missed this one when it came in - sorry!

    You're not going to find a simple way to send an email from within DashBoard either (there are no libraries for that kind of action built-in/exposed). For the most part, you'll need a 3rd-party application to achieve this (unless you're particularly keen to re-create an SMTP client in ogScript).

    1. If you have an application that can take String input on a port and automatically fire-off an email, `rosstalk.sendMessage('[host]', port, '[message as string]')` is a reasonable approach

    2. If you have a web-based application that can take input and send an email, `ogscript.asyncPost('[URL]', '[data]', callback)` would work for you

    3. If you created a new file each time the parameter changed and had an application that would take new files in a directory and send an email, `ogscript.saveToFile('[path]', '[data]', [overwrite]);` would work (to make sure you always get a NEW file, you can use something like `'c:sendTheseEmailsfile' + (new Date()).getTime() + '.txt'`). I found a few applications fairly quickly by Googling [QUOTE]automatically email a file in a directory (though I haven't used any of them personally)

    Hope this provides you some direction.

    #DashBoard


  • 3.  RE: email notification on parameter change

    Posted 12-10-2014 23:49
    Thank you James for your reply. However, it seems as if I am stuck way before I get to the emailing part. I have drag'n'drop a parameter text field from a controller into my grid. The text field updates in real-time and in parameter inspector in debugger, I can see that the parameter changes. To me that indicates that the paramter info is valid and working.

    I've put in a simple

    var abc = params.getValue(0x3F06,0); as an ogscript task in a button. But it doesn't work. I get an Exception flag in debugger

    wrapped.java.lang.nullpointerexception (anonymouslabeltask#1)

    What could it be?

    thx in advance

    /Martin

    #DashBoard


  • 4.  RE: email notification on parameter change

    Posted 12-12-2014 16:31
    You would get a null pointer exception (or just a null in the latest DashBoard release) if the parameter doesn't exist or is inaccessible.

    You likely have 2 (or more) different device contexts (data sources) in your panel (if you created a panel with a self-contained data source) and then dragged an item into the panel, the container around the dragged item would be the only part that knows about controller. If the entire panel is going to work with that controller, then the entire grid could/should be pointed to the controller (by selecting it as the data source in the top-most tag). If you do need access to multiple data sources, you can put an ID in the container that points to your controller and then use: params.getParam([context id], [oid], [index]) to gain access to that parameter or put your change handler script inside of that container.

    Clear-ish? I know it can get confusing pretty quickly when the conversation starts down the road of accessing multiple data sources in a custom panel. If you have any questions, please ask.

    #DashBoard


  • 5.  RE: email notification on parameter change

    Posted 12-16-2014 13:37
    Hello James, and once again - thank you for your reply.

    The panel is aimed to be something of a high-level/lean-backwards monitoring panel for some of our critical TX/Embedd/media transport-equipment, so I have dragged stuff from just about everywhere into it. I will try the context tip you have, but I am little bit unsure about where exactly the info needs to be put in? The panel itself is actually a NK-grid, not a self contained data source.

    You can see a screendump of it here: http://tinyurl.com/mwnjc5l

    /Martin

    #DashBoard


  • 6.  RE: email notification on parameter change

    Posted 12-16-2014 14:10

    First, I have to say that panel looks really cool.

    Second, the issue you're experiencing arises pretty much any time you're trying to access a data source outside of its scope.

    As long as the script lives within the context of the parameter you are using, you don't need to do anything special. Perhaps an example is in order.

    In the panel below, we are renaming a label to the value of a parameter. 3 different data sources in this panel: The panel's default data source, the "Scope 1" data source, and the "Scope 2" data source. The example shows how to pull the values of the parameters out of "Scope 1" and "Scope 2" and also shows how you can interact with the parameters when the script lives inside of the scope (the "Within Scope" buttons).

    `

    var scopeParam = params.getParam('Scoped_Parameter', 0);

    ogscript.rename('Text', scopeParam.getValue());


    var scopeParam = params.getParam('Scoped_Parameter', 0);

    ogscript.rename('Text', scopeParam.getValue());


    var scopeParam = params.getParam('Scope1Context', 'Scoped_Parameter', 0);

    ogscript.rename('Text', scopeParam.getValue());


    var scopeParam = params.getParam('Scope2Context', 'Scoped_Parameter', 0);

    ogscript.rename('Text', scopeParam.getValue());

    `

    #DashBoard