Wind speed and gusts data wrong in mobile view

Post Reply
soend
Observer
Observer
Posts: 11
Joined: Mon Oct 02, 2017 8:44 am

Wind speed and gusts data wrong in mobile view

Post by soend » Thu May 31, 2018 7:39 pm

For some reason the wind speed and gust speeds are not showing the same data in mobile and normal view. Mobile view always shows way higher numbers. All the rest of the data in the current conditions block is correct.

Any ideas what could be causing this?

Desktop view: http://ilm.linnulennult.com/indexDesktop.php
Mobile view: http://ilm.linnulennult.com/pages/lite/index.php

andyk1
Professional
Professional
Posts: 433
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by andyk1 » Sat Jun 02, 2018 3:54 am

Looking at both your sites at the same time I did see the difference you mentioned. Watching it for a while I noticed main site CC block refreshes at 1 min (60sec) intervals but your Mobile (lite) site did not refresh the window at all. A manual refresh did little. Trying to refresh at the same time as main window got close sometimes but not perfect match.

1) I would first suggest maybe put a refresh time on you mobile (lite) site and go from there.

2) Did you mod the lite sites php files? setting?. If so, check where you may have changed things from the original version.

Andy
Image

soend
Observer
Observer
Posts: 11
Joined: Mon Oct 02, 2017 8:44 am

Re: Wind speed and gusts data wrong in mobile view

Post by soend » Sun Jun 03, 2018 10:08 am

The difference between the wind measurements looks too big to be just old data issue. Here is one example:
CaptureLite.PNG
CaptureLite.PNG (16.03 KiB) Viewed 17219 times
CaptureDes.PNG
CaptureDes.PNG (6.42 KiB) Viewed 17219 times
For me it looks more like lite version has data conversion bug in the code.

andyk1
Professional
Professional
Posts: 433
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by andyk1 » Sun Jun 03, 2018 3:41 pm

Yes I see what you are talking about today. Yesterday or whatever day it was when I last looked the data was fairly close togater. Today it is way off. It is hard to tell in your lite (mobile) since it is not refreshing at all other than manual screen refresh. 54.7 m/s sounds very off or extremly windy. Why is the lite version not refreshing? look into that first and go from there. It should be the same as when I tested it on my end they matched.

Andy
Image

andyk1
Professional
Professional
Posts: 433
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by andyk1 » Sun Jun 03, 2018 3:47 pm

Double checking my own Desktop and mobile versions match exactly other than the time which is only off by seconds which of course is normal. Looking closely at my site and yours I am not sure where to look next. Maybe a message to Jachym would help narrow down your issue.

Andy
Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by Jachym » Sun Jun 03, 2018 7:35 pm

They should both use data from meteotemplateLive.,txt, so there should not be any difference, I will look at it

soend
Observer
Observer
Posts: 11
Joined: Mon Oct 02, 2017 8:44 am

Re: Wind speed and gusts data wrong in mobile view

Post by soend » Mon Jun 04, 2018 8:05 am

I think i figured it out. In the meteotemplateLive.txt file the wind speeds come in as Km/h. The desktop site converts them to m/s but thats not happening in the mobile lite site.

Raw realtime.txt data:
04.06.18 12:01:04 15.9 65 9.4 4.9 4.5 316 0.0 1.0 997.60 NW 3 m/s C hPa mm 122.1 0.00 1.6 68.2 0.0 25.4 38 15.9 +0.4 16.2 11:53 13.8 09:51 5.4 11:16 8.5 07:16 1003.52 00:00 997.22 09:54 3.0.0 3041 8.0 15.9 16.9 4.2 0.84 260 323 0.0 16 1 0 NW 2690 ft 12.4 1.0 816 0

EDIT:
So i did some digging and here's whats been happening:
1) Data is sent to template from Cumulus using realtime.txt - wind speed units m/s
2) Update.php script reads the data from realtime.txt and converts the wind speed to km/h - wind speed units km/h
3) Update.php calls api.php script what then creates meteotemplateLive.txt with current data - wind speed units km/h

In config.php i have:

Code: Select all

$dataWindUnits = 'ms';
$displayWindUnits = 'ms';
I have had the data wind units as m/s since the beginning before the API was introduced. Data in database seems to be stored as m/s. What will happen if i change this to km/h now?

andyk1
Professional
Professional
Posts: 433
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by andyk1 » Mon Jun 04, 2018 2:26 pm

Wait for Jachym to chime in before you make any changes in the main setup after you configured it and ran the program to generate the db files. I know if you make any changes without Jachyms help it will supposedly trash your MySQL db file. Not really sure what version you started with but am fairly certain once it's generated then can't be changed except to add sensors and solar and you understand MySQL command line scripts I believe.
Make a backup of your db file before messing with it in MySQL which should be available from your host server or access it from your computer with MySQL but know what your doing.

https://andykere-hotmail.tinytake.com/s ... 83OTcxMzA1

