• 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

    HTTP Receiver Point

    Scheduled Pinned Locked Moved User help
    13 Posts 2 Posters 2.4k Views 2 Watching
    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.
    • S Offline
      support
      last edited by support

      Hi Dear,
      how can I write a script data source using this url http://192.168.0.17:8080/httpds?R=1 in script , that make a HTTP Receiver Point ( name = R) change after 5 min from ( 0 ) to ( 1 ) , I mean " when I receive R = 0 from this url : http://192.168.0.17:8080/httpds?R=0 I need to change the value to 1 after 5min after the point was received " ?!!

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

        Hi support, welcome to the forum!

        I'm not sure I completely understand. So, some other machine will GET that URL and set the Http Receiver point "R" to 1, which you would then like to have a value of 0 again after 5 minutes. What happens if a second value is received during the 5 minute period? Do you need to set the value out to someplace?

        You could do this with a virtual point of the same data type as the Http receiver point. Then you would create a point link from the Http Receiver point to the virtual point with no script body. And finally a meta point with a 300 second execution delay with the Http receiver point updating its context, and the virtual point in context so that we can set it. Like,

        {
           "dataSources":[
              {
                 "xid":"DS_dac1636f-0289-4006-a333-100a6d053996",
                 "name":"support-forum",
                 "enabled":true,
                 "type":"HTTP_RECEIVER",
                 "alarmLevels":{
                    "SET_POINT_FAILURE":"URGENT"
                 },
                 "purgeType":"YEARS",
                 "setType":"PUBLISHER",
                 "dateFormat":"DATE_FORMAT_BASIC",
                 "deviceIdWhiteList":[
                    "*"
                 ],
                 "ipWhiteList":[
                    "*.*.*.*"
                 ],
                 "setPointUrl":"",
                 "editPermission":"",
                 "purgeOverride":false,
                 "purgePeriod":1
              },
              {
                 "xid":"DS_2eb63f8e-0887-4c71-ab7d-3b2dacfe8ff0",
                 "name":"support-forum-meta",
                 "enabled":true,
                 "type":"META",
                 "alarmLevels":{
                    "SCRIPT_ERROR":"URGENT",
                    "CONTEXT_POINT_DISABLED":"URGENT",
                    "RESULT_TYPE_ERROR":"URGENT"
                 },
                 "purgeType":"YEARS",
                 "editPermission":"",
                 "purgeOverride":false,
                 "purgePeriod":1
              },
              {
                 "xid":"DS_52ffeefb-4a16-40dd-ac51-bd887fbad099",
                 "name":"support-forum-virtual",
                 "enabled":true,
                 "type":"VIRTUAL",
                 "alarmLevels":{
                    "POLL_ABORTED":"URGENT"
                 },
                 "purgeType":"YEARS",
                 "updatePeriodType":"MINUTES",
                 "polling":false,
                 "updatePeriods":5,
                 "editPermission":"",
                 "purgeOverride":false,
                 "purgePeriod":1
              }
           ],
           "dataPoints":[
              {
                 "xid":"DP_db22d06f-af05-4e44-af0e-50dec6a5c981",
                 "name":"5 minute retoggle",
                 "enabled":true,
                 "loggingType":"ALL",
                 "intervalLoggingPeriodType":"MINUTES",
                 "intervalLoggingType":"AVERAGE",
                 "purgeType":"YEARS",
                 "pointLocator":{
                    "dataType":"NUMERIC",
                    "changeType":{
                       "type":"NO_CHANGE",
                       "startValue":"0"
                    },
                    "settable":true
                 },
                 "eventDetectors":[
                 ],
                 "plotType":"SPLINE",
                 "rollup":"NONE",
                 "unit":"",
                 "simplifyType":"NONE",
                 "chartColour":"",
                 "chartRenderer":{
                    "type":"IMAGE",
                    "timePeriodType":"DAYS",
                    "numberOfPeriods":1
                 },
                 "dataSourceXid":"DS_52ffeefb-4a16-40dd-ac51-bd887fbad099",
                 "defaultCacheSize":1,
                 "deviceName":"support-forum-virtual",
                 "discardExtremeValues":false,
                 "discardHighLimit":1.7976931348623157E308,
                 "discardLowLimit":-1.7976931348623157E308,
                 "intervalLoggingPeriod":1,
                 "intervalLoggingSampleWindowSize":0,
                 "overrideIntervalLoggingSamples":false,
                 "preventSetExtremeValues":false,
                 "purgeOverride":false,
                 "purgePeriod":1,
                 "readPermission":"",
                 "setExtremeHighLimit":1.7976931348623157E308,
                 "setExtremeLowLimit":-1.7976931348623157E308,
                 "setPermission":"",
                 "tags":{
                 },
                 "textRenderer":{
                    "type":"ANALOG",
                    "useUnitAsSuffix":true,
                    "unit":"",
                    "renderedUnit":"",
                    "format":"0.00"
                 },
                 "tolerance":0.0
              },
              {
                 "xid":"DP_96e5f699-ab7e-46f9-a807-c93b175b5b41",
                 "name":"5 minute retoggler",
                 "enabled":true,
                 "loggingType":"ON_CHANGE",
                 "intervalLoggingPeriodType":"MINUTES",
                 "intervalLoggingType":"INSTANT",
                 "purgeType":"YEARS",
                 "pointLocator":{
                    "dataType":"BINARY",
                    "updateEvent":"NONE",
                    "contextUpdateEvent":"CONTEXT_UPDATE",
                    "context":[
                       {
                          "varName":"trigger",
                          "dataPointXid":"DP_f73f2c31-f859-4752-a3ca-a0b3e8b943e8",
                          "updateContext":true
                       },
                       {
                          "varName":"target",
                          "dataPointXid":"DP_db22d06f-af05-4e44-af0e-50dec6a5c981",
                          "updateContext":false
                       }
                    ],
                    "logLevel":"NONE",
                    "variableName":"my",
                    "executionDelaySeconds":300,
                    "logCount":5,
                    "logSize":1.0,
                    "script":"if(trigger.value === 1)\r\n  target.set(0);\r\nelse if(trigger.value === 0)\r\n  target.set(1);\r\nreturn UNCHANGED;",
                    "scriptPermissions":{
                       "customPermissions":"",
                       "dataPointReadPermissions":"superadmin, edit-ui-menus, edit-ui-pages, edit-ui-settings",
                       "dataPointSetPermissions":"superadmin, edit-ui-menus, edit-ui-pages, edit-ui-settings",
                       "dataSourcePermissions":"superadmin, edit-ui-menus, edit-ui-pages, edit-ui-settings"
                    },
                    "settable":false,
                    "updateCronPattern":""
                 },
                 "eventDetectors":[
                 ],
                 "plotType":"STEP",
                 "rollup":"NONE",
                 "unit":"",
                 "templateXid":"Binary_Default",
                 "simplifyType":"NONE",
                 "chartColour":"",
                 "chartRenderer":{
                    "type":"TABLE",
                    "limit":10
                 },
                 "dataSourceXid":"DS_2eb63f8e-0887-4c71-ab7d-3b2dacfe8ff0",
                 "defaultCacheSize":1,
                 "deviceName":"support-forum-meta",
                 "discardExtremeValues":false,
                 "discardHighLimit":1.7976931348623157E308,
                 "discardLowLimit":-1.7976931348623157E308,
                 "intervalLoggingPeriod":15,
                 "intervalLoggingSampleWindowSize":0,
                 "overrideIntervalLoggingSamples":false,
                 "preventSetExtremeValues":false,
                 "purgeOverride":false,
                 "purgePeriod":1,
                 "readPermission":"",
                 "setExtremeHighLimit":1.7976931348623157E308,
                 "setExtremeLowLimit":-1.7976931348623157E308,
                 "setPermission":"",
                 "tags":{
                 },
                 "textRenderer":{
                    "type":"BINARY",
                    "oneColour":"black",
                    "oneLabel":"one",
                    "zeroColour":"blue",
                    "zeroLabel":"zero"
                 },
                 "tolerance":0.0
              },
              {
                 "xid":"DP_f73f2c31-f859-4752-a3ca-a0b3e8b943e8",
                 "name":"Point R",
                 "enabled":true,
                 "loggingType":"INTERVAL",
                 "intervalLoggingPeriodType":"MINUTES",
                 "intervalLoggingType":"AVERAGE",
                 "purgeType":"YEARS",
                 "pointLocator":{
                    "dataType":"NUMERIC",
                    "binary0Value":"",
                    "includeTimestamp":true,
                    "parameterName":"R",
                    "setPointName":"",
                    "settable":false
                 },
                 "eventDetectors":[
                 ],
                 "plotType":"SPLINE",
                 "rollup":"NONE",
                 "unit":"",
                 "templateXid":"Numeric_Default",
                 "simplifyType":"NONE",
                 "chartColour":"",
                 "chartRenderer":{
                    "type":"IMAGE",
                    "timePeriodType":"DAYS",
                    "numberOfPeriods":1
                 },
                 "dataSourceXid":"DS_dac1636f-0289-4006-a333-100a6d053996",
                 "defaultCacheSize":1,
                 "deviceName":"support-forum",
                 "discardExtremeValues":false,
                 "discardHighLimit":1.7976931348623157E308,
                 "discardLowLimit":-1.7976931348623157E308,
                 "intervalLoggingPeriod":1,
                 "intervalLoggingSampleWindowSize":0,
                 "overrideIntervalLoggingSamples":false,
                 "preventSetExtremeValues":false,
                 "purgeOverride":false,
                 "purgePeriod":1,
                 "readPermission":"",
                 "setExtremeHighLimit":1.7976931348623157E308,
                 "setExtremeLowLimit":-1.7976931348623157E308,
                 "setPermission":"",
                 "tags":{
                 },
                 "textRenderer":{
                    "type":"ANALOG",
                    "useUnitAsSuffix":true,
                    "unit":"",
                    "renderedUnit":"",
                    "format":"0.00"
                 },
                 "tolerance":0.0
              }
           ],
           "pointLinks":[
              {
                 "xid":"PL_c9dad7a7-b129-4bbb-bc8b-77bbd7dbf0bb",
                 "sourcePointId":"DP_f73f2c31-f859-4752-a3ca-a0b3e8b943e8",
                 "targetPointId":"DP_db22d06f-af05-4e44-af0e-50dec6a5c981",
                 "event":"UPDATE",
                 "logLevel":"NONE",
                 "disabled":false,
                 "logCount":5,
                 "logSize":1.0,
                 "script":"",
                 "scriptPermissions":{
                    "customPermissions":"",
                    "dataPointReadPermissions":"superadmin, edit-ui-menus, edit-ui-pages, edit-ui-settings",
                    "dataPointSetPermissions":"superadmin, edit-ui-menus, edit-ui-pages, edit-ui-settings",
                    "dataSourcePermissions":"superadmin, edit-ui-menus, edit-ui-pages, edit-ui-settings"
                 },
                 "writeAnnotation":false
              }
           ]
        }
        

        If a second set came to a meta point with an execution delay before it had executed, the first timer is cancelled and it is rescheduled from the time of the second point event. So, if you got a 0, then at minute 2 R=1, at minute 7 the meta point would set the virtual point (the desired data set) back to 0.

        Seems like a strange thing to do, but that's how one would do it!

        1 Reply Last reply Reply Quote 0
        • S Offline
          support
          last edited by

          0_1539953592599_error.PNG

          Dear , R doesn't goes to 1 when I send R=0 using url and I have this alarm when I test that ??

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

            My mistake, I for whatever reason did this in the meta script,

            target.set(!trigger.value);
            return UNCHANGED;
            

            And that caused that event. It should have been,

            if(trigger.value === 1)
              target.set(0);
            else if(trigger.value === 0)
              target.set(1);
            return UNCHANGED;
            

            Edit: I fixed the JSON in the last post and confirmed that it does in fact set the virtual point back to the other value after the execution delay since the last received Http receiever value for R. So, the virtual point has the desired data set.

            1 Reply Last reply Reply Quote 0
            • S Offline
              support
              last edited by support

              dear, I have this script for my shutter door :

              if( door.value==false && R.value==0 )
              button.set(false);
              

              after I used access card the R send me value = 0 "which mean open the door " and run this script , after that I want the door close after 3 min or 5 min but my problem R value doesn't goes to 1 to close the door !!
              I followed your steps and I have this :
              0_1539967540087_1.PNG

              virtual goes 1 but R still 0 .... I need R goes 1 to run my script and my door close .

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

                I think some details are missing, then. You could connect the door control to the virtual point, but how're you supposed to close the door? Is the Http Receiver supposed to be setting values out to some URL that was not included in your original question?

                1 Reply Last reply Reply Quote 0
                • S Offline
                  support
                  last edited by phildunlap

                  I create a point R and I recived value from access card "access door database" , this data base send me R value using url http://192.168.0.17:8080/httpds?R=0
                  and it is send me the value = 0 by using access card and I take this value then run my script then my door is open . After 3 min I need my door closed but I also need R goes to 1 because database dosen't include timer to send R=1 ( R value : when I using card to open the door the database send me R=0 )

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

                    So, could you use the virtual point in the script context that opens the door instead of using the Http Receiver point?

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      support
                      last edited by

                      How ??
                      my database using R value and my script using R .

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

                        This script,

                        if( door.value==false && R.value==0 )
                        button.set(false);
                        

                        is in Mango right? So R is a context point for that script. Use the virtual point instead.

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          support
                          last edited by support

                          yes in mango .
                          you mean this

                          if( door.value==true && R.value==0  && virtual.value==1)
                          button.set(false);
                          
                          1 Reply Last reply Reply Quote 0
                          • phildunlapP Offline
                            phildunlap
                            last edited by phildunlap

                            No I mean

                            if( door.value==false && virtual.value==0 )
                            button.set(false);
                            

                            And then remove the R point from context, since we don't want the script to update when it gets a value (its value is immediately set to the virtual point by the point link)

                            I should say I didn't get informed about this portion of the question, so I'm presuming that script did what you wanted in the first place. Seems to me you want to handle the virtual.value == 1 && door.value == true condition too, maybe.

                            1 Reply Last reply Reply Quote 0
                            • S Offline
                              support
                              last edited by

                              On Sunday I will try these solutions and I will tell you what I will get .
                              Thank you very very much :)

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