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
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Sperber on August 21, 2020, 12:51:06 PM
Hi Wim,
i like your skript for purpleair,
and i have a little problem..

https://wetter.priesterath.net/purpleair/_test2.php

I would like only the page with all the data first. Otherwise I always have to click on more.
I just can't do it.  :roll:

Thx Sperber

Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on August 21, 2020, 01:08:40 PM
Hi Wim,
i like your skript for purpleair,
and i have a little problem..

https://wetter.priesterath.net/purpleair/_test2.php

I would like only the page with all the data first. Otherwise I always have to click on more.
I just can't do it.  :roll:

Thx Sperber
Most people only want a low (small)  block on their page. So default the condensed data is used with a button to extend.

Script ws_purpleair2.php  lines 360-361 now use the $aq_condensed_html
Code: [Select]
if (isset ($purple_html) && $purple_html == true)
     {  echo $pageHTML_0.$aq_condensed_html.$pageHTML_9; }
Change that so that all information is shown
Code: [Select]
if (isset ($purple_html) && $purple_html == true)
     {  echo $pageHTML_0.$aq_fullpage_html.$pageHTML_9; }

That should do it.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: Sperber on August 21, 2020, 01:47:32 PM
Thanks, that was quick.
It's going to be a special project.
Since all the air data measuring devices differ too much for me, I will present 3 manufacturers on one page.

Your script is the first for Purple Air.

IQAir AirVisual Pro from Switzerland and https://www.air-q.com/ from Germany are added.
I'm waiting for the delivery.

All are placed in the same location.

Maybe you can help me with the page ?!

Thanks Sperber
Title: Re: Support of "Leuven" Air Quality scripts
Post by: the beteljuice on August 23, 2020, 09:06:00 PM
Hello Wim ...
Long time since the beteljuice last annoyed you  :grin:

Woken up by the last few posts I fancied a change, and thought I'd have a quick look under the bonnet and see what you've done with the AQ stuff.

So I've messed about tweaked a bit and Here are the results (http://www.beteljuice.co.uk/purpleair/purp1.php)

Done very little really, just light cosmetics.  :roll:

BTW - You seem to have very good air ATM - Last 24h avg    4 µg/m3
I judge my air by how bad the birds are coughing !
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on August 24, 2020, 02:56:07 AM
@the beteljuice

 [tup]
Title: Re: Support of "Leuven" Air Quality scripts
Post by: big2000 on September 11, 2020, 11:42:06 AM
Hi Wim!

Thanks for the script!

It is working "kinda good" :roll:

Having a little problem with saratoga-template...
Do you know why nothing is shown in /wxAqLuft.php while using ws_luftdaten2.php ???

_test2.php and ws_luftdaten2.php are actually working but wxAqLuft.php is not showing anything... :???: (i already changed wxAqLuft.php to show ws_luftdaten2.php but nothing...)?

www.meteotaranto.org/wxAqLuft.php

Thank you,

Silvio. :grin:

Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on September 11, 2020, 12:35:33 PM
Hi Wim!

Thanks for the script!

It is working "kinda good" :roll:

Having a little problem with saratoga-template...
Do you know why nothing is shown in /wxAqLuft.php while using ws_luftdaten2.php ???

_test2.php and ws_luftdaten2.php are actually working but wxAqLuft.php is not showing anything... :???: (i already changed wxAqLuft.php to show ws_luftdaten2.php but nothing...)?

www.meteotaranto.org/wxAqLuft.php

Thank you,

Silvio. :grin:
Fairly difficult to debug. On top of that, add  the continuous change and blocking of luftdaten maps and madavi graphs which also needs some work.

So it is easier for you to make a new page to the menu starting with the wxnewpage.php
You can then add the working http://www.meteotaranto.org/luftdaten/ws_luftdaten2.php  in an iframe
And add any other interesting and still working information you may need.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: big2000 on September 11, 2020, 05:47:04 PM
Hi Wim!

Thanks for the script!

