HTTP Sender - Publisher
-
@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...