<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Create an Email Template for Event Handler]]></title><description><![CDATA[<p dir="auto">Hi all,</p>
<p dir="auto">I'm trying to create a nice email template for event handler, but I really don't know hot to use it.</p>
<p dir="auto">I need to add additional context to an binary data point trigger, showing last data of two additional data point.</p>
<p dir="auto">Looking the documentation, I found this:</p>
<p dir="auto"><img src="https://camo.nodebb.org/c6d223df1acd14b8df4e5903112e709b7d232267?url=https%3A%2F%2Fi.imgur.com%2FujMHIbz.png" alt="0_1539357938950_88e7672a-9d8b-43b7-b1d7-a510bb1b4f54-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">butwhen I try to replicate to my template isn't working.</p>
<p dir="auto">Could someone help me this this? Thanks!!</p>
]]></description><link>https://forum.mango-os.com/topic/3843/create-an-email-template-for-event-handler</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 02:08:24 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/3843.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 12 Oct 2018 15:30:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Create an Email Template for Event Handler on Tue, 16 Oct 2018 16:10:31 GMT]]></title><description><![CDATA[<p dir="auto">Thanks !! That did the trick...</p>
]]></description><link>https://forum.mango-os.com/post/20253</link><guid isPermaLink="true">https://forum.mango-os.com/post/20253</guid><dc:creator><![CDATA[Matias Saul]]></dc:creator><pubDate>Tue, 16 Oct 2018 16:10:31 GMT</pubDate></item><item><title><![CDATA[Reply to Create an Email Template for Event Handler on Fri, 12 Oct 2018 20:32:33 GMT]]></title><description><![CDATA[<p dir="auto">You may find this StackOverflow thread interesting: <a href="https://stackoverflow.com/questions/7846105/freemarker-model-convert-timestamp-in-milliseconds-to-date" rel="nofollow ugc">https://stackoverflow.com/questions/7846105/freemarker-model-convert-timestamp-in-milliseconds-to-date</a></p>
<p dir="auto">TLDR</p>
<p dir="auto"><code>${pvt.time?number_to_datetime?string("YYYY-MM-dd HH:mm:ss")}</code></p>
<p dir="auto">Didn't test again just now, but the number_to_date, number_to_time, number_to_datetime functions are what you're looking for.</p>
]]></description><link>https://forum.mango-os.com/post/20233</link><guid isPermaLink="true">https://forum.mango-os.com/post/20233</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Fri, 12 Oct 2018 20:32:33 GMT</pubDate></item><item><title><![CDATA[Reply to Create an Email Template for Event Handler on Fri, 12 Oct 2018 19:57:09 GMT]]></title><description><![CDATA[<p dir="auto">One more question.</p>
<p dir="auto">How can I work with the results?</p>
<p dir="auto">For example, when I use pvt.time, I get the timestamp only, and I need to show date and time format.</p>
]]></description><link>https://forum.mango-os.com/post/20232</link><guid isPermaLink="true">https://forum.mango-os.com/post/20232</guid><dc:creator><![CDATA[Matias Saul]]></dc:creator><pubDate>Fri, 12 Oct 2018 19:57:09 GMT</pubDate></item><item><title><![CDATA[Reply to Create an Email Template for Event Handler on Fri, 12 Oct 2018 19:32:38 GMT]]></title><description><![CDATA[<p dir="auto">Nice!! It worked pretty well. Thanks!</p>
]]></description><link>https://forum.mango-os.com/post/20231</link><guid isPermaLink="true">https://forum.mango-os.com/post/20231</guid><dc:creator><![CDATA[Matias Saul]]></dc:creator><pubDate>Fri, 12 Oct 2018 19:32:38 GMT</pubDate></item><item><title><![CDATA[Reply to Create an Email Template for Event Handler on Fri, 12 Oct 2018 19:02:02 GMT]]></title><description><![CDATA[<p dir="auto">You would loop over it, like,</p>
<pre><code>&lt;#list temperatureValues as pvt&gt;
&lt;#-- do stuff with pvt, pvt.value, pvt.time --&gt;
&lt;/#list&gt;
</code></pre>
<p dir="auto">It's a List&lt;PointValueTime&gt; similar to renderedHtmlPointValues. It wouldn't have the rendering done to it, though.</p>
]]></description><link>https://forum.mango-os.com/post/20230</link><guid isPermaLink="true">https://forum.mango-os.com/post/20230</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Fri, 12 Oct 2018 19:02:02 GMT</pubDate></item><item><title><![CDATA[Reply to Create an Email Template for Event Handler on Fri, 12 Oct 2018 18:22:31 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for your help Philip !</p>
<p dir="auto">Putting "additionalContext" to variables works! But I have some doubts about :</p>
<pre><code>model.put("temperatureValues", temperature.last(10));
</code></pre>
<p dir="auto">If I use this code in the script windows, I have to call the "temperatureValues" variable into the code, like:</p>
<pre><code>${temperatureValues.value}
</code></pre>
<p dir="auto">Works in that way? And I need to put this variable inside the <code>&lt;#list renderedHtmlPointValues as renderedPvt&gt;</code><br />
or isn't necessary?</p>
<p dir="auto">Thanks in advance!</p>
]]></description><link>https://forum.mango-os.com/post/20229</link><guid isPermaLink="true">https://forum.mango-os.com/post/20229</guid><dc:creator><![CDATA[Matias Saul]]></dc:creator><pubDate>Fri, 12 Oct 2018 18:22:31 GMT</pubDate></item><item><title><![CDATA[Reply to Create an Email Template for Event Handler on Fri, 12 Oct 2018 17:41:44 GMT]]></title><description><![CDATA[<p dir="auto">Hi Matias,</p>
<blockquote>
<p dir="auto">isn't working</p>
</blockquote>
<p dir="auto">Should always be accompanied by a description of the failure.</p>
<p dir="auto">Even though... that image has some issues, and I see you got it from the <a href="http://help.infiniteautomation.com" rel="nofollow ugc">help.infiniteautomation.com</a> page about custom email handlers. I will put something better there, since that image is riddled with problems.</p>
<p dir="auto">For now, try,</p>
<pre><code>&lt;@subject&gt;Hey - Stuff is happening with the automation system and I think you should know&lt;/@subject&gt;
&lt;#if renderedHtmlPointValues??&gt;
  &lt;#list renderedHtmlPointValues as renderedPvt&gt;
  ${additionalContext.temperature.deviceName} - ${additionalContext.temperature.name} - ${renderedPvt.value} - ${renderedPvt.time}&lt;br/&gt;
  &lt;/#list&gt;
&lt;/#if&gt;
</code></pre>
<p dir="auto">And be sure to add a point into the context with the key 'temperature'</p>
<p dir="auto">Also it should be noted the renderedHtmlPointValues and renderedPointValues items are only added to the model if it's a point event and the point that generated the event is running.</p>
<p dir="auto">You could add recent values into the model yourself in the script by doing something like,</p>
<pre><code>model.put("temperatureValues", temperature.last(10));
</code></pre>
<p dir="auto">And then using the &lt;#list&gt; to iterate over that, instead.</p>
]]></description><link>https://forum.mango-os.com/post/20228</link><guid isPermaLink="true">https://forum.mango-os.com/post/20228</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Fri, 12 Oct 2018 17:41:44 GMT</pubDate></item></channel></rss>