• Recent
    • Tags
    • Popular
    • Register
    • Login

    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

    Event Detector - get point by XID

    Dashboard Designer & Custom AngularJS Pages
    3
    9
    2.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rshah
      last edited by

      Hi,

      Is it possible to get the value of event detectors (I assume they return a binary 0 or 1) by XID?

      I tried ma-get-point for the XID of the event detector and it looks like it just returns an empty object.

      Thanks!

      1 Reply Last reply Reply Quote 1
      • Jared WiltshireJ
        Jared Wiltshire
        last edited by

        @rshah said in Event Detector - get point by XID:

        Is it possible to get the value of event detectors (I assume they return a binary 0 or 1) by XID?

        Event detectors do not have a value. I assume you are trying to ascertain if an event is active or not?

        @rshah said in Event Detector - get point by XID:

        I tried ma-get-point for the XID of the event detector and it looks like it just returns an empty object.

        An XID of an event detector is completely separate to that of a data point. They are not interchangeable.

        Developer at Radix IoT

        1 Reply Last reply Reply Quote 0
        • R
          rshah
          last edited by

          @jared-wiltshire said in Event Detector - get point by XID:

          An XID of an event detector is completely separate to that of a data point. They are not interchangeable.

          Hi,

          yes we are trying to see if a certain event is active or not and based on that change the style of a div on our dashboard.

          Jared WiltshireJ 1 Reply Last reply Reply Quote 0
          • phildunlapP
            phildunlap
            last edited by

            Hi rshah,

            You may find this thread interesting: https://forum.infiniteautomation.com/topic/3368/how-to-include-an-event-detector-value-into-a-function

            So you could do something similar, and store the resulting aggregate value into a point for use on the dashboard.

            If it's only one point though, you can have a set point handler set a binary true / false on the active / inactive actions.

            1 Reply Last reply Reply Quote 0
            • Jared WiltshireJ
              Jared Wiltshire @rshah
              last edited by

              @rshah said in Event Detector - get point by XID:

              @jared-wiltshire said in Event Detector - get point by XID:

              An XID of an event detector is completely separate to that of a data point. They are not interchangeable.

              Hi,

              yes we are trying to see if a certain event is active or not and based on that change the style of a div on our dashboard.

              There is no support for this built into the components just yet. Please see @phildunlap 's answer.

              You could write your own component and put it in the user module. To get events for a data point you would use the maEvents service using code like this

              maEvents.buildQuery()
                      .eq('dataPointId', 123)
                      .eq('active', true)
                      .query().then(result => {
                          // do something with events
                      });
              

              Developer at Radix IoT

              1 Reply Last reply Reply Quote 0
              • R
                rshah
                last edited by rshah

                Thank you, @Jared-Wiltshire .

                Is it in the development plan to introduce something which would allow us to get the value of an event detector similar to how we get the value of a point?

                I see that event-detectors already have their own XID, so a way to get a binary 1 / 0 from that XID with something like <ma-point-values point-xid="eventDetectorXID"></ma-point-values> would be great.

                Although I'm not sure how technically difficult it would be, or if it is even a good solution.

                It looks like the component you wrote above actually does just that, except I'm not sure how it deals with multiple events for one point-- haven't tried it yet.

                Do we have to use promises? Or can we use async/await?

                Jared WiltshireJ 1 Reply Last reply Reply Quote 1
                • Jared WiltshireJ
                  Jared Wiltshire @rshah
                  last edited by

                  @rshah said in Event Detector - get point by XID:

                  Is it in the development plan to introduce something which would allow us to get the value of an event detector similar to how we get the value of a point?

                  Its something I can look at making easier for sure. One thing to clarify is that an event detector does not have a value, it generates events which are active initially and can then become inactive. This is a completely different mechanism to point values.

                  It sounds like you should setup a meta data source and follow @phildunlap 's advise above for the meantime.

                  @rshah said in Event Detector - get point by XID:

                  It looks like the component you wrote above actually does just that, except I'm not sure how it deals with multiple events for one point-- haven't tried it yet.
                  Do we have to use promises? Or can we use async/await?

                  Its not a component, its a snippet of javascript, and it doesn't deal with anything. Its just returning an array of events for you to use as you please.

                  Any code you put in the user module will run in the browser so check browser compatibility tables to see if you can use async/await.

                  Developer at Radix IoT

                  1 Reply Last reply Reply Quote 0
                  • R
                    rshah
                    last edited by

                    @jared-wiltshire said in Event Detector - get point by XID:

                    Any code you put in the user module will run in the browser so check browser compatibility tables to see if you can use async/await.

                    Thank you!

                    Jared WiltshireJ 1 Reply Last reply Reply Quote 0
                    • Jared WiltshireJ
                      Jared Wiltshire @rshah
                      last edited by

                      @rshah said in Event Detector - get point by XID:

                      @jared-wiltshire said in Event Detector - get point by XID:

                      Any code you put in the user module will run in the browser so check browser compatibility tables to see if you can use async/await.

                      Thank you!

                      Oh, actually I just remembered - The promises used in Angular are not native ES6 promises so they probably wont work with async/await. See https://docs.angularjs.org/api/ng/service/$q

                      You could probably adapt them though.

                      Developer at Radix IoT

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post