Realtime.txt: Difference between revisions

 
(32 intermediate revisions by 2 users not shown)
{{Template:Version badge Mx}}{{Version badge 1}}This Wiki page applies to both Cumulus flavours.
 
= Introduction =
 
[[Category:Cumulus Files]] [[Category:MX_txt_Files]]
[[Image:CumulusInternetSettingsScreen.png|thumb]] Although not technically a 'log file' it is automatically produced by Cumulus and follows a similar format to the other Log files.
This Wiki page describes one of the [[:Category:Cumulus Files|files]] that Cumulus can optionally generate.
 
*'''realtime.txt''' is a text file with a single line of ''space'' separated values.
*It contains a list of key values of the sensors and is re-created frequently.
*After creation, it is usually set to upload to your website and used to produce near instant readings.
*The realtime.txt file is NOT a log file and is constantly replaced. It does not therefore contain any historic data.
*The 'interval' sets how often Cumulus produces the file, to set that interval, click on the 'Configuration' menu then 'Internet', then set parameter labelled 'Realtime interval' by entering an integer number of seconds.
*Optionally the file can be uploaded to your website, if you want this (and it is usual) select all 3 selectors:
**Enable Realtime
**Enable Realtime FTP
**Realtime.txt FTP
*The uploading interval is the same as the file creation interval.
 
= List of fields in the file =
 
The list below represents the field list for the final 1.9.4 version of Cumulus, (and releases of MX before 3.7.0).
== Special note to Fine Offset/EasyWeather users ==
Weather stations which come shipped with the EasyWeather software should consider the realtime updating with care. The station only updates every 48 seconds, so aim for a realtime interval of around 30 seconds, that way a visitor knows not to expect updates too often but you also allow Cumulus to catch up to two updates within a minute (depending on when the first and second 48 second update came to Cumulus).
 
== Bandwidth Considerations ==
The file Cumulus uploads is less than 1024 bytes in size, but for the calculation we will assume 1024 bytes, and typically this is (for non Fine Offset stations) updated every 5 to 15 seconds depending on your 'Realtime interval' setting above.
 
Most internet providers now place a limit on the amount of Bandwidth you can consume each month. Bandwidth is a figure representing the data you can upload and download. Doing such a regular upload will impact on your allowance.
 
During a month (31 days) the upload process will consume roughly 175 Mbytes of bandwidth -- this is a tiny consideration as usually bandwidth restrictions from your provider start in the Gigabytes (Gb) range, not Megabytes (Mb).
 
On top of your internet connection bandwidth restrictions, you may also have bandwidth caps on your web server so this same figure should be considered for your webserver.
 
= Where is the file used =
 