Am fairly certain where the arrow points on the screen capture above is what your talking about but remember it can't be changed without help if it's possible.

Edit: I meant to point at the Database unit's directly above the arrow. That can't be changed.

Andy
Image

soend
Observer
Observer
Posts: 11
Joined: Mon Oct 02, 2017 8:44 am

Re: Wind speed and gusts data wrong in mobile view

Post by soend » Mon Jun 04, 2018 7:19 pm

andyk1 wrote: Mon Jun 04, 2018 2:26 pm https://andykere-hotmail.tinytake.com/s ... 83OTcxMzA1

Am fairly certain where the arrow points on the screen capture above is what your talking about but remember it can't be changed without help if it's possible.
Yes, you are correct. Thats the setting im talking about. In config.php its named $dataWindUnits.

andyk1
Professional
Professional
Posts: 433
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by andyk1 » Mon Jun 04, 2018 7:37 pm

Hello!!!

Reading through the wiki again. I think you may be able to experiment with the Webpage default display units. Where the arrow is pointing in the screen shot. The only other thing I can think of is backing up your db files... by year not the entire db file if it more than years old and starting the config process over from the beginning and then re-importing your data after the correction. I have done that a few times first building my site and having to restart due to errors on my part skipping steps. It took me roughly an hour to re-import 10 years of data one year at a time. I tried the entire backup and of course as the wiki says it's an overload which was correct. Trial an error my friend.

I honestly would wait for Jackym to provide advice on this. If no response send him a private message with a link to this tread as he is extremely busy these days and does not always see all these messages for days as he answers many messages a day.

Andy

P.S you can leave your old DB intact without deleting it as a back up and just start a new db as you rebuild your new config.php file.

The way I did it was back up config.php I.e. rename configbu.php and then run the setup.php and config starts over.
I am not sure but to set it up again you need to go into /your path/install/setup.php if I remember right but double check the wiki.
Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by Jachym » Tue Jun 05, 2018 5:40 pm

Hi,
the API (meteotemplateLive.txt) uses fixed units, in case of wind it should be km/h.

When data from meteotemplateLive.txt is transferred to the db, it is converted to "db units".

When data is displayed on the website, it is converted from km/h to "display units"

Mobile page:
<?php echo number_format(convertor($current['W'],"kmh", $displayWindUnits),1,".","")?>

This converts km/h to displayWindUnits, in your case it should be m/s.

Current block uses the exact same conversion:

$current['W'] = number_format(convertor($apiData['W'],"kmh",$displayWindUnits),1,".","");

andyk1
Professional
Professional
Posts: 433
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by andyk1 » Tue Jun 05, 2018 6:20 pm

Soend!

As an experiment can you add any block of your choice that also uses the wind measurement in m/s also which should be your default and see what you comes up with? I would suggest ssGauges or Gauges with the bare minimum wind speed/gust maybe try just temp and pressure to see if they react to the 60 second interval you have set. I'm curious to know what the results would be

Andy
Image

soend
Observer
Observer
Posts: 11
Joined: Mon Oct 02, 2017 8:44 am

Re: Wind speed and gusts data wrong in mobile view

Post by soend » Tue Jun 05, 2018 7:51 pm

Jachym wrote: Tue Jun 05, 2018 5:40 pm Hi,
the API (meteotemplateLive.txt) uses fixed units, in case of wind it should be km/h.

When data from meteotemplateLive.txt is transferred to the db, it is converted to "db units".

When data is displayed on the website, it is converted from km/h to "display units"

Mobile page:
<?php echo number_format(convertor($current['W'],"kmh", $displayWindUnits),1,".","")?>

This converts km/h to displayWindUnits, in your case it should be m/s.

Current block uses the exact same conversion:

$current['W'] = number_format(convertor($apiData['W'],"kmh",$displayWindUnits),1,".","");
Thats where you are wrong, i checked the index.php for the lite page and this is how the wind conversion is done there:

Code: Select all

<?php echo number_format(convertW($current['W']),1,".","")?>
By using the method you posted it now works and converts the units correctly.

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by Jachym » Wed Jun 06, 2018 9:59 am

The string i copied is directly from the script, make sure you have all the bug fixes installed

soend
Observer
Observer
Posts: 11
Joined: Mon Oct 02, 2017 8:44 am

Re: Wind speed and gusts data wrong in mobile view

Post by soend » Wed Jun 06, 2018 10:10 am

Oh i see, there is bug fix for the lite site. :lol:

Maybe icrementing the version number with bug fix (for example to 17.1) would be good idea.. Would of saved alot of time and forum space. :D

andyk1
Professional
Professional
Posts: 433
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: Wind speed and gusts data wrong in mobile view

Post by andyk1 » Thu Jun 07, 2018 7:32 pm

The bug fix was a minor bug fix not requiring an entire version change and entire download. The fix is posted the same place you downloaded version 17.0 under ummmmm that's it... bug fixes.

quote from readme file

"Replace

pages/lite/index.php

with the one included in this ZIP file."
Image

Post Reply