Closed meisnick closed 2 years ago
Can you please attach the logs you are referring to for review?
Thanks.
This is everything relevant I could find with the syslog showing the ignored old strikes. The lightningdata.php showing the 2 strikes. Realtime and retained loop files with current values. I'm not sure if there is any other place the strikes are recorded.
RetainedLoopValues.txt lightningdata.php.txt w34realtime.txt SyslogSnip.txt
The one log that would help is the webserver error log. If using apache webserver it would be located /var/log/apache2 directory. All lightning data is stored in the database. Ian has made a number of changes in this area so he may be the best one to see what is not working. Also the browser console error log would also help. If using chrome go to the inspect mode and choose the console error display on the right side. Thanks
This is everything relevant I could find with the syslog showing the ignored old strikes. The lightningdata.php showing the 2 strikes. Realtime and retained loop files with current values. I'm not sure if there is any other place the strikes are recorded.
RetainedLoopValues.txt lightningdata.php.txt w34realtime.txt SyslogSnip.txt
Thank you for those logs. As @balloonhotair said, the ones that will also help are the browser console error log and the Apache/ngnix error logs. Looking forward to getting those and digging into this issue.
Here is the browser console output and the apache2 error.log
So the next item we need is there a file call serverdata/lightningdata.php and if so what is its contents? Thanks
This is /var/www/html/weewx/weather34/serverdata
So this php data is incorrect $lightningdistance = "$alltime.lightning_distance.lastnonzero.format(add_label=False, $localize=False)"; $lastlightningtime = "$alltime.lightning_last_det_time.lastnonzero.raw";
Which causes a 500 error. So need to talk to Ian to see what he is trying to do. Thanks
Hello Meisnick, Ian here. I am travelling with intermittent internet connection, but you have been in good hands. If we can concentrate on the smaller lightning module at the top, there are three to select from in the settings, which one did you choose? Also is your lightning sensor a stand alone device or part of an integrated setup like Tempest or Ecowitt for instance?
Sent from my iPhone
On 2 Apr 2022, at 07:02, Rayvenhaus @.***> wrote:
Also, what is the version of your database that you are currently running? Are you using the weewx extended database? Also do you have a lightningdata.php.tmpl file and an entry in your skin folder?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
@steepleian The device is a standalone ecowitt WH31L the module in the top is top_lightning.php
@Rayvenhaus the install was fresh from the latest apt package the my understanding is the newer versions come with the database set extended from the get go. lightningdata.php.tmpl is in the skins folder as well.
Ok if stand-alone, how do you interface the device with WeeWX?
Sent from my iPhone
On 2 Apr 2022, at 08:38, meisnick @.***> wrote:
@steepleian The device is a standalone ecowitt WH31L the module in the top is top_lightning.php
@Rayvenhaus the install was fresh from the latest apt package the my understanding is the newer versions come with the database set extended from the get go. lightningdata.php.tmpl is in the skins folder as well.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
I'm using the grj80 GW1000 Driver 0.4.2
Ok same as me. I will send you my own exact file settings later today.
Sent from my iPhone
On 2 Apr 2022, at 09:20, meisnick @.***> wrote:
I'm using the grj80 GW1000 Driver 0.4.2
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
In the attached .zip file you will the top_lightning.php and lightning data .tmpl downloaded directly from my own installation. You also have this entry in your Weather34 skin.conf file in the CheetahGenerator stanza: -
[CheetahGenerator]
# Possible encodings are 'html_entities', 'utf8', or 'strict_ascii'
encoding = html_entities
search_list_extensions = user.stats.MyStats, user.lastrain.lastRainTags
[[WXDATA]]
# Generates data for various W34 Statistics
[[[W34ARCHIVEDATA]]]
encoding = strict_ascii
template = serverdata/archivedata.php.tmpl
[[[LIGHTNINGDATA]]]
encoding = strict_ascii
template = serverdata/lightningdata.php.tmpl
I replaced the files from the Zip archive and rebooted the machine and checked, no difference.
I then checked the Weather34 skin.conf and noted that my install had
[[[W34LIGHTNINGDATA]]] encoding = strict_ascii template = serverdata/lightningdata.php.tmpl
Instead of
[[[LIGHTNINGDATA]]] encoding = strict_ascii template = serverdata/lightningdata.php.tmpl
I changed that and rebooted the server again but same php variable error in browser console and apache2 error log
Do you have lastnonzero.py installed and which version of Python are you using?
Python3 the service mentioned in the lasnozero.py seems to be missing from the weewx.conf
user.lastnonzero.LastNonZeroService
I'm not sure where exactly to place that .py file
The file should be in your user folder along with your weather34.py file. If you installed your WeeWX using setup.py the location is /home/weewx/bin/user
Sent from my iPhone
On 2 Apr 2022, at 23:31, meisnick @.***> wrote:
Python3 the service mentioned in the lasnozero.py seems to be missing from the weewx.conf
user.lastnonzero.LastNonZeroService
I'm not sure where exactly to place that .py file
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
Yes that file exists in /usr/share/weewx/user with the other weewx items
extensions.py
gw1000.py
init.py
installer
lastnonzero.py
lastrain.py
ml.py
pycache
stats.py
w34_db_backup.py
w34highchartsSearchX.py
weather34.py
I assume that you still have a blank module, is that correct? If so can you change the 2nd line in the file top_lightning.php to this: -
include('serverdata/archivedata.php');
Then restart WeeWX. Is there any change?
The module loaded and there is no longer a error in the browser console but it still seems to be missing the all time strike and last distance data.
That is what I expected to happen. We need to check the contents of your database and check that lightning data is being stored. There some other changes which I want to make which I will make this evening.
Sent from my iPhone
On 4 Apr 2022, at 09:37, meisnick @.***> wrote:
The module loaded and there is no longer a error in the browser console but it still seems to be missing the all time strike and last distance data.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
Sorry for the delay. I am travelling and my current location has a very slow connection. I have made some changes but cannot upload due the slow speed. In the meantime, can you please check the contents of your database fof lightning data. The tool that WeeWX creators recommend is DB Browser for SQLite (https://sqlitebrowser.org/). It is very easy to use and there are vesions for MacOS, Windows and Linux. Make a copy of your database and download it to the device on which DB Browser is installed. Check that the database has the columns (fields) and that there is some data there. I may be a few days before I have a fast connection again, so you have plenty of time to check things out. Ian
No problem Ian I appreciate the support
The Database shows the lightning data columns pictured.
Good you have data. I might try and devise a small test file in the meantime which I should be able to upload. Ian
Sent from my iPhone
On 6 Apr 2022, at 04:18, meisnick @.***> wrote:
No problem Ian I appreciate the support
The Database shows the lightning data columns pictured.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
I have managed to get a better connection this morning:-)
First of all check that you have this stanza in your weewx.conf file: -
[LastNonZero] algorithm = simple # Or tetens
If it is not there you can place it at the end of the file.
Also in the [Engine] stanza check that in the xtype_services line you have the reference to user.lastnonzero.LastNonZeroService as in the example below : -
[Engine]
[[Services]]
xtype_services = weewx.wxxtypes.StdWXXTypes, weewx.wxxtypes.StdPressureCooker, weewx.wxxtypes.StdRainRater, weewx.wxxtypes.StdDelta, user.lastnonzero.LastNonZeroService
Can you replace your lightningdata.php.tmpl with the one contained in the attached .zip file above. It is a test file. After the next archive cycle, check that lightningdata.php has been updated then run the file in your browser. Example in my case I would use this url to run the file.
https://claydonsweather.org.uk/weewx/weather34/serverdata/lightningdata.php
You should see 4 values printed out in your browser window. You can try on my website to compare.
Let me know how this goes for you.
Ian
Sent from my iPhone
Ian, I do not see the config updates above in any of the w34installer configs. Should they be? Thanks Jerry
I made the changes listed and this is what is displayed in the weather34/serverdata/lightningdata.php page in the browser.
I am not sure what caused the second item to print out like that but it seems that things are on the right track now.
The Git has now been updated to include the issues you experienced. If you make a new install from the latest update, everything should be OK now. Let me know how you get on. Ian
The second line prints that way due to an PHP error. So it means that the php code failed, usually suspects are typos or field values that do not exist.
I halted the WeeWx and pulled the database and did a full fresh install from scratch and placed the database back. After the initialization and the reports were generated everything is up but the top_lightning seems to be throwing the same errors in the browser console and apache log (attached).
I am very sorry, not everthing updated in the Git. It may have been the slow connection that I was using at the time. I have updated again and everything is there now. However to save you having to rerun the install process, I have included the new files in the attached zip files. toplightningw34combined.zip lightningdata.zip
The first contains two files to replace in your weather34 folder, and the second 1 file to replace in your skins/serverdata folder. The lightningdata.php.tmpl file is no longer required so you will need to remove that sub stanza from your skin.conf file.
Fingers crossed that everything will be OK now.
Unfortunately after replacing the files the fields have returned but still are empty, there is no error in the browser console. weather34/serverdata/lightningdata.php shows the same ".lightning_last_det_time.lastnonzero.raw"
Apache log shows
[Mon Apr 11 20:39:45.051021 2022] [php:warn] [pid 30615] [client 192.168.1.144:27343] PHP Warning: Undefined variable $alltime in /var/www/html/weewx/weather34/serverdata/lightningdata.php on line 4
I set up a second server for testing, did another fresh install from scratch and the browser console error returned seems to be the same as before.
Let me know if I can test anything else happy to continue working on it. I again appreciate the support.
I think you may have missed the instruction to remove this from your skin.conf file
[[[LIGHTNINGDATA]]]
encoding = strict_ascii
template = serverdata/lightningdata.php.tmpl
That is what is giving you the error in the browser log. All the variables required are now generated in the archivedata.php file. If you scroll down you should see this section of resolved variables.
//lightning for Ecowitt sensor $lightning['light_last_distance'] = "19.3"; $lightning['last_time'] = "1645102486"; $lightning['strike_count'] = "186"; $lightning['strike_count_3hr'] = "0";
Sent from my iPad
On 12 Apr 2022, at 02:45, meisnick @.***> wrote:
Unfortunately after replacing the files the fields have returned but still are empty, there is no error in the browser console. weather34/serverdata/lightningdata.php shows the same ".lightning_last_det_time.lastnonzero.raw"
Apache log shows
[Mon Apr 11 20:39:45.051021 2022] [php:warn] [pid 30615] [client 192.168.1.144:27343] PHP Warning: Undefined variable $alltime in /var/www/html/weewx/weather34/serverdata/lightningdata.php on line 4
I set up a second server for testing, did another fresh install from scratch and the browser console error returned seems to be the same as before.
Let me know if I can test anything else happy to continue working on it. I again appreciate the support.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
Ok so this is a fresh install shortly before this post with my existing database. Hopefully this layout shows my exact setup better with changes.
Shows no "[[[LIGHTNINGDATA]]]" stanza
[CheetahGenerator]
# Possible encodings are 'html_entities', 'utf8', or 'strict_ascii'
encoding = html_entities
search_list_extensions = user.stats.MyStats, user.lastrain.lastRainTags
[[WXDATA]]
# Generates data for various W34 Statistics
[[[W34ARCHIVEDATA]]]
encoding = strict_ascii
template = serverdata/archivedata.php.tmpl
toplightningw34combined.zip lightningdata.zip
were placed as follows
top_lightning.php >>>>> /var/www/html/weewx/weather34/
w34CombinedData.php >>>> /var/www/html/weewx/weather34/
lightningdata.php.tmpl >>>> /etc/weewx/skins/Weather34/serverdata/
Shows data but still has a lastnozero entry
//lightning for Ecowitt sensor
$lightning['light_last_distance'] = "6.2";
$lightning['last_time'] = "$alltime.lightning_last_det_time.lastnonzero.raw";
$lightning['strike_count'] = "2";
$lightning['strike_count_3hr'] = "0";
Shows
[Tue Apr 12 19:32:25.405166 2022] [php:error] [pid 733] [client 192.168.1.144:35177] script '/var/www/html/weewx/weather34/serverdata/top_lightning.php' not found or unable to stat
[Tue Apr 12 19:48:33.423407 2022] [php:error] [pid 603] [client 192.168.1.144:35864] script '/var/www/html/weewx/weather34/serverdata/lightningdata.php' not found or unable to stat
Shows
jquery.js:1 GET http://192.168.1.9/weewx/weather34/top_lightning.php?_=1649811251733 500 (Internal Server Error)
send @ jquery.js:1
ajax @ jquery.js:1
earthquake @ (index):201
(anonymous) @ (index):201
e @ jquery.js:1
t @ jquery.js:1
setTimeout (async)
(anonymous) @ jquery.js:1
c @ jquery.js:1
fireWith @ jquery.js:1
fire @ jquery.js:1
c @ jquery.js:1
fireWith @ jquery.js:1
ready @ jquery.js:1
B @ jquery.js:1
At last I have found the problem and it is with the GW1000 driver. The tag that keeps failing maps to a non-existent field in the new extended database. I will contact the author about this. In the meantime I can provide a simple fix later today.
So the GW1000 driver is mapping the last detected strike time to a non-existent field in the database.
To correct this, I have mapped it to an empty field signal5 with this entry in [GW1000] stanza of weew.conf
[[field_map_extensions]]
signal5 = lightningdettime
You will also need to replace the two files in the attached .zip file
As there will no data in the new field, the last detected time will not be displayed until your next strike.
If you are already using field signal5 you can change to another unused field by edditng the above and the archivedata.php.tmpl field
So not as to temp fate, I will await your feedback before updating the Git Ian
The two files were placed my weewx.conf did not have any existing [[field_map_extensions]] stanza but I have inserted it. There is a storm going over right now hopefully there is some lightning detected to test.
I'll update if there is any. Thanks
Am I assuming correctly that you have no errors at the moment?
No browser, apache, or syslog errors. The module shows Last Distance and All Time correctly I believe.
That is looking good. The last detected time will appear above the other two lines on the right side, when the next event occurs. I have raised an issue on the weewx-gw1000 repository as to why a non-existent field name was used.
Thank you very much for raising the issue and your patience during the drawn out solution.
I will close the issue as soon as you give me final confirmation that all is OK.
Ian
We finally had some lightning today and The fix did work.
It should make no difference to what the stanza level is called so long as the square bracketing is correct. We need to dig deeper.
Sent from my iPhone
On 2 Apr 2022, at 22:29, meisnick @.***> wrote:
I replaced the files from the Zip archive and rebooted the machine and checked, no difference.
I then checked the Weather34 skin.conf and noted that my install had
[[[W34LIGHTNINGDATA]]] encoding = strict_ascii template = serverdata/lightningdata.php.tmpl
Instead of
[[[LIGHTNINGDATA]]] encoding = strict_ascii template = serverdata/lightningdata.php.tmpl
I changed that and rebooted the server again but same php variable error in browser console and apache2 error log
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
After waiting for some strikes to show up in database I see data in the default weewx Seasons skin the syslog shows the 2 previous strikes. The lightning34.php large tile shows the prior strikes but shows the current time as the Last Strike Delected on every refresh, and nothing in the main yellow count.
This is a very fresh install Python3 WeeWX 4.7.0 and W34-4.2.8.2
I can provide any logs or config if requested.