Page 1 of 1

new Record it flash a led

Posted: Wed Oct 10, 2018 12:20 pm
by dazza1223
<#newrecord>


hey is there a javascript when new Record it flash a led

so like this

if
new Highest Temperature flash a light

new Highest Dew Point flash a light

and so on

and put them all in the table ? :)

Re: new Record it flash a led

Posted: Wed Oct 10, 2018 5:38 pm
by sfws
http://wiki.sandaysoft.com/a/Webtags_as_boolean_operators_in_HTML#Alarms was written for Cumulus 1, to simply explain how to add any alarm to a web page. In your case you might need an image that flashed a picture of a LED. In Cumulus 1, the alarm is cleared (unset) once it has been looked at.
Most of the templates from Weather by You include a "system" page that shows all the alarms, each has a small disc image that is coloured if alarm set, plain if alarm not set; again these web pages were written for Cumulus 1. Post in separate Cumulus forum [url]viewforum.php?f=26[/url] section that is moderated by Jacques to check applicability to MX, or see his independent forum on [url]weatherbyyou.com[/url] specific to those templates.

Cumulus MX alarms work differently, they stay set for the short or long time between condition being set and the day ending, read more in Steve's introduction to MX, and Steve's answers elsewhere. I leave it to those who use MX to suggest any suitable scripts.

Re: new Record it flash a led

Posted: Wed Oct 10, 2018 5:59 pm
by dazza1223
thank for that and yh there might be some one who very clever with java etc as im not lol :!:

Re: new Record it flash a led

Posted: Wed Oct 10, 2018 9:11 pm
by Matt.j5b
Yes that is possible with Javascript which I used on my homepage of my website. I am a javascript novice so there maybe a better way. The method I use is a little manual as I don't think there is a way for Cumulus to handle this.

If you look at the source (Ctrl + U on windows) of my webpage you can see how I made this. I done this for both all-time and monthly records. First the monthly and all-time record web tags are used to produce the variables used for the script, followed by the current records entered manually. To list the records and flash the light the code compares the current record to manual entered record and writes the text and flashes the light. For example for low temperature if the current record (from the web tag)is less than the manually entered record then it's a new record. To stop displaying the new record after a period of time I change the manual record to the new record.

If this interests you, I can post the code if that helps.

Re: new Record it flash a led

Posted: Wed Oct 10, 2018 10:10 pm
by dazza1223
o Matt.j5b that will be very nice off you
thank u

im runing linux if that effects anythink?

Re: new Record it flash a led

Posted: Thu Oct 11, 2018 11:49 am
by Matt.j5b
This might not be exactly what you want, but should get you started.

To start with, this is just for the all-time records, as the monthly records are bit more complicated.

Enter in the head section (between the <head> and </head>)

Code: Select all

<script type="text/javascript">
<!--records variables declarations -->
//All time current record (processed by Cumulus)
var HTemp = <#tempH>;
var LTemp = <#tempL>;
var LMaxTemp = <#maxtempL>;
var HMinTemp = <#mintempH>;
var LDailyTempRange = <#LowDailyTempRange>;
var HDailyTempRange = <#HighDailyTempRange>;
var HAppTemp = <#apptempH>;
var LAppTemp = <#apptempL>;
var HHeatIndex = <#heatindexH>;
var HDewPoint = <#dewpointH>;
var LDewPoint = <#dewpointL>;
var HHum = <#humH>;
var LHum = <#humL>;
var LWindChill = <#wchillH>;
var HRainRate = <#rrateM>;
var HDailyRain = <#rfallH>;
var HMonthlyRain = <#rfallmH>;
var HHourlyRain = <#rfallhH>;
var LongestDryPeriod = <#LongestDryPeriod>;
var LongestWetPeriod = <#LongestWetPeriod>;
var HPressure = <#pressH>;
var LPressure = <#pressL>;
var HGust = <#gustM>;
var HWSpeed =<#wspeedH>;
var HWindRun = <#windrunH>;

