WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: wvdkuil on March 28, 2019, 12:10:11 PM

Title: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on March 28, 2019, 12:10:11 PM
I coded the Purpleair (PA-II)  and the Luftdaten scripts in a similar way. Probably most questions/problems are similar, so both scripts will be supported in this topic.

PurpleAir  NEW VERSION as of 2019-11-22
Demo: https://weather-template.nl/purpleair/index.html 
Download: https://leuven-template.eu/leuven_download2019.php?id=purpleair
Readme: You will find the read-me pdf in the download, but you can read it here (https://weather-template.nl/purpleair/_readme%20FIRST.pdf) in a new window also.
Known issues:
For extended version2: upload to own website fails nearly always
==> added a fall-back in sensor script by downloading from the purpleair website

Luftdaten
Demo: https://leuven-template.eu/luftdaten/index.html
Download: https://leuven-template.eu/leuven_download2019.php?id=luftdaten
Readme: You will find the read-me pdf in the download, but you can read it here (https://leuven-template.eu/luftdaten/index.html) in a new window also.
Known issues: link will be added when needed

There are two versions of these scripts which both can be accessed and studied from the demo-page.   The "basic version" reads your data form the suppliers database.  A more "extensive version" expects the sensor to upload the row measurements to your own web-server.  This will need more knowledge about http-bypass in your webserver-htaccess file.

Support:
When you post questions about the scripts, please always include the URL (=correct link)  to the script on your website. That reduces the time for answering your questions.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: saratogaWX on March 28, 2019, 01:50:59 PM
Thanks, Wim!
Title: Re: Support of "Leuven" Air Quality scripts
Post by: txweather.org on March 28, 2019, 03:17:02 PM
Thanks again! YAY! :D
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 18, 2019, 11:55:10 AM
Hi wim 
The test1 is working perfect test2 has an Error
https://www.wetterstation-johanngeorgenstadt.de/purpleair/_test2.php
https://www.wetterstation-johanngeorgenstadt.de/purpleair/_test1.php
with your Sensor ID work test2 with mine not why

Stefan
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on November 18, 2019, 12:31:22 PM
Hi wim 
The test1 is working perfect test2 has an Error
https://www.wetterstation-johanngeorgenstadt.de/purpleair/_test2.php
https://www.wetterstation-johanngeorgenstadt.de/purpleair/_test1.php
with your Sensor ID work test2 with mine not why

Stefan
The test2 works when you upload the data from your purpleair sensor. You have to instruct the sensor to do that.
More info; https://www.wetterstation-johanngeorgenstadt.de/purpleair/_readme%20FIRST.pdf => 4. Upload our data

There were / are/ often problems when  the data/ folder to upload into is on an https server

Succes, Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 21, 2019, 05:17:21 AM
Hi Wim,
 
Have do this new and also again, test2 not work
4. Upload our data -> Step by Step
https://www.wetterstation-johanngeorgenstadt.de/sensorpurple2.php -> ok
https://www.wetterstation-johanngeorgenstadt.de/purpleair/_test2.php -> Error, not found the File
it's a Cache thing? I have all do as described,nothing else changed.

Stefan
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on November 21, 2019, 05:52:24 AM
Hi Wim,
 
Have do this new and also again, test2 not work
4. Upload our data -> Step by Step
https://www.wetterstation-johanngeorgenstadt.de/sensorpurple2.php -> ok
https://www.wetterstation-johanngeorgenstadt.de/purpleair/_test2.php -> Error, not found the File
it's a Cache thing? I have all do as described,nothing else changed.

Stefan
I have no idea.
But
1. you should create a data/ folder on your server
2. set line 12 in sensorpurple2.php to comment
Code: [Select]
$save_last_mes  = true;
#$save_last_mes  = false;
3. check if there is anything arriving in the data folder.

The purpleair sensor sends the data to
=> sensorpurple2.php 
==> that script
===> stores the received measurements in an array in the data/ folder 
 and
===> optionally writes the received data into a text file to inspect:   data/last_purple_data_ 14151.json

Also important, did you add https://  before the www in the link in your purpleair sensor?

Success,
Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 21, 2019, 06:15:32 AM
Hi
Thanks have set the new Data Folder now in these Folder: see Attachment
Test2 not work have these also to the Attachment
last_purple_data_14151.json, Ds Store, and purple_24data_14151.arr cannot attach, but there is in the new data Folder

$save_last_mes  = true; -> have set
#$save_last_mes  = false; -> have set

test2 will not work

Stefan
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 21, 2019, 06:28:05 AM
Hi in the json stands :false
array is in attach
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on November 21, 2019, 06:28:22 AM
Hi
Thanks have set the new Data Folder now in these Folder: see Attachment
Test2 not work have these also to the Attachment
last_purple_data_14151.json, Ds Store, and purple_24data_14151.arr cannot attach, but there is in the new data Folder

$save_last_mes  = true; -> have set
#$save_last_mes  = false; -> have set

test2 will not work

Stefan
https://www.wetterstation-johanngeorgenstadt.de/data/last_purple_data_14151.json
==> is there but it has got no or no good data last time is was accessed
===> check if the date /time of that file changes according  to the uploads from purpleair
https://www.wetterstation-johanngeorgenstadt.de/data/purple_24data_14151.arr
==> is there and seems  a correct PHP-array
===> but it can not be accessed by the script https://www.wetterstation-johanngeorgenstadt.de/purpleair/_test2.php
====> so probably the permissions are not correct.

Could you please set the permissions for the data/ folder and alll its contents to #0777 or read/write by world?

Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 21, 2019, 06:35:41 AM
set to 0777 no luck

see:https://www.purpleair.com/data.json?show=14151&key=XRBTRTSYC512PMRC

yes it changed Date+ Time when run sensorpurple2.php
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on November 21, 2019, 06:53:56 AM
set to 0777 no luck

see:https://www.purpleair.com/data.json?show=14151&key=XRBTRTSYC512PMRC

yes it changed Date+ Time when run sensorpurple2.php
https://www.wetterstation-johanngeorgenstadt.de/data/  gives a 403 error, so the permissions are (to) low.
https://www.wetterstation-johanngeorgenstadt.de/data/last_purple_data_14151.json  always contains false, so the data is not (correct) sent by the sensor or other error

Question: did you set https://  or http:// before www.wetterstation. . .   in the purpleair sensor

TODO:
You did put the scripts in purpleair/ws_purpleair2.php  in their own folder.
You then have to change  line 7 in ws_purpleair2.php   from
Code: [Select]
$useOwnDir      = './data/';  to
Code: [Select]
$useOwnDir      = '../data/';  There should be TWO points to tell the script the data folder is 1 level below its own folder.

Wim

Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 21, 2019, 08:27:56 AM
hi Wim
it works but all Data is 0 in there json

https://www.wetterstation-johanngeorgenstadt.de/data/last_purple_data_14151.json
https://www.wetterstation-johanngeorgenstadt.de/purpleair/ws_purpleair2.php
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 21, 2019, 08:41:19 AM
hi Wim
it works but all Data is 0 in there json

https://www.wetterstation-johanngeorgenstadt.de/data/last_purple_data_14151.json
https://www.wetterstation-johanngeorgenstadt.de/purpleair/ws_purpleair2.php

PS registered wih : https
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on November 21, 2019, 08:45:15 AM
hi Wim
it works but all Data is 0 in there json

https://www.wetterstation-johanngeorgenstadt.de/data/last_purple_data_14151.json
https://www.wetterstation-johanngeorgenstadt.de/purpleair/ws_purpleair2.php

The receiving script sets the value 'false"  so that means no data or no correct data received on your webserver..
https://www.wetterstation-johanngeorgenstadt.de/data/last_purple_data_14151.json

Some setting in the purpleair is wrong
or
some communication problem between purpleair and the receiving script.
There were often problems when using https:// servers in the past also.

I have to think how we can test that.

Wim


Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on November 21, 2019, 09:10:31 AM
hi Wim
it works but all Data is 0 in there json

https://www.wetterstation-johanngeorgenstadt.de/data/last_purple_data_14151.json
https://www.wetterstation-johanngeorgenstadt.de/purpleair/ws_purpleair2.php

The receiving script sets the value 'false"  so that means no data or no correct data received on your webserver..
https://www.wetterstation-johanngeorgenstadt.de/data/last_purple_data_14151.json

Some setting in the purpleair is wrong
or
some communication problem between purpleair and the receiving script.
There were often problems when using https:// servers in the past also.

I have to think how we can test that.

Wim

Why is there user:password in the settings in purpleair  header?
Wim
(https://www.wxforum.net/index.php?action=dlattach;topic=36471.0;attach=40403;image)
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 21, 2019, 09:16:48 AM
as in the Instruction say:
At the Key 3 field you enter the exact URL http://www.website.com/sensorpurple2.php
Key4 you type user:password
and Method you leave “Post” as it is

Data Provider #2: Custom
Data Provider #2 URL: http://www.website.com/sensorpurple2.php Data Provider
#2 HEADERS: user:password
Data Provider #2 METHOD: POST
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 21, 2019, 09:19:51 AM
you need the Link to change these settings  per PM?
or give the email to forwarding the Mail from purple air to you
find in pm to you
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 21, 2019, 09:47:52 AM
message (mail) sent to you from here
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on November 21, 2019, 10:56:32 AM
you need the Link to change these settings  per PM?
or give the email to forwarding the Mail from purple air to you
find in pm to you
I have my own Purpleair sensor but it failed uploading to my own server in June, no big problem as I always used the type-1 output on my site. Uploading was only needed when there was a user-problem as you have.

My current purpelair, which is a few years old, shows at the bottom of the sensor page
NTPLOCUPDPAATSATSS3RDTSBTSS3RD
V4.11 2.0+OPENLOG+15833 MB+DS3231+BME280+PMSX003-B+PMSX003-A

I tried all settings possible on the registration page.
With my version it is impossible to sent information to an https or an http site using post, get or put.

The messages arrive, but there is no data in the message, as it was until June this year.
Using $_REQUEST, GET , POST  or 'php://input' returns no data at all.

Maybe your sensor has the same problem,

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on November 22, 2019, 06:55:57 AM
First message is adapted for a new version of the PurpleAir script.

The upload to ones own website seems to fail at 99% of the user-sites
I added a "fall-back" so, when there is no sensor data arriving directly, the sensor script reads the latest sensor-data from the PurpleAir database.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Stegrie on November 22, 2019, 10:16:55 AM
First message is adapted for a new version of the PurpleAir script.

The upload to ones own website seems to fail at 99% of the user-sites
I added a "fall-back" so, when there is no sensor data arriving directly, the sensor script reads the latest sensor-data from the PurpleAir database.

Wim

Now works with Version 2 many thanks Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: marko30 on January 26, 2020, 03:15:25 PM
For me _test2 is working ok, but saratoga page not.

https://okroglovreme.com/wxAqLuft.php (https://okroglovreme.com/wxAqLuft.php)
https://okroglovreme.com/luftdaten/ws_luftdaten2.php (https://okroglovreme.com/luftdaten/ws_luftdaten2.php)

what is correct record in setting?

$userSensor     = 'esp8266-XXXXXX'
or
$userSensor     = 'XXXXXX'


any toughts?
thx.
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on January 27, 2020, 01:17:33 PM
For me _test2 is working ok, but saratoga page not.
https://okroglovreme.com/wxAqLuft.php (https://okroglovreme.com/wxAqLuft.php)
https://okroglovreme.com/luftdaten/ws_luftdaten2.php (https://okroglovreme.com/luftdaten/ws_luftdaten2.php)
what is correct record in setting?
$userSensor     = 'esp8266-XXXXXX'
or
$userSensor     = 'XXXXXX'
any toughts?
thx.
I am on vacation with insufficient internet. The sensor in your case is the displayed in the test2 page, I think 38115

I will check it when I am back Feb 1/2 depending on some strikes.

Wim

Edited Febr 1: Seems working correctly now.  Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: plex on February 23, 2020, 05:40:44 AM
Thanks for yet a great script from Leuven [tup] =D>

I've got everything working, except the "Luftdaten map" inside the "my_AqhiLuft2Page.php". I've found other Leuven templates, where it's actually working, so I suspect I didn't do everything correct #-o Anyways there are only 4 Luftdaten users visible on the map in Denmark.

Could it be a path related problem? I've copied the files to weather28/_my_scripts dir, and kept the data dir in weather28/luftdaten/data. The graphs didn't work before changing the path to:
# ----------  we load our own sensor to our site
$useOwnDir      = './luftdaten/data/'; 

As I understand from the readme file, I shouldn't be necessary, to change path if I use weather28/ for the template?

https://www.vejrstationen.dk/weather28/index.php?p=mnu_aqhi_luft&wp=MB&lang=en (https://www.vejrstationen.dk/weather28/index.php?p=mnu_aqhi_luft&wp=MB&lang=en)
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on February 23, 2020, 06:00:54 AM
Thanks for yet a great script from Leuven [tup] =D>

I've got everything working, except the "Luftdaten map" inside the "my_AqhiLuft2Page.php". I've found other Leuven templates, where it's actually working, so I suspect I didn't do everything correct #-o Anyways there are only 4 Luftdaten users visible on the map in Denmark.

Could it be a path related problem? I've copied the files to weather28/_my_scripts dir, and kept the data dir in weather28/luftdaten/data. The graphs didn't work before changing the path to:
# ----------  we load our own sensor to our site
$useOwnDir      = './luftdaten/data/'; 

As I understand from the readme file, I shouldn't be necessary, to change path if I use weather28/ for the template?

https://www.vejrstationen.dk/weather28/index.php?p=mnu_aqhi_luft&wp=MB&lang=en (https://www.vejrstationen.dk/weather28/index.php?p=mnu_aqhi_luft&wp=MB&lang=en)
chrome right click => inspect => console => errors  => A "mixed content" problem.
Quote
Mixed Content: The page at 'https://www.vejrstationen.dk/weather28/index.php?p=mnu_aqhi_luft&wp=MB&lang=en' was loaded over HTTPS, but requested an insecure frame 'http://deutschland.maps.luftdaten.info/#6/55.899269/8.516578'. This request has been blocked; the content must be served over HTTPS.
Adapt the link from http://deutschland.maps.luftdaten.info to https://
Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: plex on February 23, 2020, 06:11:42 AM
Thanks for yet a great script from Leuven [tup] =D>

I've got everything working, except the "Luftdaten map" inside the "my_AqhiLuft2Page.php". I've found other Leuven templates, where it's actually working, so I suspect I didn't do everything correct #-o Anyways there are only 4 Luftdaten users visible on the map in Denmark.

Could it be a path related problem? I've copied the files to weather28/_my_scripts dir, and kept the data dir in weather28/luftdaten/data. The graphs didn't work before changing the path to:
# ----------  we load our own sensor to our site
$useOwnDir      = './luftdaten/data/'; 

As I understand from the readme file, I shouldn't be necessary, to change path if I use weather28/ for the template?

https://www.vejrstationen.dk/weather28/index.php?p=mnu_aqhi_luft&wp=MB&lang=en (https://www.vejrstationen.dk/weather28/index.php?p=mnu_aqhi_luft&wp=MB&lang=en)
chrome right click => inspect => console => errors  => A "mixed content" problem.
Quote
Mixed Content: The page at 'https://www.vejrstationen.dk/weather28/index.php?p=mnu_aqhi_luft&wp=MB&lang=en' was loaded over HTTPS, but requested an insecure frame 'http://deutschland.maps.luftdaten.info/#6/55.899269/8.516578'. This request has been blocked; the content must be served over HTTPS.
Adapt the link from http://deutschland.maps.luftdaten.info to https://
Wim

 #-o

Thanks for helping



Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on March 07, 2020, 10:50:42 AM
Hi There,

Great script, but I am having trouble using my own data via "ws_luftdaten2.php".

I used the "_test2.php" program and got the following error:

Warning: file_get_contents(./luftdaten/data/luft_24data_esp8266-14900835.arr): failed to open stream: No such file or directory in /homepages/27/d801236146/htdocs/luftdaten/ws_luftdaten2.php on line 108

There is no data in the ./luftdaten/data/ directory on the server, and I am not sure what to put in the sensor Configuration under "Own API".

I am using a Saratoga script and my domain is https://www.wraxallweather.co.uk/wxindex.php

The wxAqLuft.php  is in the root directory and the other script files are under /luftdaten/

Any idea what I am doing wrong?

Thanks
Dave
 
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on March 07, 2020, 11:18:37 AM
Hi There,

Great script, but I am having trouble using my own data via "ws_luftdaten2.php".

I used the "_test2.php" program and got the following error:

Warning: file_get_contents(./luftdaten/data/luft_24data_esp8266-14900835.arr): failed to open stream: No such file or directory in /homepages/27/d801236146/htdocs/luftdaten/ws_luftdaten2.php on line 108

There is no data in the ./luftdaten/data/ directory on the server, and I am not sure what to put in the sensor Configuration under "Own API".

I am using a Saratoga script and my domain is https://www.wraxallweather.co.uk/wxindex.php

The wxAqLuft.php  is in the root directory and the other script files are under /luftdaten/

Any idea what I am doing wrong?

Thanks
Dave

I am a little bit confused about which version this is, I could not find the readme
https://leuven-template.eu/luftdaten/_readme%20FIRST.pdf  => second page.
You have to setup your sensor to upload the data to your own webserver first

The hardware used in the luftdaten sensor does not always allow to upload to https servers.

Succes, Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on March 07, 2020, 11:26:11 AM
Hi Wim,

the "ws_luftdaten2.php" file says version "4.00 2018-07-20"

What do I put in the Server Box in the Configuration?

I put my domain name minus the "http://" part.

Is this wrong?

Thanks Dave.

Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on March 07, 2020, 01:00:03 PM
Hi Wim

Ok, Fixed it by changing the privileges on the /luftdaten/data and /luftdaten directories on the website.

Dave
Title: Re: Support of "Leuven" Air Quality scripts
Post by: blainec on March 18, 2020, 11:20:37 PM
Hi There,

Great script, but I am having trouble using my own data via "ws_luftdaten2.php".

I used the "_test2.php" program and got the following error:

Warning: file_get_contents(./luftdaten/data/luft_24data_esp8266-14900835.arr): failed to open stream: No such file or directory in /homepages/27/d801236146/htdocs/luftdaten/ws_luftdaten2.php on line 108

There is no data in the ./luftdaten/data/ directory on the server, and I am not sure what to put in the sensor Configuration under "Own API".

I am using a Saratoga script and my domain is https://www.wraxallweather.co.uk/wxindex.php

The wxAqLuft.php  is in the root directory and the other script files are under /luftdaten/

Any idea what I am doing wrong?

Thanks
Dave

I'm getting the same error. Checked Permissions, and everything looks OK

https://weatheryyc.com/pwsTEST/luftdaten/_test2.php
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on March 20, 2020, 02:57:14 PM
. . .  shortened . . .
I'm getting the same error. Checked Permissions, and everything looks OK
https://weatheryyc.com/pwsTEST/luftdaten/_test2.php
Readme: https://weatheryyc.com/pwsTEST/luftdaten/_readme%20FIRST.pdf

Code: [Select]
Warning: file_get_contents(./data/luft_24data_esp8266-14321313.arr): failed to open stream:
No such file or directory in C:\Abyss Web Server\htdocs\pwsTEST\luftdaten\ws_luftdaten2.php on line 106

Maybe: When running a https website the small processor in the sensor will often not be able to upload data.
Therefor when the receiving script does not get any data, it will not create the file needed to display 24-hour data.

Or: Did you give the   pwsTEST/luftdaten/data/ folder the highest permissions?
So is a www script such as pwsTEST/luftdaten/sensorluft2.php  allowed to write data ?

Or: Maybe the script is incompatible with a windows server, but I can not test that myself.

Wim



Title: Re: Support of "Leuven" Air Quality scripts
Post by: blainec on March 21, 2020, 12:13:00 AM
I tested on a HTTP server and it works. Now to find a way around this.
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on April 28, 2020, 11:01:51 AM
Hi Wim,

According to my https://www.wraxallweather.co.uk/wxAqLuft.php (https://www.wraxallweather.co.uk/wxAqLuft.php) script, the latest reading I have was for 26/04/2020 16:03, two days ago.

The readings are still going to luftdaten site and the graphs are still being updated.

Nothing at this end has changed but the "luft_24data_esp8266-14900835.arr" file in /luftdaten/data has stopped updating.

Any idea where the problem might be?

I have the "Particulate Matter App" on my phone and everything is working there.

Thanks in advance,

Dave
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 28, 2020, 11:52:30 AM
Hi Wim,

According to my https://www.wraxallweather.co.uk/wxAqLuft.php (https://www.wraxallweather.co.uk/wxAqLuft.php) script, the latest reading I have was for 26/04/2020 16:03, two days ago.

The readings are still going to luftdaten site and the graphs are still being updated.
So the sensor is still functional, although there are gaps.
The luftdaten site is a different site as the graphs are coming from
=> https://www.madavi.de/sensor/images/sensor-esp8266-14900835-sds011-1-day.png
Quote
Nothing at this end has changed but the "luft_24data_esp8266-14900835.arr" file in /luftdaten/data has stopped updating.
Any idea where the problem might be?
I have the "Particulate Matter App" on my phone and everything is working there.
I am not familiar with that app. But I assume that  app will not get its data from your webserver  file "luft_24data_esp8266-14900835.arr" but from another source.
Quote
Thanks in advance,
Dave

Most luftdaten sensors are not able to upload to a https website.
Or they can not use a 301 from your server.
Maybe you switched to https or changed htaccess since April 26?

Checking the map https://deutschland.maps.sensor.community/#12/51.4468/-2.7439  I think your sensor number is 33862
The new luftdaten website: https://data.sensor.community/airrohr/v1/sensor/33862/
That sensor is also updating correctly.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on April 28, 2020, 12:11:15 PM
Yes,

You are right, I did fix my .htaccess file to force everything to https

There is an option in the sensor configuration to send with HTTPS, does it not work?

If it doesn't then I will have to remove the script.

Dave.
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 28, 2020, 12:19:30 PM
Yes,

You are right, I did fix my .htaccess file to force everything to https

There is an option in the sensor configuration to send with HTTPS, does it not work?

If it doesn't then I will have to remove the script.

Dave.
It could work if it is a newer board used. But you need to change the sensor configuration also. Default it uses port 80.
https://leuven-template.eu/luftdaten/_readme%20FIRST.pdf  => point 4.2

I am not familiar with the latest "sensor configuration" as my luftdaten is very old.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on April 28, 2020, 12:50:00 PM
Hi Wim,

I have put everything back as it was before and it is now all working again.

I can't leave it in this state, moving to https will soon be a must.

 [ You are not allowed to view attachments ]

Dave.
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 28, 2020, 12:54:09 PM
Hi Wim,

I have put everything back as it was before and it is now all working again.

I can't leave it in this state, moving to https will soon be a must.

 [ You are not allowed to view attachments ]

Dave.
This works for me in the htaccess
Code: [Select]
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{QUERY_STRING} htp
RewriteCond %{QUERY_STRING} d
RewriteRule ^.*$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} off
RewriteCond %{QUERY_STRING} !htp
RewriteCond %{QUERY_STRING} !d
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on April 29, 2020, 04:11:11 AM
Hi Wim,

I just tried your .htaccess example, the luftdaten data file stopped coming to the /luftdaten/data directory.

The file updated as soon as I put the original .htaccess file back.

 ](*,)

Dave
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 29, 2020, 04:19:50 AM
Hi Wim,
I just tried your .htaccess example, the luftdaten data file stopped coming to the /luftdaten/data directory.
The file updated as soon as I put the original .htaccess file back.
 ](*,)
