***closed*** weather34 for WeatherDisplay (clientraw and WDapi)

Thanks Wim.

I checked my settings and you were correct I had set WDapi to upload to the database, I have now changed it to ‘stationcron job will the database load’ - however I am still having issues.

I think I understand how it works now, I originally had WDapi to upload to the database and I could see the data coming into my SQL table on 1 minute intervals (but obviously not populating the .csv files). Since I have changed to the cronjob load option, nothing is coming into my SQL table. It seems like the cronjobs in WD are not running. If I manually run the following link, it will work but nothing is happening in WD.

http://micklehamweather.com/pwsWD/w34_cron_stationcron.php

I have checked and double checked the links in WD but I can’t seem to work it out why it won’t work. I have included some of my settings, maybe I have missed something!

Re the sun block on my site, I have checked my settings and they match what you had suggested so again I am not sure what has happened there!

I have attached a copy of what I can currently see.

Thanks again for your help with this.

Neil


Sun Capture.PNG

The WDapi works fine, so you can set that to upload the SQL table.

I agree that it seems the cron-jobs are not running as they should. They run OK when manually started. But they do not appear to be run by WD.
Please check first if there are no spaces or other strange characters before or after the cron links.
If all seems OK on your end, contact Brian Hamilton maybe he can see in the logs what the problem is.

Re the sun block on my site, I have checked my settings and they match what you had suggested so again I am not sure what has happened there! I have attached a copy of what I can currently see. Thanks again for your help with this. Neil
The problem with the sun-block is not something you can see. Only visitors from another timezone see a strange circle. Attached a screenshot hot is looks when I visit your site

Wim


Thanks Wim - all good now, I have it working!

The issue was a leading blank space at the start!! It was hard to spot - but now that I have noticed it, it’s quite obvious…sorry! :oops:

Neil

Hi Neil,

Thank you! I had same problem and could not find it.
Solved!

Brgds,
Oebel

I’m having a problem using wdapi.

It seems to be set correctly, but when I press the test in WD I get “Success: Bad data”. and the database does not get updated.

This is what I get when I manually execute wdapi:

Notice: Undefined variable: file_contents in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 71

Notice: Undefined offset: 2 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 74

Notice: Undefined offset: 10 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 75

Notice: Undefined offset: 9 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 76

Notice: Undefined offset: 39 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 77

Notice: Undefined offset: 6 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 78

Notice: Undefined offset: 5 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 79

Notice: Undefined offset: 41 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 80

Notice: Undefined offset: 4 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 81

Notice: Undefined offset: 8 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 82

Notice: Undefined offset: 7 in C:\Abyss Web Server\htdocs\pwsWD\w34_WDapi.php on line 83
Bad Data:


Capture2.PNG

Step 1: save the uploaded data which is put after the URL by WD in the form URL?d=all_your_data_fields
The first part of the return message “succes” signals that some data (at least 50 characters) was received and is saved as a text-string for later use
2. Then the WDapi checks if a database exits “If not” the script ends.
You have set you will use a database so the settings are read to check if WDapi needs to upload to the database
The database name, password a.s.o. are checked if they are not empty, if empty the script ends without a message.
Then it checks if “WDapi or the cronjob” must upload. If the cronjob should do it => no message and the WDapi script ends.

  1. The WDapi script connects to the database, in your case the connection is OK, otherwise there would have been an error message

  2. The fields for the database are created from the text string
    AND NOW the data is inserted in the database