It is working "kinda good" :roll:

Having a little problem with saratoga-template...
Do you know why nothing is shown in /wxAqLuft.php while using ws_luftdaten2.php ???

_test2.php and ws_luftdaten2.php are actually working but wxAqLuft.php is not showing anything... :???: (i already changed wxAqLuft.php to show ws_luftdaten2.php but nothing...)?

www.meteotaranto.org/wxAqLuft.php

Thank you,

Silvio. :grin:
Fairly difficult to debug. On top of that, add  the continuous change and blocking of luftdaten maps and madavi graphs which also needs some work.

So it is easier for you to make a new page to the menu starting with the wxnewpage.php
You can then add the working http://www.meteotaranto.org/luftdaten/ws_luftdaten2.php  in an iframe
And add any other interesting and still working information you may need.

Wim

Thank you Wim.

I'll try what you said once i'm back home.

Will let you know if it works!

Thank you! :grin:

Silvio
Title: Re: Support of "Leuven" Air Quality scripts
Post by: big2000 on September 12, 2020, 06:26:56 AM
Dear Wim,

while i'm trying to make work about what you said, i'm now using ws_luftdaten1.php

Good. Now the "big" question:

Is there a way to create a new IQA for like Italy??  :-k :-k

Silvio.
 :grin:
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on September 12, 2020, 06:37:08 AM
Dear Wim,
. . .
Is there a way to create a new IQA for like Italy??  :-k :-k
. . .

If you want to use the Italian language
Then the texts would all be in Italian.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: big2000 on September 12, 2020, 06:44:17 AM
Dear Wim,
. . .
Is there a way to create a new IQA for like Italy??  :-k :-k
. . .

If you want to use the Italian language
  • Copy ws_luft_langEN.php  and name it ws_luft_langEN.php
  • Change all English text at the right of the =  to Italian texts.
    Do not change any texts at the lef of the = !
Then the texts would all be in Italian.

Wim

Dear Wim,

i guess we didn't understand each other :oops:

I'm talking about creating a new IQA Index with the Italian values...

Like the US/NL etc...
 [ You are not allowed to view attachments ]

Thank you :grin:
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on September 12, 2020, 06:59:49 AM
Dear Wim,
. . .
Is there a way to create a new IQA for like Italy??  :-k :-k
. . .

If you want to use the Italian language
  • Copy ws_luft_langEN.php  and name it ws_luft_langEN.php
  • Change all English text at the right of the =  to Italian texts.
    Do not change any texts at the lef of the = !
Then the texts would all be in Italian.

Wim

Dear Wim,

i guess we didn't understand each other :oops:

I'm talking about creating a new IQA Index with the Italian values...

Like the US/NL etc...
 [ You are not allowed to view attachments ]

Thank you :grin:
I was not  aware of an Italian AQ-index.

As you can understand adding a totally new index (not the words but the levels) will costs a lot of hours of my spare time.

Sadly the AQ scripts seems not to be used that much  and neither are they appreciated that much.

I should better spent my free time enhancing scripts which are used and valued more.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: big2000 on September 12, 2020, 07:40:01 AM
Dear Wim,
. . .
Is there a way to create a new IQA for like Italy??  :-k :-k
. . .

If you want to use the Italian language
  • Copy ws_luft_langEN.php  and name it ws_luft_langEN.php
  • Change all English text at the right of the =  to Italian texts.
    Do not change any texts at the lef of the = !
Then the texts would all be in Italian.

Wim

Dear Wim,

i guess we didn't understand each other :oops:

I'm talking about creating a new IQA Index with the Italian values...

Like the US/NL etc...
 [ You are not allowed to view attachments ]

Thank you :grin:
I was not  aware of an Italian AQ-index.

As you can understand adding a totally new index (not the words but the levels) will costs a lot of hours of my spare time.

Sadly the AQ scripts seems not to be used that much  and neither are they appreciated that much.

I should better spent my free time enhancing scripts which are used and valued more.

Wim