Dave
Yes, I see.
You screenshot shows for path:
Code: [Select]
/luftdaten/sensorluft2.php?change that to
Code: [Select]
/luftdaten/sensorluft2.php?htpIncoming request at the htaccess file
will change the request from https to http if the query string has a variable with the name htp
and
will leave the http as is, if the query string contains htp

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on April 29, 2020, 04:34:33 AM
Hi Wim,

I have uploaded the .htaccess file with your example and changed the luftdaten config as you suggested,

and now it is working.

Your a Star.  [tup]

Thanks, Dave
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on May 04, 2020, 05:32:08 AM
Hi Wim,

I am getting a 403 error on the graphs on the wxAqLuft.php page.

I see that they are missing on many other sites with this script. I have removed the graphs from my page at the moment.

Regards,

Dave
Title: Re: Support of "Leuven" Air Quality scripts
Post by: pimohdaimaoh on May 18, 2020, 05:36:35 AM
Hi Wim,
I just tried your .htaccess example, the luftdaten data file stopped coming to the /luftdaten/data directory.
The file updated as soon as I put the original .htaccess file back.
 ](*,)
Dave
Yes, I see.
You screenshot shows for path:
Code: [Select]
/luftdaten/sensorluft2.php?change that to
Code: [Select]
/luftdaten/sensorluft2.php?htpIncoming request at the htaccess file
will change the request from https to http if the query string has a variable with the name htp
and
will leave the http as is, if the query string contains htp