//Current all time records (manually entered, to preserve values when new record is triggered)
var HTempRecord = ;
var LTempRecord = ;
var LMaxTempRecord = ;
var HMinTempRecord = ;
var LDailyTempRangeRecord = ;
var HDailyTempRangeRecord = ;
var HAppTempRecord = ;
var LAppTempRecord = ;
var HHeatIndexRecord = ;
var HDewPointRecord = ;
var LDewPointRecord = ;
var HHumRecord = ;
var LHumRecord = ;
var LWindChillRecord = ;
var HRainRateRecord = ;
var HDailyRainRecord = ;
var HMonthlyRainRecord = ;
var HHourlyRainRecord = ;
var LongestDryPeriodRecord = ;
var LongestWetPeriodRecord = ;
var HPressureRecord = ;
var LPressureRecord = ;
var HGustRecord = ;
var HWSpeedRecord =;
var HWindRunRecord = ;
</script>


Enter in the body section these two code blocks (In between <body> and </body>) where you want to place this.

This code flashes a green light if any all time record is current and displays the text of "New All Time Record Current", otherwise no flashing light and text of "No New All Time Record Current"

Code: Select all

<script type="text/javascript">
      if( HTemp > HTempRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( LTemp < LTempRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Records Current');
       }
       else if( LMaxTemp < LMaxTempRecord){
       document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HMinTemp > HMinTempRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( LDailyTempRange < LDailyTempRangeRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HDailyTempRange > HDailyTempRangeRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HAppTemp > HAppTempRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( LAppTemp < LAppTempRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HHeatIndex > HHeatIndexRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HDewPoint > HDewPointRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( LDewPoint < LDewPointRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HHum > HHumRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( LHum < LHumRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( LWindChill < LWindChillRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HRainRate > HRainRateRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HDailyRain > HDailyRainRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HMonthlyRain > HMonthlyRainRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HHourlyRain > HHourlyRainRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( LongestDryPeriod > LongestDryPeriodRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( LongestWetPeriod > LongestWetPeriodRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HPressure > HPressureRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( LPressure < LPressureRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HGust > HGustRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HWSpeed > HWSpeedRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
       else if( HWindRun > HWindRunRecord){
        document.write('<img src="images/record_1.gif" title="New Record Indicator" width="15" alt="New All Time Record">New All Time Record Current');
       }
      else{
      document.write('<img src="images/record_0.gif" title="New Record Indicator" width="15" alt="No All Time Record">No New All Time Record Current');
      }
</script>


This code lists the current all time records currents with date and time of occurrence

Code: Select all

<script type="text/javascript">
       if( HTemp > HTempRecord){
            document.write('New High Temperature record - <#tempH><#tempunit> at <#TtempH format="h:nn am/pm 'on' d mmmm yyyy"> &nbsp;&nbsp;&nbsp;&nbsp;');
      }
       if( LTemp < LTempRecord){
            document.write('New Low Temperature record - <#tempL><#tempunit> at <#TtempL format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( LMaxTemp < LMaxTempRecord){
      document.write('New Low Maximum Temperature record - <#maxtempL><#tempunit> at <#TmaxtempL format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HMinTemp > HMinTempRecord){
         document.write('New High Minimum Temperature record - <#mintempH><#tempunit> at <#TmintempH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( LDailyTempRange < LDailyTempRangeRecord){
         document.write('New Low Daily Temperature Range - <#LowDailyTempRange><#tempunit> at <#TLowDailyTempRange format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HDailyTempRange > HDailyTempRangeRecord){
         document.write('New High Daily Temperature Range - <#HighDailyTempRange><#tempunit> at <#THighDailyTempRange format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HAppTemp > HAppTempRecord){
         document.write('New High Apparent Temperature record - <#apptempH><#tempunit> at <#TapptempH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( LAppTemp < LAppTempRecord){
         document.write('New Minimum Apparent Temperature record - <#apptempL><#tempunit> at <#TapptempL format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HHeatIndex > HHeatIndexRecord){
         document.write('New High Heat Index record - <#heatindexH><#tempunit> at <#TheatindexH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HDewPoint > HDewPointRecord){
         document.write('<p>New High Dew Point Temperature record - <#dewpointH><#tempunit> at <#TdewpointH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;</p>');
        }
       if( LDewPoint < LDewPointRecord){
         document.write('New Minimum Dew Point Temperature record - <#dewpointL><#tempunit> at <#TdewpointL format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HHum > HHumRecord){
         document.write('New High Relative Humidity record - <#humH>% at <#ThumH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( LHum < LHumRecord){
         document.write('New Low Relative Humidity record - <#humL>% at <#ThumL format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( LWindChill < LWindChillRecord){
         document.write('New Minimum Wind Chill Temperature record - <#TwchillH><#tempunit> at <#TwchillH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HRainRate > HRainRateRecord){
         document.write('New High Rainfall Rate record - <#rrateM><#rainunit> at <#TrrateM format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HDailyRain > HDailyRainRecord){
         document.write('New High Daily Rainfall record - <#rfallH><#rainunit> at <#TrfallH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HMonthlyRain > HMonthlyRainRecord){
         document.write('New High Monthly Rainfall record - <#rfallmH><#rainunit> at <#TrfallmH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( HHourlyRain > HHourlyRainRecord){
         document.write('New High Hourly Rainfall record - <#rfallhH> <#rainunit> at <#TrfallhH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
        }
       if( LongestDryPeriodRecord > LongestDryPeriodRecord){
         document.write('New Longest Dry Period record - <#LongestDryPeriod>  days at <#TLongestDryPeriod format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
       }
       if( LongestWetPeriodRecord > LongestWetPeriodRecord){
         document.write('New Longest Wet Period record - <#LongestWetPeriod>  days at <#TLongestWetPeriod format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
       }
       if( HPressure > HPressureRecord){
         document.write('New High Air Pressure record - <#pressH> <#pressunit> <#TpressH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
       }
       if( LPressure < LPressureRecord){
         document.write('New Low Air Pressure record - <#pressL> <#pressunit> <#TpressL format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
       }
       if( HGust > HGustRecord){
         document.write('New High Wind Gust record - <#gustM> <#windunit> <#TgustM format="h:nn am/pm 'on' d mmmm yyyy"> &nbsp;&nbsp;&nbsp;&nbsp;');
       }
       if( HWspeed > HWSpeedRecord){
         document.write('New High Wind Speed record - <#wspeedH> <#windunit> <#TwspeedH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
       }
       if( HWindRun > HWindRunRecord){
         document.write('New High Wind Run record - <#windrunH> <#windrununit> <#TwindrunH format="h:nn am/pm 'on' d mmmm yyyy">&nbsp;&nbsp;&nbsp;&nbsp;');
       }   
</script>

On the server upload a green blinking light gif file and off light gif file. The above code uses:
off light: record_0.gif
on light: record_1.gif

And is stored in a folder called images - eg: mywebsite.com/images

To use, fill in the current records of the code in the head section, by manually inserting the records between the equals sign and the semicolon. The code simply compares the difference between the web tag records and these manually entered records. When there is a new record there will be a certain difference and hence the flashing light and text displays. When you want to remove the record change the manual entered record to this new record, making sure you change the correct variable.

The names of the variables should make sense. If you are not sure, please say so. Also there may be small bugs that I haven't discovered, so it is probably not perfect. Please let me know if you find anything not quite right.

Re: new Record it flash a led

Posted: Thu Oct 11, 2018 4:06 pm
by dazza1223
o thank u Matt.j5b ok i will let u know when i got my day off i will sit down with a x10 cppa and i will work it out