The realtime.txt is used only in Cumulus 1 in the following areas:
*the 2 wind graphics at the bottom of the standard 'gauges' page on the website produced by Cumulus
*[[CumulusRealtime]] -- the new application developed in [http://silverlight.net/ SilverLight]
*The [[WeatherConsole]] and [[Sidebar gadget]] [[:Category:AddOns|addons]]
 
The file is NOT used by any standard MX feature.
 
= List of fields in the file =
 
For historic interest, old versions of Cumulus 1 had fewer fields; although the table does not indicate the version at which each field was added, you can click the '''History''' tab and look at the early edits.
{| border="1" class="wikitable"
|-
! style="width:60px" | Field # number
! style="width:80px" | Example content
! style="width:450px" | Description
! style="width:90px" | Equivalent [[Webtags|web tag]] if your locale/region uses decimal points<br> See [[#MX web tags]] for equivalents in latest MX releases.
|-
| 1
| 13
| 6
| wind speed as in 6 converted to force number ([http://en.wikipedia.org/wiki/Beaufort_scale beaufort])
| <#beaufortnumber>
|-
| 58
| 1
| Is it sunny? 1 if the sun is shining, otherwise 0 (above or below [[Cumulus.iniini_(Cumulus_1)#Section:_Solar |threshold]])
| &lt;#IsSunny&gt;
|-
| 59
| 13.2
| Feels Like Temperature
|}
 
==Fields added with later releases of MX ==
== Example of the file ==
 
Please be aware that MX develops very rapidly, and there is a lack of contributors to the Wiki, so the information here may be out of date.
''(this is one complete line, although it may appear on this page as two or more due to screen width restrictions)''
 
{| border="1" class="wikitable"
<br> <tt>18/10/08 16:03:45 8.4 84 5.8 24.2 33.0 261 0.0 1.0 999.7 W 6 mph C mb mm 146.6 +0.1 85.2 588.4 11.6 20.3 57 3.6 -0.7 10.9 12:00 7.8 14:41 37.4 14:38 44.0 14:28 999.8 16:01 998.4 12:06 1.8.2 448 36.0 10.3 10.5 13 0.2 14 260 2.3 3 1 1 NNW 2040 ft 12.3 11.1 420.1 1</tt>
|-
! style="width:60px" | Field number
! style="width:80px" | Example content
! style="width:450px" | Description
! style="width:90px" | Equivalent [[Webtags|web tag]] if your locale/region uses decimal points<br> See [[#MX web tags]] for equivalents in latest MX releases.
|-
|59 (only included for release 3.7.0 and later)
| 13.6
| Feels Like
|&lt;#feelslike&gt;
|}
 
= Bandwidth Considerations =
== Recreating the file using web tags ==
Most internet providers now place a limit on the amount of Bandwidth you can consume each month. Bandwidth is a figure representing the quantity of data you can upload and download. The various uploads done by Cumulus will have a huge impact on your allowance if you choose to upload at very frequent intervals.
 
* Sizing guidance for the legacy Cumulus (1) uploads:
** The "realtime.txt" file the is less than 1024 bytes in size, but for the calculation we will assume 1024 bytes, and typically this is (for non Fine Offset stations, see [[#Special note to Fine Offset/EasyWeather users]]) updated every 5 to 15 seconds depending on your [[#Enabling generation of this file in MX|'Realtime interval' setting]]. 1 kilobyte every 10 seconds represents 144 kB a day.
** Uploading [[FAQ#What_is_the_size_of_the_standard_Cumulus_update.3F|the realtime.txt plus the standard templates]] represents about 90 MB per day (based on uploading only every 10 minutes).
 
* Sizing guidance for MX uploads:
Note that the built-in realtime.txt always uses a 'dot' decimal character (and so is JavaScript/PHP 'safe'), any web tag version will use your host computers localisation for decimals. [There are some #RCxxx webtags available but they do not cover all the required values]
** For Cumulus MX, the optional '''realtime.txt''' file is at least 262 bytes, (a lot of the content never changes, but if you have enabled generation and upload of this file, the whole file is uploaded every time), so still smaller than that 1024 bytes, and therefore still less than 1.5 MB a day even if uploaded every second.
** The [[SteelSeries Gauges]] web page is often supplied with data every second, (34 560 times a day), that represents a minimum of 110 MB per day, as the mandatory file '''realtimegaugesT.txt''' is 2.2 kiloBytes (kB).
** MX graph drawing uses assorted [[:Category:JSON_Files|*.json]] files which add up to several megabytes (MB) at every upload (compared against the highly compressed legacy Cumulus graph images of 400 kB per upload). So assuming these .json files are uploaded at the standard interval and that is set to 1 minute, just for graph plotting, MX requires a further 150 to 350 MB per day, this is dependent on various settings (e.g. data period represented on graphs, which graphs are being plotted).
** For the other web pages, the file concerned is [[websitedataT.json]] which is 31.5 kB, and if that is uploaded every minute, that adds about 50 MB a day.
** Don't forget that you may have files uploaded at end of day, you may be sending files to third party sites, to home automation, and be uploading [[MySqlConnect|SQL commands]], all these need to be multiplied by how often they are sent in a day, and then included in your calculation where relevant.
 
On top of your internet connection bandwidth restrictions, you may also have bandwidth caps on your database, or web, servers so this same figure should be considered for your various servers.
To ensure decimal compatibility across systems use a js construct such as:
 
var rt = realtime.split(" ");
var temp = +rt[2].replace(',','.');
 
when referring to decimal values in the constructed file.
 
= Explaining the file =
=== Alternative content ===
 
Cumulus optionally generates this file, it represents one way that current Cumulus derivatives can be supplied to any [[:Category:User Contributions|third party additions]] you use, or your own external purposes.
Some users, and some third-party supplied web pages, require a different set of fields to those provided in the standard realtime.txt file. In these cases, an alternative file, sometimes called realtime-xT.txt is set up in the web folder, processed and uploaded using the Extra Files feature.
 
Three examples taken from third party [[:Category:AddOns|addons]]:
=== Different interval or different file name ===
* [[CumulusRealtime|developing real time]] functionality. This add-on is by the author of Cumulus, Steve Loft, and involves 2 extra wind graphics added at the bottom of the example 'gauges' page in the web template set produced by Cumulus 1, it was developed using [http://silverlight.net/ SilverLight] and uses data obtained by reading this file
* [[WeatherConsole]]
* [[Sidebar gadget]]
 
There are two key points to understand about the source for generation of the file:
Occasionally there is a requirement from some users to create a copy of the realtime.txt file and have it posted to a location at the normal Cumulus web update interval rather than the realtime interval, or perhaps because a filename other than realtime.txt is required. This can be achieved by creating a template file using the web tags below, and referencing this in the Cumulus Configuration|Internet|Files dialog. Ticking the 'Process?' checkbox, and supplying a remote filename will create this copy of the realtime.txt file.
#First is that a [[Cumulus template file]] is held internally in the Cumulus code that can generate this file with some standard content as [[#List of fields in the file|listed in table above]]
# Second is that this internal template, regardless of any locale (or region) settings, always generates the file so that it is readable by [[PHP#Incorporating_Script|script languages]] that expect a full stop to separate the integer part of any real number from the decimal part of that real number.
 
Information about the default generated file:
* As hinted above, the generation of the file requires you to set various options, see [[#Generation of this file]]
* There is no functionality, included in any Cumulus software that you download, that requires this file to exist
* The '''realtime.txt''' is generated as a text file with a single line of ''space'' separated values.
* The file contains a list of key values of the sensors
* The file is intended to be re-created frequently.
* The file is usually set to upload to your website, where it might be used as a source of near instant readings.
* The realtime.txt file will never contain any extreme records, nor any daily (or longer period) summaries, nor any historic data.
 
==Creating a customised real time file==
 
Some users, and some third-party supplied web pages, require fewer, or more, fields than those provided in the standard '''realtime.txt''' file.
 
Arranging this is easy, the content of a file, that Cumulus uploads to an external site for you, can be tailored to the needs of whatever you choose.
 
All you need to do is create your own [[Cumulus template file]], sometimes called ''realtime-xT.txt'' (to indicate it is an e''X''tra file, a ''T''emplate file and is related to ''realtime''.txt), you can place this file in the [[web folder]], and ask Cumulus to process that file for you:
* [[File:Badge v1.png]] Legacy software versions:
*# Create the template file picking the web tags you want to include from:
*#* If you use decimal commas, the list [[Webtags#CURRENT_CONDITIONS:|here]]
*#* If you use decimal points, the list [[Webtags#Current_Conditions|here]]
*# Arrange for the processing and uploading by using the Cumulus menu selections: '''Configuration''' &rarr; ''Internet'' &rarr; '''Files''' tab dialog. [[File:Cumulus Internet Settings Files.png|Right]]
*#* Type in the name you have used for your template file in ''Local Filename''
*#* Tick the ''Process?'' checkbox,
*#* Tick the ''Realtime?'' checkbox,
*#* Finally, supplying a remote path and filename that you want created remotely, you can call it "realtime.txt" after the path name if you like
* [[File:Badge vMx.png]] From build 3075 onwards, all decimal web tags now support the "rc=y" modification parameter.
*# Create the template file based on the list of web tags in the code snippet [[#MX web tags|below]]. If you are unsure what they represent, look [[Webtags#Current_Conditions|here]].
*# Arrange for the processing and uploading by using the '''Extra web files''' page in the [[MX_Administrative_Interface#Extra_Web_Files|interface]], follow the instructions in that link, [[File:Extra web settings.png|Right]] ticking the ''Process?'' checkbox, the ''Real Time?'' checkbox, and the '''UTF8''' checkbox (as shown in first row in image)
 
 
===MX web tags===
''(this is one complete line, although it may appear on this page as two or more due to screen width restrictions)''
 
:<ttcode>&lt;<#date format=dd/mm/yy&gt;> &lt;<#timehhmmss&gt;> &lt;<#temp&gt; &lt;rc=y> <#hum&gt;> &lt;<#dew&gt; &lt;rc=y> <#wspeed&gt; &lt;rc=y> <#wlatest&gt; &lt;rc=y> <#bearing&gt;> &lt;<#rrate&gt; &lt;rc=y> <#rfall&gt; &lt;rc=y> <#press&gt; &lt;rc=y> <#currentwdir&gt;> <#beaufortnumber> &lt;<#windunit&gt;> <#tempunitnodeg> &lt;<#pressunit&gt;> &lt;<#rainunit&gt;> &lt;<#windrun&gt; &lt;rc=y> <#presstrendval&gt; &lt;rc=y> <#rmonth&gt; &lt;rc=y> <#ryear&gt; &lt;rc=y> <#rfallY&gt; &lt;rc=y> <#intemp&gt; &lt;rc=y> <#inhum&gt;> &lt;<#wchill&gt; &lt;rc=y> <#temptrend&gt; &lt;rc=y> <#tempTH&gt; &lt;rc=y> <#TtempTH&gt;> &lt;<#tempTL&gt; &lt;rc=y> <#TtempTL&gt;> &lt;<#windTM&gt; &lt;rc=y> <#TwindTM&gt;> &lt;<#wgustTM&gt; &lt;rc=y> <#TwgustTM&gt;> &lt;<#pressTH&gt; &lt;rc=y> <#TpressTH&gt;> &lt;<#pressTL&gt; &lt;rc=y> <#TpressTL&gt;> &lt;<#version&gt;> &lt;<#build&gt;> &lt;<#wgust&gt; &lt;rc=y> <#heatindex&gt; &lt;rc=y> <#humidex&gt; &lt;rc=y> <#UV&gt; &lt;rc=y> <#ET&gt; &lt;rc=y> <#SolarRad&gt;> &lt;<#avgbearing&gt;> &lt;<#rhour&gt; &lt;rc=y> <#forecastnumber&gt;> &lt;<#isdaylight&gt;> &lt;<#SensorContactLost&gt;> &lt;<#wdir&gt;> <#cloudbasevalue> <#cloudbaseunit> &lt;<#apptemp&gt; &lt;rc=y> <#SunshineHours&gt; &lt;rc=y> <#CurrentSolarMax&gt;> &lt;<#IsSunny&gt;> <#feelslike rc=y></ttcode>
 
== Different interval or different file name ==
 
Occasionally there is a requirement from some users to create a copy of the realtime.txt file and have it posted to a location at the normal Cumulus web update interval rather than the real time interval, or perhaps because a filename other than realtime.txt is required.
 
Simply follow a variant on the instructions above.
* If you want the normal web update interval, don't tick the ''Realtime?'' checkbox.
* If you want a different filename, simply change what you put for ''Remote filename''.
 
=Generation of this file=
 
This is optional functionality, the default (in all flavours of Cumulus) is not to generate this file.
 
==Enabling generation of this file in MX==
 
The Settings pages of MX are being drastically rewritten as the software is developed.
 
Indeed the way of selecting generation of this file is due to change in the next release of MX as I type this, so specific instructions are not included here.
 
In general you need to make three selections:
# You need to enable the timer in MX that does actions at a real time interval.
# You need to configure (as a number of seconds) how frequently that timer triggers the actions
# You need to enable the file transfer (or if available, the copy) process that gets files uploaded onto an external (e.g. web) site
# You need to enable the generation of this specific file
 
==Enabling generation of this file in Cumulus 1==
 
The legacy screen that controls production of this file, is obtained by a click on the 'Configuration' menu then 'Internet', once the ''Internet Settings'' screen appears, you should be looking at the '''Sites/Options''' tab. That screen's original look (as Steve Loft included here) is in the larger image.
 
When he developed Cumulus 1 further, with two extra real-time boxes to tick to respectively, generate, and upload, the file, Steve Loft did not update the screen shots he included in this Wiki. [[Image:CumulusInternetSettingsScreen.png|Right]]
 
However, the smaller image (below) shows a later version of part of the original image;
[[File:Web settings.JPG|left]] and you will see the new set of three tick boxes in the lower part of that smaller image:
*The 'Realtime interval' sets how often Cumulus produces the file, to set that interval, set parameter labelled 'Realtime interval' by entering an integer number of seconds.
*Optionally the file can be uploaded to your [[Website_setup|externally-hosted web site]], if you want this (and it is usual) select all 3 selectors:
**Enable Realtime
**Enable Realtime FTP
**Realtime.txt FTP (Note in the smaller image this is not ticked, as not creating the file is the default)
*The uploading interval is the same as the file creation interval.
 
means that most of it gets very out of date, as MX is develo
 
= Special note to Fine Offset/EasyWeather users =
 
Weather stations which come shipped with the EasyWeather software should consider carefully how they use the real-time updating.
 
The station only updates every 48 (solar is only updated every 60) seconds, so aim for a real-time interval of around 30 seconds, that way a visitor knows not to expect updates too often but you also allow Cumulus to catch up to two updates within a minute (depending on when the first and second 48 second update came to Cumulus).
 
 
= Example of the file =
 
''(this is one complete line, although it may appear on this page as two or more due to screen width restrictions)''
 
<br> <tt>18/10/08 16:03:45 8.4 84 5.8 24.2 33.0 261 0.0 1.0 999.7 W 6 mph C mb mm 146.6 +0.1 85.2 588.4 11.6 20.3 57 3.6 -0.7 10.9 12:00 7.8 14:41 37.4 14:38 44.0 14:28 999.8 16:01 998.4 12:06 1.8.2 448 36.0 10.3 10.5 13 0.2 14 260 2.3 3 1 1 NNW 2040 ft 12.3 11.1 420.1 1 13.6</tt>
[[Category:Cumulus Files]]