If you use Cumulus, please donate Image

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Cumulus Realtime.txt Dashboard Template

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderators: daj, TNETWeather

gw3atz
Posts: 12
Joined: Thu Jun 27, 2013 10:39 am
Weather Station: WS 1081
Operating System: Windows 10
Location: Shotton NE Wales

Re: Cumulus Realtime.txt Dashboard Template

Postby gw3atz » Thu Apr 14, 2016 1:25 pm

Thanks again................I note you have tested it on php 7. Can I assume it is backwards compatible with 5.?? Just a thought.

Geoff

User avatar
weatherist34
Posts: 264
Joined: Wed Apr 13, 2016 11:09 am
Weather Station: Fine Offset HP1000/2000
Operating System: OS X Sierra
Location: Istanbul
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby weatherist34 » Thu Apr 14, 2016 1:59 pm

gw3atz wrote:Thanks again................I note you have tested it on php 7. Can I assume it is backwards compatible with 5.?? Just a thought.

Geoff



attached a screenshot your realtime is generating a 404 every 5-10 seconds be careful your error log doesn't grow to a very large size
You do not have the required permissions to view the files attached to this post.
https://www.weather34.com
https://www.weather34.com/homeweatherstation/

"My code dont work and I dont know why. Now my code works but I still don't know why."

User avatar
mcrossley
Posts: 4803
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby mcrossley » Thu Apr 14, 2016 2:05 pm

Geoff, it sounds like you may not have the FTP rename option enabled in Cumulus - that should all but eliminate the 404's.

gw3atz
Posts: 12
Joined: Thu Jun 27, 2013 10:39 am
Weather Station: WS 1081
Operating System: Windows 10
Location: Shotton NE Wales

Re: Cumulus Realtime.txt Dashboard Template

Postby gw3atz » Thu Apr 14, 2016 3:06 pm

Thanks Mark and Brian. For reasons I cannot remember, FTP rename was enabled. Not anymore. Also found while looking into it, that I had a missing . (dot) in a path to realtime in ajaxCUwx.js. So I think, said he hopefully, that I have at least with your help sorted one problem I would have not spotted otherwise. The grey matter isn't what it used to be.....!!

Thanks again

Geoff.

User avatar
weatherist34
Posts: 264
Joined: Wed Apr 13, 2016 11:09 am
Weather Station: Fine Offset HP1000/2000
Operating System: OS X Sierra
Location: Istanbul
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby weatherist34 » Mon Apr 18, 2016 9:26 am

addressed a few teething issues nothing significant and updated download.(see screenshot in first post)

1.added timestamp for updated data
2.fixed wind speed area where gauge was causing issues on some setups/browsers (now removed gauge output)
3.fixed metric color temperature variables
4.updated jQuery to latest version
5.added custom font "weathertext"
6.added Helvetica as a webfont fallback for windows users who don't have helvetica font installed.

thats it nothing major

brian
https://www.weather34.com
https://www.weather34.com/homeweatherstation/

"My code dont work and I dont know why. Now my code works but I still don't know why."

User avatar
weatherist34
Posts: 264
Joined: Wed Apr 13, 2016 11:09 am
Weather Station: Fine Offset HP1000/2000
Operating System: OS X Sierra
Location: Istanbul
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby weatherist34 » Mon Apr 18, 2016 2:37 pm

passing the time whilst waiting for a delivery today , completely re-wrote the wind direction code

basically 1(x360) line of code for each degree and 1(x360) new line of css for each degree

else if($cumulus[7]<1){echo " <div class=\"direction n0\"></div><div class=\"windirectionwords\">Due<span>North</span></div>";}
else if($cumulus[7]<2){echo " <div class=\"direction n1\"></div><div class=\"windirectionwords\">Due<span>North</span></div>";}
else if($cumulus[7]<3){echo " <div class=\"direction n2\"></div><div class=\"windirectionwords\">Due<span>North</span></div>";}
else if($cumulus[7]<4){echo " <div class=\"direction n3\"></div><div class=\"windirectionwords\">Due<span>North</span></div>";}
else if($cumulus[7]<5){echo " <div class=\"direction n4\"></div><div class=\"windirectionwords\">Due<span>North</span></div>";}
else if($cumulus[7]<6){echo " <div class=\"direction n5\"></div><div class=\"windirectionwords\">Due<span>North</span></div>";}
else if($cumulus[7]<7){echo " <div class=\"direction n6\"></div><div class=\"windirectionwords\">Due<span>North</span></div>";}
else if($cumulus[7]<8){echo " <div class=\"direction n7\"></div><div class=\"windirectionwords\">Due<span>North</span></div>";}
else if($cumulus[7]<9){echo " <div class=\"direction n8\"></div><div class=\"windirectionwords\">Due<span>North</span></div>";}

