Hi John, I'm on the mountain, there was more. Can you please keep an eye on the two files?
jo...@johnkline.com schrieb am Freitag, 10. Juli 2020 um 16:05:18 UTC+2: > You need to add the fields: > barometerRate > FMT_windDir > to the fields line in the LoopData section of weewx.conf. > > After you do that and restart WeeWX, verify that you see these readings in > loop-data.txt. > > Finally, you need to set these values in the JavaScript. > > If you have already done all of the above, perhaps you have a JavaScript > error. Have a look in the JavaScript console in your browser (note: it may > be called something else, search for how to see JavaScript errors). > > BTW, this weekend, I should have a version of LoopData out that uses the > same naming scheme as cheetah. As such, you will then specify > $current.windSpeed, $current.windDir.ordinal_compass and $current.windDir > (for example) in the fields line in weewx.conf and those keys will show up > in loop-data.txt. There was no good reason to invent a new language for > this. > > On Jul 10, 2020, at 1:54 AM, geni08...@gmail.com <geni08...@gmail.com> > wrote: > > > > what do I have to change so that the two values (in the yellow circle) are > always displayed? Now they only flash briefly during a manual refresh. > > <loop2.jpg> > > in index.html.templ: > <td id="windSpeedAndBearing" > style="font-family:monospace;font-size:85px;text-align:center;">$current.windSpeed > > $current.windDir.ordinal_compass ($current.windDir)</td> > <span id="FMT_barometer">$current.barometer > ($trend.barometer.formatted)</span><span> - </span><span > id="FMT_outHumidity">$current.outHumidity</span> > > jo...@johnkline.com schrieb am Donnerstag, 9. Juli 2020 um 15:40:48 UTC+2: > >> >> >> On Jul 9, 2020, at 1:52 AM, geni08...@gmail.com <geni08...@gmail.com> >> wrote: >> >> Question for my understanding: >> >> >> If or why is the id = string supplemented with $current, $day or not at >> all? >> >> <loop1.jpg> >> >> >> In the examples, no IDs is supplemented with current, day or none at all. >> Some values say $current, which means the current observation. Some say >> day, which would be for the day and have an aggregator ($day.rain.sum). In >> any event, all of these values are overwritten every couple of seconds by >> the javascript. As such, they could be removed. >> >> As for the ids. They could be anything you wish. They just are used by >> the JavaScript to look up the element. As a naming scheme for ids, I chose >> to to name them for the corresponding key in loop-data.txt. >> >> For example, FMT_HI_windGust. The JavaScript will get lookup the element >> with the id FMT_HI_windGust. It will then lookup the value in >> loop-data.txt for the key FMT_HI_windGust and set the contents of the HTML >> tag (innerHTML property) to that value. >> >> If the id was foo on this element, the JavaScript would have to find the >> foo element in the DOM. Of course, it will still need to use the key >> FMT_HI_windGust for looking up the loop-data value. >> >> As for the naming scheme in loop-data.txt: >> FMT_HI_windGust >> The FMT_ means include the label. >> The HI_ means give me today’s high. >> >> FMT_windGust would be for the current observation and would include the >> label. >> >> windGust would be for the current observation. It would NOT include a >> label, but it would still be formatted. That is, if wind should have 1 >> decimal place, it be formatted as such (e.g., 4.0). >> >> The README has this info, but to summarize: >> >> If the key is missing an aggregator (HI, LO, AVG, WAVG, SUM, RMS, >> VEC_AVG, VEC_DIR), it is the current observation. If it has an aggregator >> prefix, it is for the day. Exceptions are the items I made up 10mMaxGust >> (which is 10 minutes) and barometerRate (which is a delta from 3 hours ago) >> and windRose. >> >> FMT_ includes the label. >> >> UNITS_ is the unit for the observation. >> >> LABEL_ is the label for the observation. >> >> COMPASS_ for windDIr and windGustDir gives compass (text) direction. >> >> DESC_ for barometer rate gives a text description of the rate (and >> probably needs to be internationalized). >> >> T_ is the time of the observation. For example, T_HI_<obs> would be the >> time today that the high was reached for the observation. >> >> Just to mention the other things you pointed to: >> FMT_SUM_rain is today’s rain with a label. The FMT_ gives the label. >> Since SUM_ is an aggregator, it is for today. >> >> FMT_rainRate is the current rate of rain (since it is missing an >> aggregator) and it includes a label (FMT_). FMT_HI_rainRate would be >> today’s high rainRate. FMT_T_HI_rainRate would be the formatted time when >> today’s high rain rate happened. >> >> Note that the packet time presented in WeatherBoard is not formatted. It >> uses rainRate. That time is then localized with toLocaleTimeString in >> JavaScript. In that way, the time presented is local time for the viewer >> of the web page. >> >> >> >> jo...@johnkline.com schrieb am Mittwoch, 8. Juli 2020 um 20:35:22 UTC+2: >> >>> >>> >>> On Jul 8, 2020, at 1:36 AM, geni08...@gmail.com <geni08...@gmail.com> >>> wrote: >>> >>> weewx-weatherboard 1.3a the label entries are implemented. >>> >>> >>> What is the easiest way now >>> Indoor temperature >>> barometer >>> Indoor and outdoor humidity >>> to show signs on the display? >>> >>> >>> >>> To get these readings in loop-data.txt, add the following to the end of >>> the fields line in the LoopData section of weewx.conf: >>> , FMT_inTemp, FMT_barometer, FMT_inHumidity, FMT_outHumidity >>> >>> As for adding them to a skin, it would be helpful to know your end goal >>> and your familiarity with the technologies. >>> >>> WeatherBoard is designed for display on a tablet sitting on a bookshelf >>> or hanging on a wall. It’s meant to be viewed from across the room. >>> That’s why there’s a small amount of data in large fonts and why I chose >>> the color scheme. >>> >>> Are you trying to have something that looks like WeatherBoard but just >>> these four extra items on it? Will you want more after you add these four? >>> Extra items will mean smaller fonts. How will this skin be viewed? I’m >>> assuming you are not looking for the across the room viewing that I >>> targeted with this skin. >>> >>> Are you looking to write an entirely new skin? >>> >>> Are you looking to add “update on every loop” capabilities to another >>> skin that you like? >>> >>> How comfortable are you working with html, css and JavaScript? >>> >>> Cheers, >>> John >>> >>> >>> jo...@johnkline.com schrieb am Dienstag, 7. Juli 2020 um 20:10:24 UTC+2: >>> >>>> Most of the WeatherBoard will now use the strings in Defaults, so you >>>> should see it in German after you install. For the custom strings, just >>>> update the strings in the WeatherBoard>Labels>Generic section of >>>> weewx.conf. >>>> >>>> On Jul 7, 2020, at 6:47 AM, John Kline <jo...@johnkline.com> wrote: >>>> >>>> >>>> >>>> I’ve created a branch of WeatherBoard that substitutes appTemp for >>>> dewpoint. >>>> >>>> It is here: >>>> https://github.com/chaunceygardiner/weewx-weatherboard/tree/appTemp >>>> >>>> On Jul 7, 2020, at 12:09 AM, John Kline <jo...@johnkline.com> wrote: >>>> >>>> >>>> There was a subtle difference in how I was creating the next day >>>> accumulator vs. how WeeWX proper is doing it. I’ve changed that. Please >>>> install 1.3.15 and let me know how it goes at midnight. >>>> >>>> On Jul 6, 2020, at 10:44 PM, geni08...@gmail.com <geni08...@gmail.com> >>>> wrote: >>>> >>>> Jul 7 00:00:01 Wetter-Raspi rsyslogd: [origin software="rsyslogd" >>>> swVersion="8.1901.0" x-pid="295" x-info="https://www.rsyslog.com"] >>>> rsyslogd was HUPed >>>> Jul 7 00:00:01 Wetter-Raspi systemd[1]: logrotate.service: Succeeded. >>>> Jul 7 00:00:01 Wetter-Raspi systemd[1]: Started Rotate log files. >>>> Jul 7 00:00:02 Wetter-Raspi systemd[1]: man-db.service: Succeeded. >>>> Jul 7 00:00:02 Wetter-Raspi systemd[1]: Started Daily man-db >>>> regeneration. >>>> Jul 7 00:00:15 Wetter-Raspi weewx[18476] INFO weewx.manager: Added >>>> record 2020-07-07 00:00:00 CEST (1594072800) to database 'weewx' >>>> Jul 7 00:00:15 Wetter-Raspi weewx[18476] INFO weewx.manager: Added >>>> record 2020-07-07 00:00:00 CEST (1594072800) to daily summary in 'weewx' >>>> >>>> >>>> geni08...@gmail.com schrieb am Dienstag, 7. Juli 2020 um 07:39:52 >>>> UTC+2: >>>> >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** Traceback (most recent call last): >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** File "/usr/share/weewx/user/loopdata.py", line 365, in >>>>> process_queue >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** self.day_accum.addRecord(pkt) >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** File "/usr/share/weewx/weewx/accum.py", line 423, in addRecord >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** % (record['dateTime'], self.timespan)) >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** weewx.accum.OutOfSpan: Attempt to add out-of-interval record >>>>> (1594072801) to timespan ([2020-07-06 00:00:00 CEST (1593986400) -> >>>>> 2020-07-07 00:00:00 CEST (1594072800)]) >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** During handling of the above exception, another exception occurred: >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** Traceback (most recent call last): >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** File "/usr/share/weewx/user/loopdata.py", line 370, in >>>>> process_queue >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** self.day_accum.addRecord(pkt) >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** File "/usr/share/weewx/weewx/accum.py", line 423, in addRecord >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** % (record['dateTime'], self.timespan)) >>>>> Jul 7 00:00:00 Wetter-Raspi weewx[18476] CRITICAL user.loopdata: >>>>> **** weewx.accum.OutOfSpan: Attempt to add out-of-interval record >>>>> (1594072801) to timespan ([2020-07-06 00:00:00 CEST (1593986400) -> >>>>> 2020-07-07 00:00:00 CEST (1594072800)]) >>>>> Jul 7 00:00:00 Wetter-Raspi systemd[1]: Starting Rotate log files... >>>>> Jul 7 00:00:00 Wetter-Raspi systemd[1]: Starting Daily man-db >>>>> regeneration... >>>>> >>>>> >>>>> jo...@johnkline.com schrieb am Dienstag, 7. Juli 2020 um 07:09:28 >>>>> UTC+2: >>>>> >>>>>> It looks like loopdata stopped again at midnight (I looked at your >>>>>> sight). >>>>>> >>>>>> I think it likely that something in the packet at midnight is causing >>>>>> this. Loopdata does print a stack trace on an unexpected exception >>>>>> before >>>>>> exiting. Would you have a look in the log and send it? >>>>>> >>>>>> If the stack trace doesn’t give me the info I need, I will send you >>>>>> an instrumented version of loopdata.py that will, among other things, >>>>>> log >>>>>> loop packets around midnight. >>>>>> >>>>>> On Jul 6, 2020, at 10:26 AM, John Kline <jo...@johnkline.com> wrote: >>>>>> >>>>>> >>>>>> >>>>>> BTW, I should probably make dewpoint position on the weatherboard >>>>>> configurable between dewpoint and appTemp. That would save you from >>>>>> having >>>>>> to hack on the javaascript. >>>>>> >>>>>> Also, I could make the legend configurable for translation. >>>>>> >>>>>> I’ll try to do that today or tomorrow. >>>>>> >>>>>> On Jul 6, 2020, at 10:19 AM, John Kline <jo...@johnkline.com> wrote: >>>>>> >>>>>> >>>>>> Yep, you’ll need to make your changes to switch to appTemp. That’s >>>>>> both a change in index.html.tmpl and in the realtime_updater.inc file. >>>>>> >>>>>> A new day accumulator gets created at midnight, so I am very >>>>>> interested in that loopdata crash. Do you have a stacktrace in the log? >>>>>> Please send what you have. If it’s not descriptive enough, I’ll update >>>>>> loopdata to provide more info on that crash. >>>>>> >>>>>> On Jul 6, 2020, at 8:20 AM, geni08...@gmail.com <geni08...@gmail.com> >>>>>> wrote: >>>>>> >>>>>> >>>>>> I have replaced the index.html.tmpl with an old version! However, >>>>>> the appTemp is not yet running. Loopdate also crashed at midnight, >>>>>> so watch that today. >>>>>> >>>>>> jo...@johnkline.com schrieb am Montag, 6. Juli 2020 um 15:50:11 >>>>>> UTC+2: >>>>>> >>>>>>> Now that I’m up for the morning, I went to look at your WeatherBoard >>>>>>> page to see what the JavaScript error was, but I see that it is up and >>>>>>> runnning! >>>>>>> >>>>>>> On Jul 6, 2020, at 3:44 AM, John Kline <jo...@johnkline.com> wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> Send realtime_updater.inc and weewx.conf. >>>>>>> The JavaScript is broken. I’ll have a look. >>>>>>> >>>>>>> On Jul 5, 2020, at 10:35 PM, geni08...@gmail.com < >>>>>>> geni08...@gmail.com> wrote: >>>>>>> >>>>>>> I have weewx-loopdata 1.1.13, only the default km_per_hour >>>>>>> definition -> the loop-data.txt is OK. >>>>>>> Why is my WeatherBoard not working? Only time is running. >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "weewx-user" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to weewx-user+...@googlegroups.com. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/weewx-user/b24a6c1c-9b40-4c1b-abde-cf1c40d127e2n%40googlegroups.com >>>>>>> >>>>>>> <https://groups.google.com/d/msgid/weewx-user/b24a6c1c-9b40-4c1b-abde-cf1c40d127e2n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> <index.html.tmpl.txt> >>>>>>> >>>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "weewx-user" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to weewx-user+...@googlegroups.com. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/weewx-user/441af783-906b-4497-a023-733da7ec6cc3n%40googlegroups.com >>>>>> >>>>>> <https://groups.google.com/d/msgid/weewx-user/441af783-906b-4497-a023-733da7ec6cc3n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "weewx-user" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to weewx-user+...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/weewx-user/9583022e-a87f-4991-8b71-9704b18c9ecen%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/weewx-user/9583022e-a87f-4991-8b71-9704b18c9ecen%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "weewx-user" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to weewx-user+...@googlegroups.com. >>> >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/weewx-user/002514e4-098f-42f4-8d52-8fccfa293472n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/weewx-user/002514e4-098f-42f4-8d52-8fccfa293472n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "weewx-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to weewx-user+...@googlegroups.com. >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-user/ab5bd30d-64b5-473b-8125-e1cbe3ebc811n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/weewx-user/ab5bd30d-64b5-473b-8125-e1cbe3ebc811n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> <loop1.jpg> >> >> -- > You received this message because you are subscribed to the Google Groups > "weewx-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to weewx-user+...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/b7deee51-6748-4373-bdb1-79433c7dedban%40googlegroups.com > > <https://groups.google.com/d/msgid/weewx-user/b7deee51-6748-4373-bdb1-79433c7dedban%40googlegroups.com?utm_medium=email&utm_source=footer> > . > <loop2.jpg> > > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/20fdce76-5c9c-49ae-9688-5fd810ea3d25n%40googlegroups.com.
## Copyright (C)2020 by John A Kline (j...@johnkline.com) ## Distributed under the terms of the GNU Public License (GPLv3) ## See LICENSE for your rights. #errorCatcher Echo #encoding UTF-8 <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="icon" type="image/png" href="favicon.ico" /> <link rel="stylesheet" type="text/css" href="weatherboard.css"/> #if $Extras.has_key('meta_title') <title>$Extras.meta_title</title> #else <title>WeatherBoard™—$station.location</title> #end if <meta name="description" content="Tablet formatted display of current temperature, apparent temperature, wind speed, 10m max wind gust, today's max wind gust, today's rainfall and current rain rate."> <style> #centered { width:100%; margin: auto; } </style> </head> <body style="background-color:black;"> #include "analytics.inc" #include "realtime_updater.inc" <div style="background-color:black;color:#e51b23;"> <div> <table id="centered"> <tr> #if $Extras.has_key('logo') and $Extras.logo != '' <td style="text-align:left;"> <img src='$Extras.logo' alt='' width="200"/> </td> #else <td style="text-align:left;width:200px;"> </td> #end if <td style="text-align:center;"> <h1 class="page_title" style="font-size:28px;"> #if $Extras.has_key('title') $Extras.title #else WeatherBoard™ #end if </h1> <span class="lastupdate" style="font-size:18px;"> #if $Extras.has_key('subtitle') $Extras.subtitle #else Updated continuously. #end if </span> </td> <td style="text-align:right;width:200px;"> <span id="live-label"></span><br/> </td> </tr> </table> </div> </div> <div> <div> <div> <div> <table> </table> </div> <div style="color:red;"> <table id="centered"> <tr> <td style="text-align:center;font-family:monospace;font-size:85px"> <span id="FMT_outTemp">$current.outTemp</span><span> -</span><span id="FMT_appTemp">$current.appTemp</span> </td> </tr> <tr> <td id="windSpeedAndBearing" style="font-family:monospace;font-size:85px;text-align:center;">$current.windSpeed $current.windDir.ordinal_compass ($current.windDir)</td> </tr> <tr> <td style="font-family:monospace;font-size:85px;text-align:center;"> <span id="FMT_10mMaxGust"></span><span> - </span><span id="FMT_HI_windGust"></span> </td> </tr> <tr> <td style="text-align:center;font-family:monospace;font-size:85px;"> <span id="FMT_SUM_rain">$day.rain.sum</span><span> - </span><span id="FMT_rainRate">$current.rainRate</span> </td> </tr> </table> <div style="color:green;"> <table id="centered"> <tr> <td style="text-align:center;font-family:monospace;font-size:85px;border-top: 2px solid blue"> <span id="FMT_inTemp">$current.inTemp</span><span> - </span><span id="FMT_inHumidity">$current.inHumidity</span> </td> </tr> <tr> <td style="text-align:center;font-family:monospace;font-size:85px"> <span id="FMT_barometer">$current.barometer ($trend.barometer.formatted)</span><span> - </span><span id="FMT_outHumidity">$current.outHumidity</span> </td> </tr> </table> </div> </div> </div> </div> </div> #include "footer.inc" </body> </html>
## Copyright (C)2020 by John A Kline (j...@johnkline.com) ## Distributed under the terms of the GNU Public License (GPLv3) ## See LICENSE for your rights. #errorCatcher Echo <script> #if $Extras.has_key('page_update_pwd') page_update_pwd = '$Extras.page_update_pwd'; #else page_update_pwd = 'foo'; #end if #if $Extras.has_key('refresh_rate') refresh_rate = $Extras.refresh_rate; #else refresh_rate = 2; #end if #if $Extras.has_key('expiration_time') expiration_time = $Extras.expiration_time; #else expiration_time = 4; #end if function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } function getUrlParam(paramName) { var name, regexS, regex, results; name = paramName.replace(/(\[|\])/g, '\\$1'); regexS = '[\\?&]' + name + '=([^&#]*)'; regex = new RegExp(regexS); results = regex.exec(window.location.href); if (results === null) { return ''; } else { return results[1]; } } var pageTimedOut = false; function expirePage() { if (pageTimedOut) { // We've already timed out, return false; } pageTimedOut = true; var liveLabel = document.getElementById("live-label"); liveLabel.innerHTML = "CLICK"; liveLabel.style.color = "red"; var activityElement = document.getElementById("activity-string"); activityElement.innerHTML = ""; // set an onclick event on live-label to restart everything liveLabel.addEventListener("click", clickListener); } function clickListener() { // disable the onClick event again var liveLabel = document.getElementById("live-label"); liveLabel.removeEventListener('click', clickListener); liveLabel.innerHTML = ""; // restart everything pageTimedOut = false; // restart the page timeout timeOfNextPageExpiration = getTimeOfNextPageExpiration(); } function getTimeToNextUpdateCurrent() { return refresh_rate * 1000; } // Get time that page expires. function getTimeOfNextPageExpiration() { if (getUrlParam('pageUpdate') !== page_update_pwd) { // expire in N hours return Date.now() + 1000 * 60 * 60 * expiration_time; } else { // expire in 10,000 days return Date.now() + 1000 * 60 * 60 * 24 * 10000; } } // global variables - times of next events var timeOfNextPageExpiration = getTimeOfNextPageExpiration(); addLoadEvent(updateCurrent); function updateCurrent() { if (pageTimedOut) { return false; } var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4) { if (this.status == 200) { var result = JSON.parse(this.responseText); // Check the date // "dateTime": 1578965850, var lastUpdate = new Date(result["dateTime"] * 1000); var age = Math.round(Math.abs(new Date() - lastUpdate) / 1000); var element = document.getElementById("live-label"); element.style.fontWeight = "bolder"; element.style.color = "#e51b23"; if (age <= 6) { element.innerHTML = " LIVE "; } else { element.innerHTML = " " + age + "s ago "; } // Display the time of the last update. var activityElement = document.getElementById("activity-string"); activityElement.innerHTML = lastUpdate.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit', second:'2-digit'}); // temp var temp = result["FMT_outTemp"]; if (temp.length == 5) { temp = " " + temp; } else if (temp.length == 6) { temp = " " + temp; } document.getElementById("FMT_outTemp").innerHTML = temp; // in_temp var in_temp = result["FMT_inTemp"]; if (in_temp.length == 5) { in_temp = " " + in_temp; } else if (in_temp.length == 6) { in_temp = " " + in_temp; } document.getElementById("FMT_inTemp").innerHTML = in_temp; // inHumidity document.getElementById("FMT_inHumidity").innerHTML = result["FMT_inHumidity"]; // outHumidity document.getElementById("FMT_outHumidity").innerHTML = result["FMT_outHumidity"]; // barometer var barotrend = result["barometerRate"]; document.getElementById("FMT_barometer").innerHTML = result["FMT_barometer"] + " " + barotrend; // dew point var dew = result["FMT_appTemp"]; if (dew.length == 5) { dew = " " + dew; } else if (dew.length == 6) { dew = " " + dew; } document.getElementById("FMT_appTemp").innerHTML = dew; // wind speed and bearing var windSpeed = result["FMT_windSpeed"]; if (windSpeed.length == 7) { windSpeed = " " + windSpeed; } else if (windSpeed.length == 8) { windSpeed = " " + windSpeed; } var windBearing = result["COMPASS_windDir"]; if (result["windSpeed"] == 0.0) { windBearing = ""; } if (windBearing.length == 0) { windBearing = " "; } else if (windBearing.length == 1) { windBearing = windBearing + " "; } else if (windBearing.length == 2) { windBearing = windBearing + " "; } document.getElementById("windSpeedAndBearing").innerHTML = windSpeed + " " + windBearing; // wind gust (10m gust) var windGust10m = result["FMT_10mMaxGust"]; // This yeilds 9.9 mph. We need to lose the " mph". windGust10m = windGust10m.split(" ")[0] if (windGust10m.length == 1) { windGust10m = " " + windGust10m; } else if (windGust10m.length == 2) { windGust10m = " " + windGust10m; } else if (windGust10m.length == 3) { windGust10m = " " + windGust10m; } document.getElementById("FMT_10mMaxGust").innerHTML = windGust10m; // wind gust (today) var windGustTM = result["FMT_HI_windGust"]; if (windGustTM.length == 5) { windGustTM = " " + windGustTM; } else if (windGustTM.length == 6) { windGustTM = " " + windGustTM; } else if (windGustTM.length == 7) { windGustTM = " " + windGustTM; } document.getElementById("FMT_HI_windGust").innerHTML = windGustTM; // rain rate document.getElementById("FMT_rainRate").innerHTML = result["FMT_rainRate"]; // rain fall document.getElementById("FMT_SUM_rain").innerHTML = result["FMT_SUM_rain"]; // aqi #if $Extras.has_key('show_purple') and ($Extras.show_purple == 'true' or $Extras.show_purple == 'True') document.getElementById("aqi").innerHTML = result["pm2_5_aqi"]; document.getElementById("aqi").style.color = decode_rgb(result["pm2_5_aqic"]); #end if } } }; try { xhttp.open("GET", "$Extras.loop_data_file", true); xhttp.send(); } catch (e) { } finally { // set a timer to call updateCurrent (the 2 second timer) 2s from now. setTimeout(updateCurrent, getTimeToNextUpdateCurrent()); // Check to see if it's time to call expirePage. if (Date.now() >= timeOfNextPageExpiration) { expirePage(); } } } function decode_rgb(i) { var red = i >> 16; var green = (i & 0xFF00) >> 8; var blue = i & 0xFF; return `rgb(${red},${green},${blue})` } </script>