$result = mysqli_query($conn,"INSERT INTO weatherstation(time, outsideTemp, barometer, raintoday, UV, windgust, windSpeed, radiation, dewpoint, rainrate, direction, date, lightning)
VALUES('$updated', '$temp', '$barometer', '$raintoday', '$uv', '$windgust', '$windspeed', '$solar', '$dewpoint', '$rainrate', '$direction', '$date', '$lightning')");	
if ($result == false) 
     { die ('Bad Data: '. mysqli_connect_error()); }

The only thing which does not works is the insert, probably the credentials for the userid are set to low.
I will read the documentation to find a better clue what is wrong, as the error message displayed is empty, try the attached replacement script
Use PHPADMIN or your cPanel and give this weather34 user all credentials possible.

Check http://wd34.weather-template.com//documentation/WD34-SQL-2019-01.pdf point 2.1: you could try load some data with PHPadmin, just to see if there is an error message.

When you use the WDapi in your browser you get those messages as the fields are not available URL?d=all_your_data_fields


w34_WDapi.php.zip (2.21 KB)

with your new script I now get an error number 1366


Capture.PNG

OK, it was the UV value which was causing the problem.
Please test this version,
Wim


w34_WDapi.php.zip (2.24 KB)

Hi Wim,

Can you tell me what the little temperature below the main temperature is supposed to represent (see attachment)? I assume it some kind of trend, however mine seems to be way off and it has been like this since the start. How is this calculated?

If it helps, here is a link to my site.

http://micklehamweather.com/pwsWD/

Thanks,
Neil


Capture 1.PNG

Compare your site with the demo-site. It should be the temperature trend.
Most of the times it should be between -1 and + 1.
The script compares “current temp” with “temp 15 minutes” ago.
But you WD file as uploaded contains 2 extra spaces.
All fields after these two spaces are misaligned and current temp is now compared to lowest dewpoint today.

Please update to the latest WD release as this is an old problem.
Or use clientraw.txt for your data.

Why do I always ask for the link to the site?
To check a lot of values with this script: http://micklehamweather.com/pwsWD/w34_module_test.php
One can check the calculated “Live data values” or the WDapi values with the field-names.
All the uploaded files, as long as they are in the default folders, can also be inspected this way.
And any individual script can be run with error-reporting on.
Wim

Thanks again Wim - I have updated to the latest version of WD and it is working fine.

Neil

Silly trivial question: why are the legends (data source, hardware, etc.) not automatically centred? Is that css too?

Legend1 is my site, legend2 is your test site - viewed in Chrome.


In w34_easyweathersetup I have used this link to my webcam image: ./webcam/aad-axis-01.jpg?
Nothing is shown under “Live Web Cam” rectangle.
If I select “Live Web Cam” link at the bottom the static webcam image pops up.
Any idea what I’m doing wrong?

What is requirements for showing webcam image?
Can we add a url to the webcam when using an IP camera? Should we use http://xxx or just add fqdn?
When using an image what is the size requirements (X x Y pixels)?

the web cam Q was asked and answered further up in this thread

Please always the URL to your pwsWD folder. I had to scan your previous posts to find the URL.

Yes, it is in the CSS and the three lines itself are centred. But the block with the three is not centred in the footer.
It only has a 75px left margin to not interfere with the images on the left.

As I have a longer third line it only looks like the block with the three lines is centred.
Adapting the CSS is a not so trivial task for the April release.

Wim

The previous post recommends: “You set the link to “…/webcam/image.jpg” which is 100% correct”
This is what I have done by specifying …/webcam/aad-axis-01.jpg , but on an “X weathercam” is shown in rectangle for Live Web Cam

ls -l webcam
total 156
-rw------- 1 weather weather 158374 Jan 17 09:26 aad-axis-01.jpg


After posting the previous message I discovered my error: owner user and group was incorrect.
Now it is working

It’s working now. Thank you

Hi Wim,

Sorry I have another question, this maybe a bug or a lack of understanding on my part. Currently I have an AQI reading on my site of 99 - this is based on the nearest AQ station (for me it’s Footscray, Australia). If I go to the link for this station the AQI is actually 35 - see link below.

I have then checked the output for my AQI in the module_test page, I can see the reference of an AQI of 35, but nothing for 99. How is the 99 generated? Maybe I am wrong, but I assumed my site should be showing the same AQI as the source, which is 35.

The link to my site is,

https://micklehamweather.com/pwsWD/

Thanks,
Neil


Capture AQ 2.PNG

Capture AQ.PNG

Thank you, added future code for test and did not remove all before release :oops: A new version is attached.

One can check the files itself by using this script: https://micklehamweather.com/pwsWD/w34_module_test.php
Just use list contents and select “./jsondata/gov_aqi.txt” it shows all data (also in json).
Wim


gov_aqi_block.php.zip (3.1 KB)

Thanks Wim - it