Dear Wim,

i totally understand what you are saying.

I kinda knew that it wasn't an "easy-to-do" thing but i asked anyway...

Thank you for your support!  :grin:
Title: Re: Support of "Leuven" Air Quality scripts
Post by: zmarfak on April 21, 2021, 03:50:32 AM
Hi Wim,
I switched my website to phph 8.0.3 yesterday.
Everything is (seems) ok.
I decided to check one of the error files on my site and I saw this error appearing since yesterday :
Code: [Select]
2021/04/20 16:31:00 [error] 16737#0: *7634892 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "accuracy" in /var/www/vhosts/matar.be/httpdocs/weather/sensorpurple3.php on line 133" while reading response header from upstream, client: 81.242.122.10, server: matar.be, request: "POST /weather/sensorpurple3.php HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/matar.be/php-fpm.sock:", host: "www.matar.be"

Because I don't know php very well, have you an idea how to solve this?

Thank you
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 21, 2021, 04:31:11 AM
Hi Wim,
I switched my website to phph 8.0.3 yesterday.
Everything is (seems) ok.
I decided to check one of the error files on my site and I saw this error appearing since yesterday :
Code: [Select]
2021/04/20 16:31:00 [error] 16737#0: *7634892 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "accuracy" in /var/www/vhosts/matar.be/httpdocs/weather/sensorpurple3.php on line 133" while reading response header from upstream, client: 81.242.122.10, server: matar.be, request: "POST /weather/sensorpurple3.php HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/matar.be/php-fpm.sock:", host: "www.matar.be"

Because I don't know php very well, have you an idea how to solve this?

Thank you
Seems that one of the seldom used fields is not uploaded anymore by the sensor, missing?
No idea since when, I have to check some other sensors.
PHP-8 does not like missing items and generated a message, in the past it was a null value.

Luckily your settings saved  the last posted message in a cache file, so that made debugging very easy.
Change line 133  in weather/sensorpurple3.php from
Code: [Select]
        $accuracy       = (float) $this_mes['accuracy'];to
Code: [Select]
        $accuracy       = -1;
Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: zmarfak on April 21, 2021, 04:43:40 AM
Wim,
thank you for your quick response.

Made the correction.
Title: Re: Support of "Leuven" Air Quality scripts
Post by: PeeGee on July 12, 2021, 03:49:41 AM

Hi Wim,

Is it also possible to use the AQI script, of course after some adjustments, for the Davis Airlink sensor?

Greetings,
Peter.
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on July 19, 2021, 09:22:17 AM

Hi Wim,

Is it also possible to use the AQI script, of course after some adjustments, for the Davis Airlink sensor?

Greetings,
Peter.

Sorry, no.
I stopped enhancing all "donation-ware" scripts.
But the Airlink sensor is supported in the free PWS_Dashboard scripts.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: forestedge on January 21, 2022, 12:45:29 PM
Hi Wim

I have been using the excellent standalone luftdaten scripts without any problems until 1st Jan this year when they stopped updating. I discovered the sensor link url had changed from http://api.luftdaten.info/v1/sensor/####/ (http://api.luftdaten.info/v1/sensor/####/) to https://data.sensor.community/airrohr/v1/sensor/####/ (https://data.sensor.community/airrohr/v1/sensor/####/)

I updated the ws_luftdaten1.php and _test1.php scripts and the sensor readings updated again ok.
https://www.tottonweather.co.uk/luftdaten/ws_luftdaten1.php (https://www.tottonweather.co.uk/luftdaten/ws_luftdaten1.php)

However the ws_luftdaten2.php and _test2 scripts do not update and I cannot see any link in them to change.
https://www.tottonweather.co.uk/luftdaten/ws_luftdaten2.php (https://www.tottonweather.co.uk/luftdaten/ws_luftdaten2.php)
I then discovered the luft_24data_esp8266-6535739.arr file had not updated since 1 Jan despite no changes to the sensor config by myself on the custom api. Sensor has been rebooted and running on latest firmware.