and so on......
and css

.homeweatherstationcompass .direction.n0{transform:rotate(0deg)}
.homeweatherstationcompass .direction.n1{transform:rotate(1deg)}
.homeweatherstationcompass .direction.n2{transform:rotate(2deg)}
.homeweatherstationcompass .direction.n3{transform:rotate(3deg)}
.homeweatherstationcompass .direction.n4{transform:rotate(4deg)}
.homeweatherstationcompass .direction.n5{transform:rotate(5deg)}
.homeweatherstationcompass .direction.n6{transform:rotate(6deg)}
.homeweatherstationcompass .direction.n7{transform:rotate(7deg)}
.homeweatherstationcompass .direction.n8{transform:rotate(8deg)}
.homeweatherstationcompass .direction.n9{transform:rotate(9deg)}


and so on...

please use full update to reflect all changes. you can save your current settings.php .



have fun .brian
Last edited by weatherist34 on Mon Apr 18, 2016 8:29 pm, edited 1 time in total.
https://www.weather34.com
https://www.weather34.com/homeweatherstation/

"My code dont work and I dont know why. Now my code works but I still don't know why."

User avatar
mcrossley
Posts: 4803
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby mcrossley » Mon Apr 18, 2016 3:12 pm

Brian, I haven't looked at your code, but Cumulus can report the wind direction in either 8 or 16 directions - user selectable. I use 16 with a Davis, typically you use 8 with a Fine Offset.

User avatar
weatherist34
Posts: 264
Joined: Wed Apr 13, 2016 11:09 am
Weather Station: Fine Offset HP1000/2000
Operating System: OS X Sierra
Location: Istanbul
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby weatherist34 » Mon Apr 18, 2016 3:57 pm

hi I'm at your mercy sorry i don't use cumulus as my hardware is not supported so can you enlighten me a bit more so i can understand a bit clearer ,

in the code for wind direction i have inserted basically one code line for each degree value so there is 360 lines of code it will read each degree value and render
the appropriate position (in theory) .

10 degree rotates to 10deg etc..

appreciate the input as i do some of this blind and really do rely on feedback to get it right.

brian.
https://www.weather34.com
https://www.weather34.com/homeweatherstation/

"My code dont work and I dont know why. Now my code works but I still don't know why."

User avatar
beteljuice
Posts: 2433
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Cumulus Realtime.txt Dashboard Template

Postby beteljuice » Mon Apr 18, 2016 4:07 pm

... in the code for wind direction i have inserted basically one code line for each degree value so there is 360 lines of code
I was wondering about that ...
Why not just one one instruction to replace current image and rotate 'base' image x degrees ?
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
mcrossley
Posts: 4803
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby mcrossley » Mon Apr 18, 2016 4:12 pm

weatherist34 wrote:hi I'm at your mercy sorry i don't use cumulus as my hardware is not supported so can you enlighten me a bit more so i can understand a bit clearer ,

in the code for wind direction i have inserted basically one code line for each degree value so there is 360 lines of code it will read each degree value and render
the appropriate position (in theory) .

10 degree rotates to 10deg etc..

appreciate the input as i do some of this blind and really do rely on feedback to get it right.

brian.


Sorry, it was my misunderstanding, I thought you were using the cardinal points rather than degrees - I missed the (x360) and saw 8 tests.

Like beteljuice though, I would use one line of code to rotate the image on the client side, then you can animate it too with a CSS transition - if you wanted.

User avatar
PaulMy
Posts: 1434
Joined: Sun Sep 28, 2008 11:54 pm
Weather Station: Davis Vantage Pro 2 w/Envoy USB
Operating System: Windows-8
Location: Komoka, ON Canada
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby PaulMy » Mon Apr 18, 2016 4:31 pm

