Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Mobile presentation for Cumulus 1

Discussion and questions about Cumulus weather station software version 1. This section is the main place to get help with Cumulus 1 software developed by Steve Loft that ceased development in November 2014.
Post Reply
User avatar
Vagspel
Posts: 61
Joined: Wed 11 Jan 2017 12:29 pm
Weather Station: Davis Vantage 2 Plus
Operating System: W10

Mobile presentation for Cumulus 1

Post by Vagspel »

Hi,
After a bit of thinking and realizing that the price for to fix apps for IOS and Android was to high :-) I did a simple mobile page using the info in Cumulus realtime.txt.
Check out the result at http://www.o-vader.se/mobil.php.
One small problem that I need to solve is dd:mm:yy to our standard yyyy:mm:dd but is is not a big deal.
Feel free to copy and use the script and ad your own data and meta tags.
Translate the "td-header" data into your own language.

<?php
$data = file_get_contents('http://www.yourdomain.xx/realtime.txt');
$d = explode(" ", $data);
?>

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content=" weather station, Temperatur, ">
<meta name="description" content=" weather station, Temperatur, ">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta http-equiv="refresh" content="60">

<style>
.td-header {
/* Font storlek i pixlar */
font-size: 24px;
font-weight: bold;
width: 50%;
}

.td-data {
/* Font storlek i pixlar */
font-size: 24px;
}

table {
width: 100%;
}
body {
background-color: #c8c8c8;
}

</style>

<title>Mobilsidan Öckerö väder</title>

<script>
Put your Google analytics script here if you are using it
</script>
</head>
<body>
<h2>Name of your weathestation</h2>
<table>
<tr>
<td class="td-header">Datum</td>
<td class="td-data"><?php echo $d[0]; ?></td>
</tr>
<tr>
<td class="td-header">Tid</td>
<td class="td-data"><?php echo $d[1]; ?></td>
</tr>
<tr>
<td class="td-header">Temperatur</td>
<td class="td-data"><?php echo $d[2] . " °C"; ?></td>
</tr>
<tr>
<td class="td-header">Upplevd temp</td>
<td class="td-data"><?php echo $d[54] . " °C"; ?></td>
</tr>
<tr>
<td class="td-header">Rel. fuktighet</td>
<td class="td-data"><?php echo $d[3] . " %"; ?></td>
</tr>
<tr>
<td class="td-header">Luftryck</td>
<td class="td-data"><?php echo $d[10] . " hPa"; ?></td>
</tr>
<tr>
<td class="td-header">Medelvind</td>
<td class="td-data"><?php echo $d[5] . " m/sek"; ?></td>
</tr>
<tr>
<td class="td-header">Byvind 10 min</td>
<td class="td-data"><?php echo $d[40] . " m/sek"; ?></td>
</tr>
<tr>
<td class="td-header">Vindriktning</td>
<td class="td-data"><?php echo $d[7] . " grader"; ?></td>
</tr>
<tr>
<td class="td-header">Vindriktning</td>
<td class="td-data"><?php echo $d[11] . " "; ?></td>
</tr>
<tr>
<td class="td-header">Soltimmar</td>
<td class="td-data"><?php echo $d[55] . " Tim"; ?></td>
</tr>
<tr>
<td class="td-header">Sol</td>
<td class="td-data"><?php echo $d[45] . " W/m2"; ?></td>
</tr>
</table>
</body>
</html>

The filname should be .php
//Gunnar
You do not have the required permissions to view the files attached to this post.
Last edited by Vagspel on Sun 12 Mar 2017 2:49 pm, edited 1 time in total.
Gunnar
www.o-vader.se
www.o.vader.se/mobil.php for mobile phones
User avatar
PaulMy
Posts: 3777
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Mobile presentation for Cumulus 1

Post by PaulMy »

Thanks Gunnar, I've given it a try to test on my new Galaxy S7 http://www.komokaweather.com/weather/cu-mobile.php

Enjoy,
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Mobile presentation for Cumulus 1

Post by sfws »

Vagspel wrote:<td class="td-header">Datum</td>
<td class="td-data"><?php echo $d[0]; ?></td>
Vagspel wrote:One small problem that I need to solve is dd:mm:yy to our standard yyyy:mm:dd
A simple way is change to

Code: Select all

<td class="td-header">Datum</td>
<td class="td-data"><?php echo "20" . substr($d[0],-2,2) . "-" . substr($d[0],3,2) . "-" . substr($d[0],0,2); ?></td>
User avatar
Vagspel
Posts: 61
Joined: Wed 11 Jan 2017 12:29 pm
Weather Station: Davis Vantage 2 Plus
Operating System: W10

Re: Mobile presentation for Cumulus 1

Post by Vagspel »

Thanks, I will try this :-)
//Gunnar

Works perfect :D
Thanks again!
//G
Gunnar
www.o-vader.se
www.o.vader.se/mobil.php for mobile phones
User avatar
PaulMy
Posts: 3777
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Mobile presentation for Cumulus 1

Post by PaulMy »

Thanks sfws, I made that change...