The PWS luftdaten popup on https://www.tottonweather.co.uk/homeweather-station/ (https://www.tottonweather.co.uk/homeweather-station/) still updates ok.

Any help appreciated.

Thanks
Roger

Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on January 21, 2022, 01:01:37 PM
. . .
However the ws_luftdaten2.php and _test2 scripts do not update and I cannot see any link in them to change.
https://www.tottonweather.co.uk/luftdaten/ws_luftdaten2.php (https://www.tottonweather.co.uk/luftdaten/ws_luftdaten2.php)
I then discovered the luft_24data_esp8266-6535739.arr file had not updated since 1 Jan despite no changes to the sensor config by myself on the custom api. Sensor has been rebooted and running on latest firmware.
. . .

The luftdaten2 receive script sensorluft2.php accepts a HTTP post from your sensor.

Your website is using https and probably re-directs all incoming http requests?

Please check your Luftdaten sensor setup.
If it still uses http to access your server
=> the access is redirected by your webserver and the sensor data is lost
==> according to the http-to-https standards the http payload is  "untrusted"

So the sensorluft2.php gets an access with empty data and discards it.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: forestedge on January 23, 2022, 12:42:23 PM

Quote
Your website is using https and probably re-directs all incoming http requests?

Yes there has been a redirect for over a year when I went to https so why did it not reject before [ You are not allowed to view attachments ] ?
I have tried changing the custom api to https as screenshot attached but no change. The password box continues to show "password" so don't know if it is retaining it.

Seems odd that the luftdaten api had to be updated at the same time. From the airrohr forum a post said there was a redirect for 2 years which presumably expired.

Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 16, 2022, 03:18:40 AM
Good morning wim
I'm trying to get the _test2.php script to work
but I get the error Warning: file_get_contents (./ data / luft_24data_esp8266-5220886.arr): failed to open stream: No such file or directory in /web/htdocs/www.pomeziameteo.it/home/luftdaten/ws_luftdaten2.php on line 106
I have configured this in my detector

also tried to put the .htaccess file as you recommended but nothing
do you have any idea where am i wrong?  :oops:
Thank you
Title: Re: Support of "Leuven" Air Quality scripts
Post by: pimohdaimaoh on April 16, 2022, 07:58:18 AM
Good morning wim
I'm trying to get the _test2.php script to work
but I get the error Warning: file_get_contents (./ data / luft_24data_esp8266-5220886.arr): failed to open stream: No such file or directory in /web/htdocs/www.pomeziameteo.it/home/luftdaten/ws_luftdaten2.php on line 106
I have configured this in my detector

also tried to put the .htaccess file as you recommended but nothing
do you have any idea where am i wrong?  :oops:
Thank you

Maybe try to check this on line 8

$useOwnData     = $useOwnDir.'luft_24data_esp8266-'.$userSensor.'.arr';

it says it should YOUR sensor ID number to detect the arr files so try to check this then put your number like this in line 4

$userSensor     = '5220886';


if not, put your ID number there to detect it in folder and you dont need to put user name and password in API settings just leave as blank as it is

second dont add space between your ./ data / folder do like this

$useOwnDir      = './data/';  not this     = './ data /'; 

hope it helps
Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 16, 2022, 09:09:49 AM
Good morning wim
I'm trying to get the _test2.php script to work
but I get the error Warning: file_get_contents (./ data / luft_24data_esp8266-5220886.arr): failed to open stream: No such file or directory in /web/htdocs/www.pomeziameteo.it/home/luftdaten/ws_luftdaten2.php on line 106
I have configured this in my detector

also tried to put the .htaccess file as you recommended but nothing
do you have any idea where am i wrong?  :oops:
Thank you

Maybe try to check this on line 8

$useOwnData     = $useOwnDir.'luft_24data_esp8266-'.$userSensor.'.arr';

it says it should YOUR sensor ID number to detect the arr files so try to check this then put your number like this in line 4