And I now have it here http://www.komokaweather.com/pws/cumulus.php with Brian's new code.

I can only show the results, as have no knowledge on how to code.

Thanks Brian,
Paul

User avatar
weatherist34
Posts: 264
Joined: Wed Apr 13, 2016 11:09 am
Weather Station: Fine Offset HP1000/2000
Operating System: OS X Sierra
Location: Istanbul
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby weatherist34 » Mon Apr 18, 2016 5:11 pm

hi i don't understand there is no image in the wind direction its all php/css , i had a image prior to this and just rotated a arrow.png in the original design but found the response time of refreshing the div/data was far quicker with a css layout only as opposed to loading an image albeit its a matter of milliseconds guess i had too much my time on my hands today.

the code is basically a border-radius circle and rotating a smaller radius (orange) circle marker around it

however I'm open to ideas to improve it .
https://www.weather34.com
https://www.weather34.com/homeweatherstation/

"My code dont work and I dont know why. Now my code works but I still don't know why."

User avatar
mcrossley
Posts: 4803
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby mcrossley » Mon Apr 18, 2016 6:48 pm

I had a quick look, but you are doing some stuff I do not understand the reason (three directions have 10 degree sub-directions - I haven't looked into why you are doing that).

If you weren't doing that, then I would replace all the if/elses with something like this...

Code: Select all

  dir = array('n','nne','ne','ene','e',...etc);
  words = array('Due<span>North</span></div>', 'NorthNorth<br><span>East</span></div>', 'North<span>East</span></div>',...etc);
 
 if ($wind_degrees>360) {
   echo '';
 } elseif ($wind_degrees ==0) {
  echo 'Calm'
 } else {
   echo ' <div class="direction '.dir[floor(($wind_degrees + 11.25) / 22.5) % 16]'"></div>'.
       '<div class=\"windirectionwords\">'.words[floor(($wind_degrees + 11.25) / 22.5) % 16].'</div>';
 }


More compact and easier to localise as the text is input once.

User avatar
weatherist34
Posts: 264
Joined: Wed Apr 13, 2016 11:09 am
Weather Station: Fine Offset HP1000/2000
Operating System: OS X Sierra
Location: Istanbul
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby weatherist34 » Mon Apr 18, 2016 8:18 pm

hi

totally agree on the making it compact but I'm very confused on your code is that from cumulus template or another version of the template.

im also not getting why adding the word calm to a wind_degree value output ?
if ($wind_degrees>360) {
echo '';
} elseif ($wind_degrees ==0) {
echo 'Calm'

the template uses the $(cumulus)[number] from $file_live=file_get_contents($livedata);$cumulus=explode(" ",$file_live);

please I'm not being ignorant I'm trying to understand but it gets a bit confusing think ill stick with the current output until i can find a better way to compact it and retain the design elements.

i do have an alternative just takes a bit of time perfecting it , it is somewhat smaller in terms of code but the end result is the same visual output . thanks for idea of compacting it

brian
https://www.weather34.com
https://www.weather34.com/homeweatherstation/

"My code dont work and I dont know why. Now my code works but I still don't know why."

User avatar
weatherist34
Posts: 264
Joined: Wed Apr 13, 2016 11:09 am
Weather Station: Fine Offset HP1000/2000
Operating System: OS X Sierra
Location: Istanbul
Contact:

Re: Cumulus Realtime.txt Dashboard Template

Postby weatherist34 » Mon Apr 18, 2016 8:34 pm

PaulMy wrote:And I now have it here http://www.komokaweather.com/pws/cumulus.php with Brian's new code.

I can only show the results, as have no knowledge on how to code.

Thanks Brian,
Paul


hello paul think its wise to just update everything just , updated the jQuery to the latest and removed the windspeed gauge output ,they were not so friendly on some windows OS browsers unfortunately fine on mac but some teething issues on others. sometimes you wish it was one os one browser but i guess that just wishful thinking
.

brian
https://www.weather34.com
https://www.weather34.com/homeweatherstation/

"My code dont work and I dont know why. Now my code works but I still don't know why."


Return to “Web site - General”

Who is online

Users browsing this forum: Bing [Bot], laulau and 2 guests