Facility Control

 View Only
  • 1.  AlarmLED widget type-

    Posted 11-19-2019 21:05

    Hey Folks-  I searched, but was unable to find anything regarding the "alarmled" parameter widget type.  I've been toying around with it, but can't seem to get it to work like I think it should.

    I'd basically like to have a parameter that I can set to either 0 or 1 and have the light turn Red or Green accordingly.  I'm scripting it such that it'll tell me whether or not a particular listener is connected.

    I've tried both CHOICE_CONSTRAINT and ALARM_TABLE constraints, neither seem to work properly.

    Can anyone shed some light on how alarmled's work?  Thanks!

     

    Bo



  • 2.  RE: AlarmLED widget type-

    Posted 11-20-2019 22:58

    Hi Bo,

    Its important to recognize that the Alarm Table constraint is evaluating bits and not decimal values. This can lead to a bit of confusion.

    A common way to have a light turn red or green is to send the text parameter an embedded colour code. In the code snippet below, I have a ogScript function that evaluates if the passed value is 1 or 0 and will update the light colour. I have used an unconstrained type in this example.

    NOTE: You can choose whether or not to send text along with the colour code.

    Please let me know if you have any questions.

     

    <abs contexttype="opengear" gridsize="20" id="_top" keepalive="false">
    <meta>
    <params>
    <param access="1" maxlength="0" name="alarm" oid="alarm" type="STRING" value="Disconnection&lt;#ff0000&gt;" widget="default"/>
    </params>
    <api>function setAlarm(num){

    switch(num) {

    case 0:
    params.setValue("alarm", 0, "Disconnection&lt;#ff0000&gt;");
    break;
    case 1:
    params.setValue("alarm", 0, "&lt;#13E40C&gt;");
    break;

    }

    }</api>
    </meta>
    <param expand="true" height="100" left="60" oid="alarm" top="200" widget="12" width="120"/>
    <button buttontype="push" height="40" left="180" name="Send 0" top="200" width="180">
    <task tasktype="ogscript">setAlarm(0);</task>
    </button>
    <button buttontype="push" height="40" left="180" name="Send 1" top="260" width="180">
    <task tasktype="ogscript">setAlarm(1);</task>
    </button>
    </abs>

    #DashBoard


  • 3.  RE: AlarmLED widget type-

    Posted 11-21-2019 00:23

    That's exactly what I needed.  Thanks Dave!!


    #DashBoard