$userSensor     = '5220886';


if not, put your ID number there to detect it in folder and you dont need to put user name and password in API settings just leave as blank as it is

second dont add space between your ./ data / folder do like this

$useOwnDir      = './data/';  not this     = './ data /'; 

hope it helps

I did as you told me but nothing to do
one thing I did not understand

if not, put your ID number there to detect it in folder and you dont need to put user name and password in API settings just leave as blank as it is
Title: Re: Support of "Leuven" Air Quality scripts
Post by: pimohdaimaoh on April 16, 2022, 12:01:48 PM
Good morning wim
I'm trying to get the _test2.php script to work
but I get the error Warning: file_get_contents (./ data / luft_24data_esp8266-5220886.arr): failed to open stream: No such file or directory in /web/htdocs/www.pomeziameteo.it/home/luftdaten/ws_luftdaten2.php on line 106
I have configured this in my detector

also tried to put the .htaccess file as you recommended but nothing
do you have any idea where am i wrong?  :oops:
Thank you

Maybe try to check this on line 8

$useOwnData     = $useOwnDir.'luft_24data_esp8266-'.$userSensor.'.arr';

it says it should YOUR sensor ID number to detect the arr files so try to check this then put your number like this in line 4

$userSensor     = '5220886';


if not, put your ID number there to detect it in folder and you dont need to put user name and password in API settings just leave as blank as it is

second dont add space between your ./ data / folder do like this

$useOwnDir      = './data/';  not this     = './ data /'; 

hope it helps

I did as you told me but nothing to do
one thing I did not understand

if not, put your ID number there to detect it in folder and you dont need to put user name and password in API settings just leave as blank as it is

On your ws_luftdaten2, change the I'd number and put your sensor ID number on it and since I saw your configuration you add username to it, it should left it blank also on your configuration remove the ? At the end it should be /sensorluft.php , remove the ? At the end maybe that's the reason why it doesn't generate .arr file to your /data folder
Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 16, 2022, 07:51:02 PM
Good morning wim
I'm trying to get the _test2.php script to work
but I get the error Warning: file_get_contents (./ data / luft_24data_esp8266-5220886.arr): failed to open stream: No such file or directory in /web/htdocs/www.pomeziameteo.it/home/luftdaten/ws_luftdaten2.php on line 106
I have configured this in my detector

also tried to put the .htaccess file as you recommended but nothing
do you have any idea where am i wrong?  :oops:
Thank you

Maybe try to check this on line 8

$useOwnData     = $useOwnDir.'luft_24data_esp8266-'.$userSensor.'.arr';

it says it should YOUR sensor ID number to detect the arr files so try to check this then put your number like this in line 4

$userSensor     = '5220886';


if not, put your ID number there to detect it in folder and you dont need to put user name and password in API settings just leave as blank as it is

second dont add space between your ./ data / folder do like this

$useOwnDir      = './data/';  not this     = './ data /'; 

hope it helps

I did as you told me but nothing to do
one thing I did not understand

if not, put your ID number there to detect it in folder and you dont need to put user name and password in API settings just leave as blank as it is

On your ws_luftdaten2, change the I'd number and put your sensor ID number on it and since I saw your configuration you add username to it, it should left it blank also on your configuration remove the ? At the end it should be /sensorluft.php , remove the ? At the end maybe that's the reason why it doesn't generate .arr file to your /data folder
In the meantime, thanks for helping me
but the username where should I enter that I did not understand?
Title: Re: Support of "Leuven" Air Quality scripts
Post by: pimohdaimaoh on April 17, 2022, 05:12:47 AM
Good morning wim
I'm trying to get the _test2.php script to work
but I get the error Warning: file_get_contents (./ data / luft_24data_esp8266-5220886.arr): failed to open stream: No such file or directory in /web/htdocs/www.pomeziameteo.it/home/luftdaten/ws_luftdaten2.php on line 106
I have configured this in my detector

