• 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

    Send Alarm Notification to Mobile Phone

    How-To
    4
    7
    2.4k
    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.
    • B
      Balistar
      last edited by Balistar

      The standard event handler action to send an Alarm to the outside world is an Email. We run many processes unattended overnight and needed something more "Urgent" to get staff attention. Perhaps there is a better way, but what works for us is that a Notification gets send to one or a group mobile phones. On the phone the Notification pops up with a sound (even on a locked phone) and action can be taken.

      You can run your own server or use something like OneSignal. All use API.

      Enter HTTP Builder. Very powerful.

      In Mango a global script has been created with all the authorization, etc variables and gets called in other scripts.

      Global Script:

      function OneSignalNotice(notice){
      
      var url = "https://onesignal.com/api/v1/notifications";
      
      var headers = {
          "Content-Type": "application/json",
          "Authorization": "Basic ZWY5NmUxZjctYjAyNC00MTg0LWxxxxxxxxx",
      };
      
      
      var parameters = {
        "app_id" : "9b42d346-dd6f-4462-85a5-xxxxxxx",
        "contents" : {"en": notice},
        "included_segments" : "All"
      };
      
      
      HttpBuilder.post(url, headers, parameters).err(function(status, headers, parameters) {
        throw "Script failed with HTTP status : " + status;
      }).resp(function(status, headers, parameters) {
        "Hallo" 
      }).execute();
      
      }
      

      I don't think Event Handler / Set Point / Set to scripted value is meant to be used this way, but it works:

      // Send OneSignal Alarm Notice
      OneSignalNotice("ALARM Harvest 1 Temperature is too HIGH at: " + JSON.stringify(p226.value));
      
      

      .

      0_1514177188394_Image mango 1.jpg

      I hope it will help someone.

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

        Nice! Thanks for sharing Balistar!

        I don't think Event Handler / Set Point / Set to scripted value is meant to be used this way, but it works:

        It may not have been the original vision, but with the addition of the HttpBuilder and JsonEmport objects, we also added 'UNCHANGED' as a return value for set point scripts realizing that giving more functions to scripts will result in set point handlers and meta points that don't produce values, they only interact. So, if you return UNCHANGED; you will not set a value to the target point.

        1 Reply Last reply Reply Quote 0
        • CraigWebC
          CraigWeb
          last edited by

          This is awesome, Thank you for sharing. Will definitely incorporate it. Wish i saw this before a recent project with SMS's Although I would like to try do the same with the slack API. Where can I read more on the HTTP builder?

          Thank you

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

            The links in this thread pertain to the HttpBuilder: https://forum.infiniteautomation.com/topic/3337/integration-with-other-scada-system

            1 Reply Last reply Reply Quote 0
            • JoelHaggarJ
              JoelHaggar
              last edited by

              This is great but I also think a Slack integration would be really slick.

              1 Reply Last reply Reply Quote 0
              • CraigWebC
                CraigWeb
                last edited by

                Slack integration turned out to be quite easy. especially if you just sending messages with attachments. using webhooks only takes a few minutes to get set up. There is so much more you can do with the other 100 API methods. But if you just sending simple status messages, useing the webhook url is the way to go.
                0_1520667177830_Screen Shot 2018-03-10 at 09.26.37.png
                1.open a workspace on slack
                2. turn webhooks on your channel.
                3. copy the URL and insert into global script
                4. get you channel ID and insert into parameters
                5. call the script the same way Balistar explained.

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

                  Thanks for sharing CraigWeb!

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