<?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[Time RegEx]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have a http-retriever-data-source that gives me a 1 hour weather forecast:</p>
<p dir="auto"><img src="https://camo.nodebb.org/f6ce1f31020edbea6ce1ff19a972ef8cebc783b0?url=https%3A%2F%2Fi.imgur.com%2FepAH18h.png" alt="0_1563794544125_0ec90f90-dfcd-40b4-a894-cefa22eb2266-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The Value-RegEx  -&gt; hour value="01:00"&gt;&lt;temp value="(.*?)" works and give me the temp value 18 - all fine.<br />
If I set the logging time to "When point value changes", Mango stored the value with the actual timestamp, but I need a timestamp with the forecast date and hour, in my example above -&gt; day value="20190722" and -&gt; hour value="01:00" --&gt; 2019-07-22T01:00:00.000+2:00</p>
<p dir="auto">If I try in the TimeRegEx:</p>
<p dir="auto"><img src="https://camo.nodebb.org/7fb4989a62615d0bd883e4ec873341decc22ca84?url=https%3A%2F%2Fi.imgur.com%2FkfsI5K4.png" alt="0_1563795344854_baa46563-b60f-4172-9385-2f793bb1166f-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">only the date is correct but the time isn't 1:00.<br />
Is there a way to put date and time together?</p>
]]></description><link>https://forum.mango-os.com/topic/4327/time-regex</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 08:48:42 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/4327.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 Jul 2019 11:25:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Time RegEx on Thu, 25 Jul 2019 19:16:07 GMT]]></title><description><![CDATA[<p dir="auto">This is probably only a display issue. I would guess above that on the page it is showing the value for hour 23 as the current value, and that if you chart it for the day you will see the values in the chart. Thanks for bringing this to our attention!</p>
]]></description><link>https://forum.mango-os.com/post/22846</link><guid isPermaLink="true">https://forum.mango-os.com/post/22846</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Thu, 25 Jul 2019 19:16:07 GMT</pubDate></item><item><title><![CDATA[Reply to Time RegEx on Thu, 25 Jul 2019 07:01:47 GMT]]></title><description><![CDATA[<p dir="auto">I set 48h, no change. It only saves up to the current time: 9:00 here.</p>
<p dir="auto"><img src="https://camo.nodebb.org/9a5ef91af0c59508ae34a38c8307ac4ec979026f?url=https%3A%2F%2Fi.imgur.com%2FroZb9aj.png" alt="0_1564038865667_3721379c-cabf-415f-b94c-634b0e176ce2-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.mango-os.com/post/22840</link><guid isPermaLink="true">https://forum.mango-os.com/post/22840</guid><dc:creator><![CDATA[Ralf]]></dc:creator><pubDate>Thu, 25 Jul 2019 07:01:47 GMT</pubDate></item><item><title><![CDATA[Reply to Time RegEx on Wed, 24 Jul 2019 17:41:38 GMT]]></title><description><![CDATA[<p dir="auto">I would initially suspect the discard future dated values to be the culprit:<br />
<img src="https://camo.nodebb.org/7fba8c9f0358a5a4325aabcf63c78ac68be3d1e3?url=https%3A%2F%2Fi.imgur.com%2FgGRQhao.png" alt="0_1563990872858_discard-future-dated-values.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.mango-os.com/post/22835</link><guid isPermaLink="true">https://forum.mango-os.com/post/22835</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Wed, 24 Jul 2019 17:41:38 GMT</pubDate></item><item><title><![CDATA[Reply to Time RegEx on Wed, 24 Jul 2019 17:06:16 GMT]]></title><description><![CDATA[<p dir="auto">Hi phildunlap,</p>
<p dir="auto">thank you for the quick help and code!</p>
<p dir="auto">If I run at 19:00 the script it validate with the list:</p>
<p dir="auto"><img src="https://camo.nodebb.org/7098e159a8f3114c7295a0f26078ba7a81081c2a?url=https%3A%2F%2Fi.imgur.com%2FN37SMNM.png" alt="0_1563987882851_1666f48a-a22c-4355-91b9-b451dbb5fdac-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">All fine, but the records end at 19:00 from 00:00 - 19:00. Data source saves historic is ON, the point logging is OFF. Are there specific settings for the logging till 24:00?</p>
<p dir="auto"><img src="https://camo.nodebb.org/3959e71821644efff389269143aaf6ab25f60919?url=https%3A%2F%2Fi.imgur.com%2FfZE0aaF.png" alt="0_1563988093218_edc4ecf6-d1f6-4a91-b9c3-9ee3f9f8453b-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.mango-os.com/post/22833</link><guid isPermaLink="true">https://forum.mango-os.com/post/22833</guid><dc:creator><![CDATA[Ralf]]></dc:creator><pubDate>Wed, 24 Jul 2019 17:06:16 GMT</pubDate></item><item><title><![CDATA[Reply to Time RegEx on Tue, 23 Jul 2019 16:11:30 GMT]]></title><description><![CDATA[<p dir="auto">Certainly!</p>
<p dir="auto">There are a few examples, this one is probably the most in-depth:<br />
<a href="https://forum.infiniteautomation.com/topic/2999/intesis-integration" rel="nofollow ugc">https://forum.infiniteautomation.com/topic/2999/intesis-integration</a><br />
This is probably the most relevant:<br />
<a href="https://forum.infiniteautomation.com/topic/3251/httpbuilder-not-defined" rel="nofollow ugc">https://forum.infiniteautomation.com/topic/3251/httpbuilder-not-defined</a><br />
But there are others, and soon to be one more!<br />
<a href="https://www.google.com/search?q=site%3A%2F%2Fforum.infiniteautomation.com+httpbuilder" rel="nofollow ugc">https://www.google.com/search?q=site%3A%2F%2Fforum.infiniteautomation.com+httpbuilder</a></p>
<p dir="auto">For this, it might look like this...</p>
<pre><code>//Untested, source URL not provided
function handleResponse(content) {
    //Why does [0-1] have a ?; does it present Jan 1 as 201911 ?
    var dayInformation = /day value="([0-9]{4})([0-1]?[0-9])([0-3]?[0-9])"/.exec(content);
    if(dayInformation === null)
        throw "Could not find date information in content";
        
    for(var k = 0; k &lt; 24; k+=1) {
        var valueRegex = new RegExp('hour value="' + (k &lt; 10 ? "0"+k : k) + ':00"&gt;&lt;temp value="(.*?)"');
        var data = valueRegex.exec(content)
        if(data !== null) {
            //this timestamp should be in the server's timezone
            var timestamp = new Date(parseInt(dayInformation[1]), //year
                                     parseInt(dayInformation[2])-1, //month index
                                     parseInt(dayInformation[3]), k); //day and hours
            
            //This would be a scripting data point on the scripting data source:
            tempForecastPoint.set(parseFloat(data[1]), timestamp.getTime());
        }
    }
}