also tried to put the .htaccess file as you recommended but nothing
do you have any idea where am i wrong?  :oops:
Thank you

Maybe try to check this on line 8

$useOwnData     = $useOwnDir.'luft_24data_esp8266-'.$userSensor.'.arr';

it says it should YOUR sensor ID number to detect the arr files so try to check this then put your number like this in line 4

$userSensor     = '5220886';


if not, put your ID number there to detect it in folder and you dont need to put user name and password in API settings just leave as blank as it is

second dont add space between your ./ data / folder do like this

$useOwnDir      = './data/';  not this     = './ data /'; 

hope it helps

I did as you told me but nothing to do
one thing I did not understand

if not, put your ID number there to detect it in folder and you dont need to put user name and password in API settings just leave as blank as it is

On your ws_luftdaten2, change the I'd number and put your sensor ID number on it and since I saw your configuration you add username to it, it should left it blank also on your configuration remove the ? At the end it should be /sensorluft.php , remove the ? At the end maybe that's the reason why it doesn't generate .arr file to your /data folder
In the meantime, thanks for helping me
but the username where should I enter that I did not understand?

(see image below)
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 17, 2022, 12:19:56 PM
Good morning wim
I'm trying to get the _test2.php script to work
but I get the error Warning: file_get_contents (./ data / luft_24data_esp8266-5220886.arr): failed to open stream: No such file or directory in /web/htdocs/www.pomeziameteo.it/home/luftdaten/ws_luftdaten2.php on line 106
I have configured this in my detector

also tried to put the .htaccess file as you recommended but nothing
do you have any idea where am i wrong?  :oops:
Thank you


1. Test http://www.pomeziameteo.it/luftdaten/sensorluft2.php    that is an http request in your browser
2. using inspect (right click in most browsers) you can check  what happens with the request
3. it is redirected to https and by the security definitions all data is lost.
See attached screenshot

So either
you have to have a sensor with enough  processing power to process modern https  => very unlikely
or
you have to set the .htaccess to not redirect the commands to the luftdaten folder

But when someone wants to check this problem, you have to
1. post the complete .htaccess file
2. and tell us were you put that file on your webserver.
Your current .htaccess (or cPanel settings) still force all http  luftdaten folder   traffic to https.

All other settings are OK. The ? can be added or left out.
We use that to test, fi.i. with ?some_test=12345

User and Password need not to be set, we use those when for some reason, new users copy your examples and upload other sensor-data.
Then one can add an extra password check.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 17, 2022, 12:25:44 PM
But in fact Wim I was just reading some previous post and on my web server I can't find an htaccess  ](*,)
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 17, 2022, 12:35:39 PM
But in fact Wim I was just reading some previous post and on my web server I can't find an htaccess  ](*,)

It all depends on your hosting company.
You can ask your provider and explain you want to allow http traffic to the luftdaten/data/ folder.

Most hosting companies allow you to have a .htaccess in the user-root of your website (I think it is "home" in your setup).
In that folder you have a luftdaten folder and probably a lot more folders
There you insert a text-file with .htaccess similar to this one inside that home folder.
Code: [Select]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/luftdaten/data/
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

But check with your provider, they are paid by you to help you with this.
Also any file starting with a . is hidden, only visible with a decent ftp program of a cPanel file browser.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 17, 2022, 01:01:25 PM
Wim I put the htaccess file in the root of the aruba server, but in doing so the site goes down.
on the aruba server there is a redirect function from http to https enabled.
I think the problem is as you say
Now I talk to Aruba customer service and explain that the luftdaten folder must work in http
I will keep you updated thanks as always
Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 23, 2022, 07:24:32 AM
Hi Wim, here I am again
I changed host from Aruba I switched to Keliweb and I had the luftdaten folder dedicated in http but the problem remains the same
http://pomeziameteo.it/luftdaten/_test2.php


