Page 3 of 6
Re: wBox (weather box) in JSON version
Posted: Fri 21 May 2021 5:22 am
by Smarmen
I remembered why I needed to use a file instead of a direct API call.
You did great
I use two Lenovo 10'' tablets - I have one in my office (vertical version), the other in the kitchen (horizontal version).
Indeed - at 7'' it is quite tight.
Yesterday I also improved the windosock animation - now it refers to latest wind speed, not the average.
Now I spend most of my time working in the garden and repairing devices
Kris
Re: wBox (weather box) in JSON version
Posted: Fri 21 May 2021 10:02 am
by Smarmen
Hi Paul
There is a saying:
the devil is in the details.
You are posting links to the sites, but tell me:
WHY have You got MY weather forecast there? Why in the wBoxIni.js file you did not enter your coordinates and correct the shortcuts accordingly the names of the days of the week? I write about it in the documentation
http://www.andreovia.pl/jedrzejow-pogoda/wbox#wbox_en
If you have more of these simplifications, maybe that's where the different problems come from?
Have a nice day
Re: wBox (weather box) in JSON version
Posted: Fri 21 May 2021 1:30 pm
by PaulMy
Hi Kris, and thanks for your follow up.
You hit the nail with the first blow, but...
When I last updated a couple of days ago I FTP the unzipped files before editing, which naturally then showed your default information.
Then yesterday morning I noticed the wrong
days abbreviation so edited wBoxini.js as follows:
Code: Select all
/*!
* configuration file for wBox.js library
* © 2014-2021 {:Krzysiek Maziarz
*/
/* global coLATI, coLONG, wekDay, FENtmp, FENprs, FENspd, FENdrA, FENdrB, bigPrs, */
// SET coordinates to Your place
coLATI = 42.960000; // latitude
coLONG = -81.438055; // longitude
// SET short names days of the week: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
wekDay = ['Su','Mo','Tu','We','Th','Fr','Sa'];
// configuration (change consciously!)
// --------------------------------------
// calculation of values for FEN'48 Alert
FENtmp = 2.5; // multiplier of Temperature Rise
FENprs = 10; // Pressure drop [hPa]
FENspd = 23; // Wind speed, at least
FENdrA = 135; // Wind direction [˚] From
FENdrB = 315; // Wind direction [˚] To
// calculation of values for Big Pressure Changes Alert
bigPrs = 14; // Pressure change the day after tomorrow [hPa]
and FTP the file.
But the updated file does not show when I open or refresh the sites, which is the same with the data not being updated even though the realtime.txt and realmore.txt files are being updated regularly. I have checked several times to make sure that I have FTP the edited file.
Even today when I use URL
https://www.komokaweather.com/cumulusmx/realtime.txt I get yesterday's data but when I add a variable like
https://www.komokaweather.com/cumulusmx ... t?20210521 then the realtime.txt displays current data. But as of this morning for me both H3 and V2 versions still show the old time in Chrome, FF and Chrome.
I am pretty sure wBox is working fine and set up correctly, just the continued caching causing an outdated web view. My call to GoDaddy is still pending...
Enjoy,
Paul
Re: wBox (weather box) in JSON version
Posted: Fri 21 May 2021 6:12 pm
by Big Daddy
I spent some time today trying to work out why my brothers forecast, the one with the Kindle Fire, was showing abnormal readings, particulary wind speeds. I looked and looked and then looked some more and could not find a reason. I then decided to check the lat / long co-ordinates using Google Maps.
I forgot that his long co-ordinate should be a negative number as he is west of the Greenwich meridian line and I had forgot to put a "-" in front of the co-ordinate. When I plotted his co-ordinates in Google maps we were receiving the forecast for a location in the North Sea and not in Leeds, Yorkshire where he lives.
All sorted now.
Re: wBox (weather box) in JSON version
Posted: Fri 21 May 2021 7:02 pm
by Smarmen
Andy, this is actually a pretty good idea
Instead of worrying that the weather forecast is inaccurate, just change the coordinates and boom
We have a beautiful perspective right away, and it's free
I have to add a button there:
show better forecast
Enjoy
Re: wBox (weather box) in JSON version
Posted: Wed 02 Jun 2021 10:39 am
by Big Daddy
A quick question for some help on a very minor details, just need a pointer to help me work it out.
The 6-hour icon change over should be at 6am, midday, 6pm and midnight. However, as we are now in BST (GMT+1) the changover seems to be happening at 5am, 11am, 5pm and 11pm. The json file seems to have times provided in GMT (Zulu) hours which ties up with the changes I am seeing. Its no big issue but trying to work out in the code where I can try and create an offet so if in GMT+1 it adds an hour and if GMT it uses the json. The simple answer is if time is GMT+1 then add an hour, if not do not adjust the time.
Andy
Re: wBox (weather box) in JSON version
Posted: Wed 02 Jun 2021 11:31 am
by Smarmen
Ooooo
Oh, I didn't foresee that
I'll see what I can do and write in the evening
Kris
Re: wBox (weather box) in JSON version
Posted: Wed 02 Jun 2021 4:25 pm
by Smarmen
Andy,
There is also a wHARf.html file in the wBox.xip file for observing variable values.
Where can I see it at your place?
Re: wBox (weather box) in JSON version
Posted: Wed 02 Jun 2021 4:48 pm
by Big Daddy
Hi,
I didnt have it originally but I have put it here.
http://midlifedad.me.uk/wBox/wVARf.html
Please remember I do not do things the same way
I use slightly different methods to get the forecast, I just call the json file using my pi every 5 minutes and then read that file. Its a slightly different way but the results are the same. I had to find a new way to get over issues with Amazon Fire and rather than maintain 2 different methods I went this way.
Andy
Re: wBox (weather box) in JSON version
Posted: Thu 03 Jun 2021 6:20 am
by Smarmen
OK Andy, your way is very good
It seems to me that this may be a misunderstanding, so please analyze the situation again.
The forecast icons for intervals
from number TWO turn on at 6, 12, 18 and 24, respectively.
It is different for the first interval:
the icon (and the forecast) changes every hour and always applies to the next six hours following the current time!
For example, if it is now 8:07 AM, the forecast is for the next six hours starting at 09:00 AM.
The JS module compares reads the value of the current time and looks for appropriate values according to such a scheme.
Code: Select all
var Dhur = ((new Date().getHours()) * 1); // forecast time
...
var Fhur = (value.time.substr(11, 2) * 1); // current time
These two values (
Dhur &
Fhur) affect the search for the forecast for the appropriate hour.
The easiest way to do this is to add or subtract one hour from the variable OR new variable that takes the time offset.
Have a nice day
Kris
Re: wBox (weather box) in JSON version
Posted: Thu 03 Jun 2021 11:02 am
by Big Daddy
Hi Kris,
Maybe my understanding but please take a look at the 2 images in the zip file. I understand about the first interval (the one I have under my temperature section in the top left).
If you look at the 6-hourly forecast in the bottm right you can see that in image "pre-11" first time period it shows image _iFint2, which I would expect as this time period is for time 6 to 12. Now in image "post-11" the image changes to _iFint3 which should be period 12 to 18 but its not 12 yet.
Am I missing something here. I may fire up my previous wBox which used the xml forecast and see if this happens there as well. Maybe it was always like that and I just never noticed.
Andy
Re: wBox (weather box) in JSON version
Posted: Thu 03 Jun 2021 1:33 pm
by Smarmen
Andy, you're right
This is my mistake, thank you for being careful!
I "looped" somewhere and I don't know why I was adding 1 hour to the conditions.
Code: Select all
// warunku selekcji danych do wBox
// Andy saw a bug
// if (((Fmon === Dmon) && (Fhur === Dhur + 1))
// || ((Fmon === Dmon) && (Fhur > Dhur + 1) && (Fhur === 0 || Fhur === 6 || Fhur === 12 || Fhur === 18))
if (((Fmon === Dmon) && (Fhur === Dhur))
|| ((Fmon === Dmon) && (Fhur > Dhur) && (Fhur === 0 || Fhur === 6 || Fhur === 12 || Fhur === 18))
|| ((Fmon > Dmon && fcsID <= fcsMX) && (Fhur === 0 || Fhur === 6 || Fhur === 12 || Fhur === 18)))
In other words, in wBox.js you have to replace
Dhur + 1 with
Dhur
I changed everything in the wBox.zip download file.
By the way: I used your idea for the moonphase image
Many thanks
Kris
Re: wBox (weather box) in JSON version
Posted: Fri 04 Jun 2021 8:04 am
by Big Daddy
Hi Kris.
Sorry I am late getting back to you, normal life gets in the way sometime.
Thank you for the fix. I will make the changes this morning.
Andy
Re: wBox (weather box) in JSON version
Posted: Fri 04 Jun 2021 5:20 pm
by Big Daddy
Thanks Kris,
Works perfectly.
Andy
Re: wBox (weather box) in JSON version
Posted: Fri 04 Jun 2021 6:38 pm
by Smarmen
It's my pleasure
Now I can safely build ... another house. Little house in the big garden, I called it Hut the Pooh