Wim


Hello WIM,

Again thank you for ur scripts for AQI, but recently the png files that linked from the server is somewhat restricted, the result is my page is UNABLE to view the graph files http://www.pimohweather.com/wxLuftdatenAQI.php

I also checked your DEMOs and its the same. i check directly from MADAVI site to see its path, in can be viewed there but not during linked to my site it says "You don't have permission to access /sensor/images/sensor-esp8266-4390696-sds011-1-day.png on this server."

I hope there still a way to make this viewable on our pages.

Thanks and Regards

-Mike-
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on May 18, 2020, 05:52:31 AM
Hi There,

I gave up on those graphs on the MADAVI site.

I wrote a script to write the sensor JSON file to an SQL database, then displayed them with JPGraphs.

(http://[attachment id=1 msg=405949][/attachment])   The spike on the graph is the result of a large fire at a Premier Inn, 12 miles away to the North East.

Only done the day plot at the moment as I only have 4 days in an SQL database.

Dave
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on May 18, 2020, 06:16:46 AM
Hi Wim,
I am getting a 403 error on the graphs on the wxAqLuft.php page.
I see that they are missing on many other sites with this script. I have removed the graphs from my page at the moment.
Regards, Dave
Hello WIM,
Again thank you for ur scripts for AQI, but recently the png files that linked from the server is somewhat restricted, the result is my page is UNABLE to view the graph files http://www.pimohweather.com/wxLuftdatenAQI.php
. . .  shortened. . .
The madavi graphs are not available anymore for deep-linking.  And the page itself from Madavi can not be used in a iFrame either.

leider haben es einige Nutzer mit der Einbindung der Grafiken übertrieben und erzeugen damit eine extrem hohe Last auf dem Server.
Wir mussten daher die Einbindung auf externen Webseiten unterbinden. Die Grafiken sind nur noch direkt auf Madavi.de abrufbar.


translated by google
unfortunately some users have it with the integration of the graphics exaggerated and thus create an extremely high load on the server.
We therefore had to prevent the integration on external websites. The Graphics can only be called up directly on Madavi.de.


I removed those pages also for my own websites. You can easily switch any sub-page  on/off in the settings of the scripts.
Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: pimohdaimaoh on May 20, 2020, 04:36:49 AM
Hi There,

I gave up on those graphs on the MADAVI site.

I wrote a script to write the sensor JSON file to an SQL database, then displayed them with JPGraphs.

(http://[attachment id=1 msg=405949][/attachment])   The spike on the graph is the result of a large fire at a Premier Inn, 12 miles away to the North East.

Only done the day plot at the moment as I only have 4 days in an SQL database.

Dave

Hello,

We hope you could share your script with weekly, monthly and yearly since the MADAVI png files are resticted, I cant report to our local environment AQI reports due to this.

regards

-Mike-
Title: Re: Support of "Leuven" Air Quality scripts
Post by: pimohdaimaoh on May 20, 2020, 04:41:42 AM
Hi Wim,
I am getting a 403 error on the graphs on the wxAqLuft.php page.
I see that they are missing on many other sites with this script. I have removed the graphs from my page at the moment.
Regards, Dave
Hello WIM,
Again thank you for ur scripts for AQI, but recently the png files that linked from the server is somewhat restricted, the result is my page is UNABLE to view the graph files http://www.pimohweather.com/wxLuftdatenAQI.php
. . .  shortened. . .
The madavi graphs are not available anymore for deep-linking.  And the page itself from Madavi can not be used in a iFrame either.

leider haben es einige Nutzer mit der Einbindung der Grafiken übertrieben und erzeugen damit eine extrem hohe Last auf dem Server.
Wir mussten daher die Einbindung auf externen Webseiten unterbinden. Die Grafiken sind nur noch direkt auf Madavi.de abrufbar.


translated by google
unfortunately some users have it with the integration of the graphics exaggerated and thus create an extremely high load on the server.
We therefore had to prevent the integration on external websites. The Graphics can only be called up directly on Madavi.de.


I removed those pages also for my own websites. You can easily switch any sub-page  on/off in the settings of the scripts.
Wim


I see it now so no choice, I should find alternative to view its graph then. Thanks for Clarification.


Regards

-Mike-
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on May 20, 2020, 04:49:54 AM
Hi There,

Before we can start, do you have the user sensor file coming to your /luftdaten/data directory on your server?

it will look like "luft_24data_esp8266-14900835.arr"

Regards,
Dave.
Title: Re: Support of "Leuven" Air Quality scripts
Post by: pimohdaimaoh on May 20, 2020, 08:12:22 AM
Hi There,

Before we can start, do you have the user sensor file coming to your /luftdaten/data directory on your server?

it will look like "luft_24data_esp8266-14900835.arr"

Regards,
Dave.

Hello, yes I have that exactly but I temporarily disabled it because im using WIM's script that directly reads data from luft servers


Regards

-Mike-
Title: Re: Support of "Leuven" Air Quality scripts
Post by: WraxallDave on May 20, 2020, 08:40:03 AM
Hi Mike,

First task is to read that sensor file, I modified Wim's "Saratoga" script to read the sensor file.

Then wrote a script to run as a cron to load the data into an SQL database.

There are several graph/chart packages that can be used to display SQL data, I like JPGraphs, but you could use HighCharts.

I can help with reading the sensor file  and the SQL load script, but explaining graph packages would take forever. There is a lot on the forum about using these packages.

If you would like to go down the route of getting the data into an SQL database, let me know?

Cheers,

Dave
Title: Re: Support of "Leuven" Air Quality scripts
Post by: pimohdaimaoh on May 23, 2020, 08:43:50 AM
Well not bad i INSTEAD USE its gaffana graphs, however the monthly and yearly graphs are not available so still need to redirect to MADAVI site for it, but at least I got daily graphs