Warning: file_get_contents (./ data / luft_24data_esp8266-5220886.arr): failed to open stream: No such file or directory in /home/fqtreomy/public_html/luftdaten/ws_luftdaten2.php on line 106
 :oops: :oops: :oops:
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 23, 2022, 07:38:54 AM
Hi Wim, here I am again
I changed host from Aruba I switched to Keliweb and I had the luftdaten folder dedicated in http but the problem remains the same
http://pomeziameteo.it/luftdaten/_test2.php


Warning: file_get_contents (./ data / luft_24data_esp8266-5220886.arr): failed to open stream: No such file or directory in /home/fqtreomy/public_html/luftdaten/ws_luftdaten2.php on line 106
 :oops: :oops: :oops:

Please check if there is any data in the ./luftdaten/data/  folder.
And post what files are there and what date/time they were modified.
Checking ourselves is not possible as we are not allowed to browse that folder from the internet.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 23, 2022, 07:41:59 AM
Wim the given folder and empty no files
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 23, 2022, 07:43:15 AM
Wim the given folder and empty no files

Is it writable? So could a script write to that folder and make new files into it?


Change line 10 sensorluft2.php from
Code: [Select]
$save_last_mes  = false; to
Code: [Select]
#  $save_last_mes  = false;That way it will at least write a file, empty or not.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 23, 2022, 07:46:31 AM
Yes, the write settings are 777
I am attaching 2 screanshots of the settings if it can be useful
Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 23, 2022, 07:47:20 AM
also this screanshot
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 23, 2022, 07:49:16 AM
Yes, the write settings are 777
I am attaching 2 screanshots of the settings if it can be useful

The settings should also set to include the files, not only the folder.

Also see my previous post and change line 10 to write any message coming in.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 23, 2022, 07:50:50 AM
also this screanshot

Also try to remove the ? in your sensor settings, it should do no harm but who knows for sure.

Wim

Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 23, 2022, 07:56:11 AM
Then wim
I removed ?
and set up like this

the data folder remains empty
<? php
# ------------------------------------- SETTINGS
$ timezone = 'Europe / Brussels';
# $ timezone = 'America / New_York';
#
$ data_dir = './data/'; // relative to this calling script ## 2018-08-25
# $ data_dir = './cache';
#
$ save_last_mes = true; // copy upload to disk also
# $ save_last_mes = false;
$ load_regional = true; // load sensor data to LOCAL site (f.i. leuvenair) needs userid-pw
$ load_regional = false;
Title: Re: Support of "Leuven" Air Quality scripts
Post by: wvdkuil on April 23, 2022, 08:10:46 AM
Then wim
I removed ?
and set up like this

the data folder remains empty
<? php
# ------------------------------------- SETTINGS
$ timezone = 'Europe / Brussels';
# $ timezone = 'America / New_York';
#
$ data_dir = './data'; // relative to this calling script ## 2018-08-25
# $ data_dir = './cache';
#
$ save_last_mes = true; // copy upload to disk also
# $ save_last_mes = false;
$ load_regional = true; // load sensor data to LOCAL site (f.i. leuvenair) needs userid-pw
$ load_regional = false;

If there is no data arriving in the folder, there is nothing I can do from here.
There are dozens of users when counting the requests for support for this script.
I can not debug from the outside internet into your protected website as you are currently the only one reporting problems.

If it fails in your specific environment:
Option 1 -> use the normal version.
Or option 2: use another script to handle your sensor.

The script had no PHP 500 errors http://pomeziameteo.it/luftdaten/sensorluft2.php?sce=view
It accepts data: https://pomeziameteo.it/luftdaten/sensorluft2.php?HTTP_SENSOR=123456
Maybe it gets no good / invalid data
Maybe it can not write data
Maybe .. ?
It also returns an enormous amount of tracking information from your provider.
Is it a "free" provider?

Sorry, I can not do anything more than guessing what could be wrong in your setup.

Wim
Title: Re: Support of "Leuven" Air Quality scripts
Post by: djroby19 on April 23, 2022, 08:22:58 AM
no it's not a free provider
I will use the normal version thanks Wim himself