//Okay, let's pull in the data...
var headers = {} //Maybe you need an Accept header?
var parameters = {} //Perhaps an API token or date?
HttpBuilder.get("sptth://thisforecastwebsite.extension", headers, parameters).err(
    function(status, headers, content) {
        throw "Script failed with HTTP status: " + status;
}).resp(function(status, headers, content) {
    handleResponse(content);
}).execute();
</code></pre>
<p dir="auto">Edit: And the documentation would be in the main Mango JavaScript help: <a href="https://help.infiniteautomation.com/about-mango-java-script" rel="nofollow ugc">https://help.infiniteautomation.com/about-mango-java-script</a></p>
]]></description><link>https://forum.mango-os.com/post/22810</link><guid isPermaLink="true">https://forum.mango-os.com/post/22810</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 23 Jul 2019 16:11:30 GMT</pubDate></item><item><title><![CDATA[Reply to Time RegEx on Tue, 23 Jul 2019 15:14:26 GMT]]></title><description><![CDATA[<p dir="auto">Hi phildunlap,</p>
<p dir="auto">that's a good idea but I find no example in the forum/docu, Do you have one?</p>
]]></description><link>https://forum.mango-os.com/post/22809</link><guid isPermaLink="true">https://forum.mango-os.com/post/22809</guid><dc:creator><![CDATA[Ralf]]></dc:creator><pubDate>Tue, 23 Jul 2019 15:14:26 GMT</pubDate></item><item><title><![CDATA[Reply to Time RegEx on Mon, 22 Jul 2019 13:10:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi Ralf,</p>
<p dir="auto">This would not be easy to achieve in an HTTP Retriever. Have you considered using the HttpBuilder script utility? You would be able to put the whole data series into the same point, in that case, as you would have the text of the response available to run as much parsing on as you need.</p>
]]></description><link>https://forum.mango-os.com/post/22781</link><guid isPermaLink="true">https://forum.mango-os.com/post/22781</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Mon, 22 Jul 2019 13:10:27 GMT</pubDate></item></channel></rss>