HTTP Sender - Publisher
-
Thanks Fox,
I created a new Alphanumeric Meta point.
I'm actually using this to send an over temp alarm for a growth room.if(input1.value >= 28){ return "Redlands Growth room 28 - Temperature HIGH"; } else return "Redlands Growth room 28 - Temperature NORMAL";
The "input1" is the room temperature.
I set an execution delay also to stop sending multiple texts when hovering around
the alarm set point.Thanks again
-
Hi Fox,
There appears to be an issue with the execution delay on the Meta Data point.
When I set no delay, the point changes value instantly.
When I set a delay of 5 seconds, the point takes 5 seconds to change.
However anything 6 seconds and above, causes the point NOT TO UPDATE.This could be a bug?
{ "purgePeriod":1, "setExtremeLowLimit":-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368, "intervalLoggingType":"INSTANT", "dataSourceXid":"DS_1467c3b6-808b-4f6f-8fe4-0cfe54292b77", "discardHighLimit":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368, "deviceName":"Meta", "enabled":true, "rollup":"NONE", "purgeOverride":false, "chartRenderer":{ "limit":10, "type":"TABLE" }, "xid":"DP_8d626457-cc93-4d96-a580-53ecc1463373", "eventDetectors":[ ], "textRenderer":{ "useUnitAsSuffix":false, "type":"PLAIN", "suffix":"" }, "loggingType":"ON_CHANGE", "overrideIntervalLoggingSamples":false, "defaultCacheSize":1, "readPermission":"", "setPermission":"", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingSampleWindowSize":0, "tolerance":0, "purgeType":"YEARS", "plotType":"STEP", "intervalLoggingPeriod":1, "discardExtremeValues":false, "tags":{ }, "unit":"", "pointLocator":{ "contextUpdateEvent":"CONTEXT_UPDATE", "variableName":"my", "executionDelaySeconds":6, "dataType":"ALPHANUMERIC", "scriptPermissions":[ ], "updateCronPattern":"", "script":"if(input1.value >= 28){\n return \"Redlands Growth room 28 - Temperature HIGH\";\n}\nelse return \"Redlands Growth room 28 - Temperature NORMAL\";", "logCount":5, "settable":false, "logLevel":"NONE", "updateEvent":"NONE", "context":[ { "varName":"input1", "dataPointXid":"DP_32e6bd9b-a5a9-4b98-9b30-6e44dc96a6af", "updateContext":true } ], "logSize":1 }, "discardLowLimit":-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368, "setExtremeHighLimit":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368, "name":"Redlands Growth room 28 - Temperature", "chartColour":"", "preventSetExtremeValues":false, "simplifyType":"NONE" },
-
@hayden_aus said in HTTP Sender - Publisher:
"loggingType":"ON_CHANGE",
Try changing that to ALL. If you're getting the same pointValue coming through multiple times and it changes then stays the same after 6 seconds, there's a chance it may not fire due to the fact the last value is the same as the current value. You can always put an if statement in your meta point code to verify it's a valid alert.
EDIT: one more thing, what's the delay on your event alarm? How long does it need to stay a certain value before it fires?
EDIT 2: I learned when utilising the API that I need to ensure I have enough cached values in order to ensure all metapoint scripts would fire. I'd suggest making your default cache for your input point used in your meta script to have at least 10-20 for a value. This will ensure all value updates are cached and so nothing is lost..
Fox -
Tried ALL data, no go...
The new value is definitely updating on the triggering point. I have the points in a watch list together.There is no delay on the point updating the context(triggering), It is a Virtual point that I am just setting to 30 and waiting for the Meta point to go into alarm.
Tried adjusting the cache, no go...
Any more ideas?
-
I think you may have indeed found a bug.
Have you considered moving the metapoint.script into the alarm with the target point being what is in the publisher?Then you will get a guaranteed one shot execution, especially if there's a thirty second delay.
Fox
-
Hi Fox, I am not sure what you mean.
The only other way I worked out would be:
- Create a HIGH limit event on the room temperature point, with a duration
- Create event handler with the execution delay
- Have a virtual point be updated to a 1 or 0 value by the event handler
- Have the alphanumeric Meta point follow the virtual point
Maybe IA could look into this?
-
Hi Hayden
I don't believe using the publisher and a meta point is the right choice for your use case.
It would be best to use the event detector to trigger an event instead of trying to hack a meta point into doing it.
There are a number of forum examples of sending messages via a set point script.
https://forum.infiniteautomation.com/topic/3169/send-alarm-notification-to-mobile-phone
https://forum.infiniteautomation.com/topic/3137/how-http-publisher-to-firebase-cloud-messengerBut basically you will utilise the high limit event detector to trigger the event with it. The reset limit will cover you from spamming SMS's
you will link the event detector to either an email event handler or a setpoint handler. Use the following script. To use the same message as the event detectors name. If you use the email handler you can remove the return UNCHANGED.
var message = evt.messageString.toString(); HttpBuilder.get("http://192.168.1.1/cgi-bin/sms_send?username=user1&password=user_pass&number=0037060000001&text="+message,{},{}).err(function(status, headers, content) { throw "Request got bad response: " + status; }).resp(function(status, headers, content) { /* Do any work you need for successful responses */ }).execute(); return UNCHANGED
Let me know if you come right. I have an teltonika RUT955 modem here at my disposal and could do some testing if necessary. This handler will work for all your event detectors so bulk configuration should be simple.
-
I'm all for simple.
The fact here is that the publisher works, and sends messages, so the problem is the execution delay on the Meta point does not work above 5 seconds.
I did come up with a solution:
-
Room temperature point - NUMERIC
-
HIGH temp event detector, with 5 minute Duration (hold off delay)
-
Event handler that sets a Virtual Alphanumeric point - "Room temperature Alarm" - Active "Room temp HIGH", Inactive "Room temp NORMAL"
-
Publisher is HTTP Sender, which publishes the Alphanumeric points value (Text value)
I think I'll run with this.
Thanks for the help.
-
-
No problem, you the one who has to maintain it so its best you do what you are comfortable with tho I am surprised you think having 2 points, 1 event detector,1 event handler and a publisher is simpler than just adding an event detector to the alarm point and linking it to an event handler.
-
Hi Craig,
I am not familiar with httpBuilder.
How does the "message" get updated in the script?From what I can see, httpBuilder method uses at least the point, an event detector, and a global script.
The easier way would have been the original way I tried to get it to work with the Meta
point getting published when the script changes. (which worked, apart from the delay I needed of 5 minutes)
That way for the limit value, I could have used another Virtual numeric point, so the limit can be
easily adjusted on the fly, from a dashboard. -
@hayden_aus said in HTTP Sender - Publisher:
From what I can see, httpBuilder method uses at
Using a delay does not equate to a duration.
if the context point is on a 5-second update(from its DS) and the script runs every update delayed by 5mins you are still comparing the instantaneous value of the point, just 5mins later and checking if it is above the setpoint. This does not mean that it was in that state for 5mins. If the point went over the setpoint on the previous poll(5 seconds earlier) it would still trigger your script.So an event detector must be used to trigger your alarm.
Room temperature point - NUMERIC HIGH temp event detector, with 5 minute Duration (hold off delay) Event handler that sets a Virtual Alphanumeric point - "Room temperature Alarm" - Active "Room temp HIGH", Inactive "Room temp NORMAL" Publisher is HTTP Sender, which publishes the Alphanumeric points value (Text value)
Nothing wrong with the above setup as the most important thing is that you are comfortable with it.
The difference between the above and what I recommended is that there is not a meta point and virtual point in between the HTTP request, The Event name used as the message.
-
So an event detector must be used to trigger your alarm.
That's exactly what I was in the middle of discussing with Hayden...