Attached a more future and feature proof version of the . . . /pwsWD/ecowitt/index.php script.
It will encrypt and store the PASSKEY in a file in the ecowitt folder
=> no need to change the script the first time
=> adding / testing new versions of the script is now possible without adding the PASSKEY to the script every time
The script will check if multiple important data-items are in the upload and if the value is not empty, 0 or NULL
Installation:
As always: First make a copy (backup) of the current /ecowitt/index.php script
Unzip attachment
Check the location for the uploaded file in line 3 of the script,
=> default the file is saved in the ecowitt/ folder as ecco_lcl.arr
==> some older versions used upload to “…/jsondata/ecco_lcl.arr”, change your setting, not the script
After that, replace current /ecowitt/index.php with the new version.
New features after this basic version is tested:
With this version I can centralise the “for ecowitt only” code in livedata and the cron
=> saving lightning info (and other info ?) which gets lost after a firmware version
=> calculation of high-lows
=> using an extra temp/hum sensor as primary
But also I will add
=> sensor calibration for some sensors, f.i. UV
If you have other items to add, feel free to post them in this topic
I attached a new version to the first post which now can calibrate sensor values by using
[ol]
[li]a multiplier for the UV , default value * 0.6[/li]
[li]replace “main TempHum” with an “extra Temp-Hum” sensor[/li]
[li]stretch sensor values, f.i. a malfunctioning humidity sensor which only returns values between 0 ↔ 50
where the values should be between 10 and 90
One can add different stretch ranges to different sensors[/li]
[li]a simple offset for sensor values, f.i. temp_inside is always 2 degr. F to high
Every sensor can have a different offset
[/li][/ol]
If sensor names are not available in the upload, the calibration is skipped, no messages.
Old values are added with a new key to the upload so that debugging is easier.
The complete upload is sorted on the sensor name before saving it.
The script can now check if multiple sensors are available before saving the data.
F.i. both outside temp ‘tempf’ and pressure ‘baromabsin’
If those “always_exists” sensors are not found, the remaining sensor data is written to the log.
The PWS dashboard calibration should be switched off by default. The station itself should already be sending correct data - i.e. it should be calibrated. Otherwise the correct values coming from the station will be falsified.
At least in the Fine Offset environment, I see no reason to not calibrate the station correctly itself.
One central place - valid for all values and services.
The only one switched on be default during test-phase is UV.
I checked only a handful of stations using “Custom upload”, they were all reporting far to high UV-values.
And that affects their upload to WU also.
But with a station, such as a GW1000, one should use the WS_View app.
One does not has to do that, all the calibration is optional, in the WS-View app and in the PWS_Dashboard.
The only really important thing, for some users, is the need to switch outside TH to an extra sensor.
That is not possible with the standard calibration in WS_View, AFAIK.
For those users that are not aware of calibration, see attached screenshot of WS_View on an iPad.
Select a station from the device list, Click menu “More” at the right and select “Calibration”
Wim
P.S.
This code is not necessary for FOSHK/Ecowitt “Customized upload” but it will be tested here and ported to f.i. WeatherFlow and other Network stations.
in PWS_livedata.php today, when you’re updating the live file
I use temp3 as the primary sensor. I do this every time PWS_livedata.php is updated. If I use the new index.php file, then I do not need to change PWS_livedata.php anymore when new updates arrive?
Yes, that is the whole idea.
Not doing those changes in livedata, which changes a few times / year as it supports a lot of different weather-programs and weather-nets.
But use the first script which process the data for 1 weather-program/net/device.
Or do those changes just after live-data.
And for Ecowitt I also wanted to get rid of the copying of the pass-key.
just in case you already exchange the values/keys via FOSHKplugin (e.g. take the values of temp3f as tempf).
Then they will be exchanged back in PWSDashboard of course.
So you would exchange them twice.
(Some people use the Fake-option to use a WH31 as a WH32)
I can not find the new index.php script so i can not check which version you use. The most recent one is in the first post of this topic
<?php $scrpt_vrsn_dt = 'index.php|01|2021-06-14|'; # Store passkey encripted + Improved messages + release 2012_lts # ecowitt receive data script
I do not think you are using that version, your weather values uploaded in the jsondata folder are not sorted on key-name.
Error messages are still for the old version.
The line 10 in the June 14 script, default reads:
$th_replace = 0; # replace outside TH sensor with extra th 1 - 8. 0 = no-replace
You need to change that to sensor 3:
$th_replace = 3; # replace outside TH sensor with extra th 1 - 8. 0 = no-replace
Off-topic as usual: is there a site where one can see theoretical max UV values for a particular location?
I know that my reported UV values increase with the age of my cheap Oregon sensors, but mine is only 2 years old and already showing high values, even on days without cloud enhancement.
That is still under test and enhancement. The update had the general version, so that updating it is possible without having to enter the passkey again.
You can copy the test version from the topic and set the release to |09| so that you are warned check it before replacing.