and if I may ask further, what PHP code would I use to show "Yes" if sun shining and "No" if not to replace my archaic 0=No 1-Yes?

Code: Select all

<tr>
<td class="td-header">Sun Shining</td>
<td class="td-data"><?php echo $d[57] . " (0=N 1=Y)"; ?></td>
</tr>
http://www.komokaweather.com/weather/cu-mobile.php

Enjoy,
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
Vagspel
Posts: 61
Joined: Wed 11 Jan 2017 12:29 pm
Weather Station: Davis Vantage 2 Plus
Operating System: W10

Re: Mobile presentation for Cumulus 1

Post by Vagspel »

PaulMy,
Try this!
echo "Sun : " . $RTpieces[57] . " (0=N 1=Y)";
echo "\r\n";
echo "Sun : ";
if ($RTpieces[57] == "0") {
echo "No!";
} else {
echo "YES!";
}
//Gunnar
Gunnar
www.o-vader.se
www.o.vader.se/mobil.php for mobile phones
User avatar
PaulMy
Posts: 3777
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Mobile presentation for Cumulus 1

Post by PaulMy »

Thanks Gunnar,
I had to reverse the conditional statement as it was displaying YES when there was no sunshine and Cumulus realtime.txt had 0 in the last field.

Code: Select all

<tr>
<td class="td-header">Sun Shining</td>
<td class="td-data">
<?php if ($RTpieces[57] == "1") {
echo "YES!";
} else {
echo "NO!";
}
?>
</td>
</tr>
Will see if it works correctly when next the sun is shinning.

Enjoy,
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
Vagspel
Posts: 61
Joined: Wed 11 Jan 2017 12:29 pm
Weather Station: Davis Vantage 2 Plus
Operating System: W10

Re: Mobile presentation for Cumulus 1

Post by Vagspel »

Np Paul, hope that it will work when the sun comes up :D
Creds to Bengt http://www.ockero.nu that wrote the code :clap:
//Gunnar
Gunnar
www.o-vader.se
www.o.vader.se/mobil.php for mobile phones
User avatar
PaulMy
Posts: 3777
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Mobile presentation for Cumulus 1

Post by PaulMy »

Thanks Gunnar and Bengt too!
One step backwards and two steps forward... my previous code did not work for the sun shinning as it did not change when the sun was ON or OFF. Decided to become a PHP expert (not)and Googled PHP If/Else and after many trials and errors I've got it working correctly, I think. Earlier this morning we had several times of sun shinning and not, so I could verify while testing, but now waiting for sun shinning again. I did try by hard coding "1" and "0" and with that it did work so on the right track.

It shows up quite well on my Galaxy S7 and Tab E (both of these and Android are new to me) http://www.komokaweather.com/weather/cu-mobile.php and like the realtime refresh updates. Will have to learn what's the difference between webpage and Apps. Through the Meteotemplate I have created an Android App which is somewhat similar to what you guys have done except that it has the Meteotemplate graphics in stead of the data description text. I haven't figured out how to add or change anything on this yet.

Enjoying, and learning...
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
Vagspel
Posts: 61
Joined: Wed 11 Jan 2017 12:29 pm
Weather Station: Davis Vantage 2 Plus
Operating System: W10

Re: Mobile presentation for Cumulus 1

Post by Vagspel »

There is something wrong with the mobil.php when opened in Edge!
Warning: file_get_contents(realtime.txt) [function.file-get-contents]: failed to open stream: Stale file handle in /home/content/96/5379896/html/weather/cu-mobile.php on line 2
//Gunnar
Gunnar
www.o-vader.se
www.o.vader.se/mobil.php for mobile phones
User avatar
PaulMy
Posts: 3777
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Mobile presentation for Cumulus 1

Post by PaulMy »

Hi Gunnar,
If you refresh then it will show correctly. I get this occasionally on other scripts and templates, including Saratoga, that rely on the realtime.txt. I have noticed it a few times on this new cu-mobile.php as well but a refresh/reload fixes it - at least on my Windows 8 PC, Galaxy S7 and Tab E devices. I have researched that Stale file handle error a lot but have not found any resolution. I have experimented with various realtime.txt realtime interval settings but without success. One template I use had a lot of this error, about once a minute, and working with the author we were not able to determine why, and then it just disappeared and has not shown for me on that template for months. There were quite a number of updates for that template so that might have been the reason it stopped giving the error but we have not determined what that might have been. To try to avoid that error I duplicated the realtime.txt as realtimeT.txt and have Cumulus process this and upload in real time but that also had given that Stale file handle error. Unless I stumble on to something else to try I have to live with it.

Enjoy,
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
Vagspel
Posts: 61
Joined: Wed 11 Jan 2017 12:29 pm
Weather Station: Davis Vantage 2 Plus
Operating System: W10

Re: Mobile presentation for Cumulus 1

Post by Vagspel »

Ok, I will check with Bengt and see if he has any idea of what the problem can be.
Take away <script> Put your Google analytics script here if you are using it </script>.
I put it there just to show you where I have my Analytic script.
//G
Gunnar
www.o-vader.se
www.o.vader.se/mobil.php for mobile phones
Post Reply