Request for info: Email templates for data points notifications
-
Hi Richard
Welcome to mango automation. A send email now button would be quiet convenient, I do agree. I think the best workaround to test your template would be to create a binary virtual point that is settable and add a change event to it, then for testing purposes add your event handler to this point. You can then just toggle the point to send your email.
Freemarker can be quite a lot to take in. But if you are familiar with HTML it shouldn't be too hard to figure things out. What are you struggling with? The layout or inserting the data where you want it?
-
@craigweb said in Request for info: Email templates for data points notifications:
Welcome to mango automation. A send email now button would be quiet convenient, I do agree. I think the best workaround to test your template would be to create a binary virtual point that is settable and add a change event to it, then for testing purposes add your event handler to this point. You can then just toggle the point to send your email.
Thanks for the welcome - as I mentioned I'm quite new to Mango, so are there any documents or videos you can point me to which would help me to set a binary point?
Freemarker can be quite a lot to take in. But if you are familiar with HTML it shouldn't be too hard to figure things out. What are you struggling with? The layout or inserting the data where you want it?
At the moment I'm just using the template as laid out on the page in the first post, which reads like:
<@subject>Hey - Stuff is happening with the automation system and I think you should know</@subject> <#if renderedHtmlPointValues??> <#list renderedHtmlPointValues as renderedPvt> ${additionalContext.temperature.deviceName} - ${additionalContext.temperature.name} - ${renderedPvt.value} - ${renderedPvt.time}<br/> </#list> </#if>
But without being able to send the email, I can't see the output and that's where I'm kinda stuck ...
Cheers
Richard
-
If a point is settable then you can go to the data point details page and search for that point. You will be able to set it there.
-
Thanks, I was able to set up a data point, and managed to get it working (in the old interface):
I was able to gather this information from the data point into an email:
Can I get the information from a second data point into my table ... ? (for example using the
${p1234.value}
syntax? I couldn't quite figure it out .... )Or data from the tags ...
Thanks
Richard
-
Hi Richard,
Does this thread answer your question? https://forum.infiniteautomation.com/topic/3989/send-multiple-point-value-in-alarm-text
-
@phildunlap said in Request for info: Email templates for data points notifications:
Does this thread answer your question? https://forum.infiniteautomation.com/topic/3989/send-multiple-point-value-in-alarm-text
Wow - thanks for that ... there's a lot to take in, so I'm going to go through it thoroughly. I was able to get some data about a secondary data point, but they appeared to be 'static' values rather than 'data' values, and I suspect that thread will explain the 'why' of that.
Is it possible to also access the 'tags' of the data point - as per the picture below:
Thanks for all your help so far!!
Richard
-
@richard-mortimer said in Request for info: Email templates for data points notifications:
Can I get the information from a second data point into my table ... ? (for example using the
${p1234.value}
syntax? I couldn't quite figure it out .... )For anyone following the syntax is
${additionalContext.p1234.deviceName}
for static values ...Cheers
-
Can I get the information from a second data point into my table ... ? (for example using the ${p1234.value} syntax? I couldn't quite figure it out .... )
Not quite. The EmailHandlerRT (see https://github.com/infiniteautomation/ma-core-public/blob/main/Core/src/com/serotonin/m2m2/rt/event/handlers/EmailHandlerRT.java#L333 ) puts the points into the FTL model as an EmailPointWrapper (defined at the bottom EmailHandlerRT, extending DataPointWrapper: https://github.com/infiniteautomation/ma-core-public/blob/main/Core/src/com/serotonin/m2m2/rt/script/DataPointWrapper.java ) which has a list of values, but not the current value (beyond being in the list of latest values if logged, the runtime portion of the data point wrapper is null).
The thread I linked to has iterations over a
<#list>
of values, foradditionalContext.p1234.rawValues
andadditionalContext.p1234.values
-
@richard-mortimer said in Request for info: Email templates for data points notifications:
Is it possible to also access the 'tags' of the data point - as per the picture below:
In the interest of future people reading this post, it is done via
${point.tags.Test_Tag}
and${point.tags.ABC}
for my example above. You need to address the correct tag name.Cheers
Richard
-
Thanks for having an eye to posterity!