Author Topic: GW1000 + Lightning Sensor  (Read 1642 times)

0 Members and 1 Guest are viewing this topic.

Offline TinkerTown

  • Senior Member
  • **
  • Posts: 68
GW1000 + Lightning Sensor
« on: April 13, 2021, 08:32:05 PM »
Does anyone know if there is a guide or extension to add lightning strikes to Weewx that is writing to MySQL? I am using Weewx and an Ambient Weather 2902C, but with the GW1000 and the WH51 Lightning Sensor reading off the GW1000. I thought I saw a guide or something that explained how to add tracking of lightning, but I can't seem to find it again (if I ever did see it). I also have Weewx writing to a MySQL database on a separate server from the PI that Weewx is running on.

Ecowitt GW1000 | WS-2902C |Weewx on Raspberry Pi
WU: KNMLOVIN14  |  PWSweather: PWSLOVNM1
CWOP: FW9112; https://lovingtonweather.com

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: GW1000 + Lightning Sensor
« Reply #1 on: April 14, 2021, 03:30:34 PM »
If you look at your DB schema, you can see all the fields weewx usually stores (or can store) in its database.
If you started with weewx 4.x.x that's most likely the wview_extended schema (what you have you can see in your weewx.conf
in [DataBindings]     [[wx_binding]]. It resides (under Debian/Raspbian) at /usr/share/weewx/schemas as wview_extended.py).

In principle it doesn't matter whether the schema was created in a sqlite or a mySQL database.
Weewx will write/archive to the database you define in [[wx_binding]].

But, if I read your question properly, you want to combine the WS2902C readings and the GW1000 readings - or did you only mean by that the outdoor sensor array of the WS2892C  plus the WH57 lightning sensor?
(It's WH57, not WH51. WH51 is the SoilMoisture sensor; see https://www.wxforum.net/index.php?topic=40730.0).
Because the GW1000 will be able to read all the data you need. I assume (and recommend if not) that you use the GW1000 API driver.
https://github.com/gjr80/weewx-gw1000

If you use the wview_extended schema together with the GW1000 API driver, weewx would automatically assign the WH57 readings to the respective database fields.

You can look up the field map of the GW1000 driver at
https://github.com/gjr80/weewx-gw1000/wiki/Field-map.
It shows all the data available to process by weewx from the GW1000 (depending on which sensors are connected) - not what is stored/archived. That is defined by the DB schema.
Only observations which have a corresponding field in the DB schema will be assigned and stored/archived automatically.

If you still have the minimalist wview schema, the automatic assignment will not happen (if the fields are not part of the schema). Then you should upgrade to the wview_extended schema.
That's described in the wiki and customization guide.
(see wiki [https://github.com/weewx/weewx/wiki] and customization guide [http://www.weewx.com/docs/customizing.htm]).

« Last Edit: April 14, 2021, 03:37:58 PM by Gyvate »
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline TinkerTown

  • Senior Member
  • **
  • Posts: 68
Re: GW1000 + Lightning Sensor
« Reply #2 on: April 14, 2021, 03:52:36 PM »
If you look at your DB schema, you can see all the fields weewx usually stores (or can store) in its database.
If you started with weewx 4.x.x that's most likely the wview_extended schema (what you have you can see in your weewx.conf
in [DataBindings]     [[wx_binding]]. It resides (under Debian/Raspbian) at /usr/share/weewx/schemas as wview_extended.py).

In principle it doesn't matter whether the schema was created in a sqlite or a mySQL database.
Weewx will write/archive to the database you define in [[wx_binding]].

But, if I read your question properly, you want to combine the WS2902C readings and the GW1000 readings - or did you only mean by that the outdoor sensor array of the WS2892C  plus the WH57 lightning sensor?
(It's WH57, not WH51. WH51 is the SoilMoisture sensor; see https://www.wxforum.net/index.php?topic=40730.0).
Because the GW1000 will be able to read all the data you need. I assume (and recommend if not) that you use the GW1000 API driver.
https://github.com/gjr80/weewx-gw1000

If you use the wview_extended schema together with the GW1000 API driver, weewx would automatically assign the WH57 readings to the respective database fields.

You can look up the field map of the GW1000 driver at
https://github.com/gjr80/weewx-gw1000/wiki/Field-map.
It shows all the data available to process by weewx from the GW1000 (depending on which sensors are connected) - not what is stored/archived. That is defined by the DB schema.
Only observations which have a corresponding field in the DB schema will be assigned and stored/archived automatically.

If you still have the minimalist wview schema, the automatic assignment will not happen (if the fields are not part of the schema). Then you should upgrade to the wview_extended schema.
That's described in the wiki and customization guide.
(see wiki [https://github.com/weewx/weewx/wiki] and customization guide [http://www.weewx.com/docs/customizing.htm]).

Ah, OK I will check that out. The weather station I have is the AW 2902C, but I use the GW1000 to read the sensors from the station, plus an additional Temperature sensor and the WH57 Lightning sensor. I just purchased a WH51, but haven't deployed it yet.

This installation is Weewx 4.5.1 and now that you mention it I do recall reading about the database extension script and that is what I think I was recalling, so thank you. I am not an expert on databases, but I should be able to follow the customization documentation once I read through it. I am running the gw1000 API driver.

Thanks!

[GW1000]
    # This section is for the GW1000 API driver.

    driver = user.gw1000
    ip_address = xxx.xxx.xxx.xxx
    port = 45000
    poll_interval = 20
Ecowitt GW1000 | WS-2902C |Weewx on Raspberry Pi
WU: KNMLOVIN14  |  PWSweather: PWSLOVNM1
CWOP: FW9112; https://lovingtonweather.com

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: GW1000 + Lightning Sensor
« Reply #3 on: April 15, 2021, 02:45:17 AM »
OK - if you use the wview_extended schema, which will be automatically the case when you made your initial (!) install with a weewx 4.x.x  version, all your sensors (= the ones you have right now) should be automatically stored/archived. Lightning strike number, last date and distance are fields in the wview_extendedschema, so are 1-4 SoilMoisture sensors. It will become trickier once you have more than 4 (as I do).

So, if you have the already the wview_extended schema, nothing you have to do. If only the wview schema, you need to upgrade to wview_extended.

If you want to display your data in (e.g.) the Seasons skin, you need to know the weewx DB field names which you will need to add to skin.conf and index.html.tmpl.
Those you find in the Python program which created the DB schema; it ran only once when the initial install of the DB happened.
It's located in /usr/share/weewx/schemas and is named wview_extended.py (or wview.py).

e.g.
in skin.conf (/etc/weewx/skins/Seasons/skin.conf) you can add to

[ImageGenerator]
#
# ....................
#
   [[day_images]]

# ..................
        [[[daylightning]]]
             [[[[lightning_strike_count]]]]
               

        [[[daylightning2]]]
            [[[[lightning_distance]]]]   


and in index.html.tmpl (/etc/weewx/skins/Seasons/index.html.tmpl) you can then add

note that in index.html.tmpl a "#" is a valid syntax tag, not a commentary sign - commentary would be "##"

##
## you can add to the below plot group

 <div id="plot_group">
        <div id="history_widget" class="widget">
          <div id="plot_title" class="widget_title">History:&nbsp;&nbsp;
            <a class="button_selected" id="button_history_day"
               onclick="choose_history('day')">Day</a>
            <a class="button" id="button_history_week"
               onclick="choose_history('week')">Week</a>
            <a class="button" id="button_history_month"
               onclick="choose_history('month')">Month</a>
            <a class="button" id="button_history_year"
               onclick="choose_history('year')">Year</a>
          </div>
          <div id="history_day" class="plot_container">
            <img src="daybarometer.png" alt="$obs.label.barometer"/>
            <img src="daytempdew.png"   alt="$obs.label.outTemp" />
            <img src="daytempfeel.png"  alt="$obs.label.feel" />
            <img src="dayhum.png"       alt="$obs.label.outHumidity" />
            <img src="daywind.png"      alt="$obs.label.windSpeed" />
            <img src="daywinddir.png"   alt="$obs.label.windDir" />
            <img src="daywindvec.png"   alt="$obs.label.windvec" />
            <img src="dayrain.png"      alt="$obs.label.rain" />
## ........................
## ........................
            #if $day.lightning_strike_count.has_data
            <img src="daylightning.png"      alt="$obs.label.lightning_strike_count" />
            #end if
            #if $day.lightning_distance.has_data
            <img src="daylightning2.png"      alt="$obs.label.lightning_distance" />
            #end if


the result should look like:
 [ You are not allowed to view attachments ]
here the last strike was a couple of days ago at 24 km distance

once it works, you will have to add entries for week, month and year to skin.conf and index.html.tmpl - otherwise the pictures will occur only in the day view!!

If you want to see not only the pictures but also the current and high/low values in the left hand side pane of the Seasons skin,
 you will have to add corresponding entries to current.inc and hilo.inc (which are loaded into index.html.tmpl).
That will also be current, week, month, year.

e.g. for current.inc (/etc/weewx/skins/Seasons/current.inc)
##.................
## WH57 lightning
#if $day.lightning_strike_count.has_data
      <tr>
        <td class="label">$obs.label.lightning_strike_count</td>
        <td class="data">$current.lightning_strike_count</td>
      </tr>
#end if
#if $day.lightning_distance.has_data
      <tr>
        <td class="label">$obs.label.lightning_distance</td>
        <td class="data">$current.lightning_distance</td>
      </tr>
#end if

## ................

result (without the WH45 observations  ;) 8-) )
 [ You are not allowed to view attachments ]

there is also statistics.inc to be edited if you want to see the lightnings in the history table (click on "high/low").

The same/similar approach will need to be used for your WH51 SoilMoisture sensor.
« Last Edit: April 15, 2021, 03:08:14 AM by Gyvate »
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline TinkerTown

  • Senior Member
  • **
  • Posts: 68
Re: GW1000 + Lightning Sensor
« Reply #4 on: April 15, 2021, 05:24:54 AM »
I am using the Belchertown skin, but I assume the shaping of the skin.conf is similar?

I looked in the database and these are the tables I have, so it looks like I have the extended schema already!

mysql> SHOW TABLES;
+---------------------------------------+
| Tables_in_weewx                       |
+---------------------------------------+
| archive                               |
| archive_day_ET                        |
| archive_day_UV                        |
| archive_day__metadata                 |
| archive_day_altimeter                 |
| archive_day_appTemp                   |
| archive_day_appTemp1                  |
| archive_day_barometer                 |
| archive_day_batteryStatus1            |
| archive_day_batteryStatus2            |
| archive_day_batteryStatus3            |
| archive_day_batteryStatus4            |
| archive_day_batteryStatus5            |
| archive_day_batteryStatus6            |
| archive_day_batteryStatus7            |
| archive_day_batteryStatus8            |
| archive_day_cloudbase                 |
| archive_day_co                        |
| archive_day_co2                       |
| archive_day_consBatteryVoltage        |
| archive_day_dewpoint                  |
| archive_day_dewpoint1                 |
| archive_day_extraHumid1               |
| archive_day_extraHumid2               |
| archive_day_extraHumid3               |
| archive_day_extraHumid4               |
| archive_day_extraHumid5               |
| archive_day_extraHumid6               |
| archive_day_extraHumid7               |
| archive_day_extraHumid8               |
| archive_day_extraTemp1                |
| archive_day_extraTemp2                |
| archive_day_extraTemp3                |
| archive_day_extraTemp4                |
| archive_day_extraTemp5                |
| archive_day_extraTemp6                |
| archive_day_extraTemp7                |
| archive_day_extraTemp8                |
| archive_day_forecast                  |
| archive_day_hail                      |
| archive_day_hailBatteryStatus         |
| archive_day_hailRate                  |
| archive_day_heatindex                 |
| archive_day_heatindex1                |
| archive_day_heatingTemp               |
| archive_day_heatingVoltage            |
| archive_day_humidex                   |
| archive_day_humidex1                  |
| archive_day_inDewpoint                |
| archive_day_inHumidity                |
| archive_day_inTemp                    |
| archive_day_inTempBatteryStatus       |
| archive_day_leafTemp1                 |
| archive_day_leafTemp2                 |
| archive_day_leafWet1                  |
| archive_day_leafWet2                  |
| archive_day_lightning_distance        |
| archive_day_lightning_disturber_count |
| archive_day_lightning_energy          |
| archive_day_lightning_noise_count     |
| archive_day_lightning_strike_count    |
| archive_day_luminosity                |
| archive_day_maxSolarRad               |
| archive_day_nh3                       |
| archive_day_no2                       |
| archive_day_noise                     |
| archive_day_o3                        |
| archive_day_outHumidity               |
| archive_day_outTemp                   |
| archive_day_outTempBatteryStatus      |
| archive_day_pb                        |
| archive_day_pm10_0                    |
| archive_day_pm1_0                     |
| archive_day_pm2_5                     |
| archive_day_pressure                  |
| archive_day_radiation                 |
| archive_day_rain                      |
| archive_day_rainBatteryStatus         |
| archive_day_rainRate                  |
| archive_day_referenceVoltage          |
| archive_day_rxCheckPercent            |
| archive_day_signal1                   |
| archive_day_signal2                   |
| archive_day_signal3                   |
| archive_day_signal4                   |
| archive_day_signal5                   |
| archive_day_signal6                   |
| archive_day_signal7                   |
| archive_day_signal8                   |
| archive_day_snow                      |
| archive_day_snowBatteryStatus         |
| archive_day_snowDepth                 |
| archive_day_snowMoisture              |
| archive_day_snowRate                  |
| archive_day_so2                       |
| archive_day_soilMoist1                |
| archive_day_soilMoist2                |
| archive_day_soilMoist3                |
| archive_day_soilMoist4                |
| archive_day_soilTemp1                 |
| archive_day_soilTemp2                 |
| archive_day_soilTemp3                 |
| archive_day_soilTemp4                 |
| archive_day_supplyVoltage             |
| archive_day_txBatteryStatus           |
| archive_day_uvBatteryStatus           |
| archive_day_wind                      |
| archive_day_windBatteryStatus         |
| archive_day_windDir                   |
| archive_day_windGust                  |
| archive_day_windGustDir               |
| archive_day_windSpeed                 |
| archive_day_windchill                 |
| archive_day_windrun                   |
+---------------------------------------+
114 rows in set (0.00 sec)
Ecowitt GW1000 | WS-2902C |Weewx on Raspberry Pi
WU: KNMLOVIN14  |  PWSweather: PWSLOVNM1
CWOP: FW9112; https://lovingtonweather.com

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: GW1000 + Lightning Sensor
« Reply #5 on: April 15, 2021, 06:28:45 AM »
Yep - it looks as if at the database end all is already set.
It's now only about displaying the observations.
I'm not familiar with the Belchertown skin, but I assume that the general approach is similar (weewx.conf / skin.conf /index.html.tmpl).

I suggest you look up the respective files and see how it is done e.g. for outdoor temperature.
I would start with the WH51 as it is simpler and it's only one value from the sensor, whereas the WH57 provides three values.

So find your WH51 sensor name in the DB schema (soilMoist1 for the 1st sensor), or archive_day_soilMoist1 for the daily value.
Now add an entry for the WH51 and see what it gives. Probably some experimenting will be needed.

By the way, you can independently use the Seasons skin at the same time - its pictures/values will be in a different directory
(verify in weewx.conf that the Cheetah generator writes for Belchertown and Seasons to different directories: HTML_ROOT in the [StdReport] section).
You can have one weewx.conf and many skin.conf/index.html.tmpl per weewx.instance, one skin.conf etc. per skin in different (sub) directories of /etc/weewx/skins.
See below - skin = SKIN, where SKIN is the subdirectory name under /etc/weewx/skins/
[StdReport]
  [[SeasonsReport]]
        # The SeasonsReport uses the 'Seasons' skin, which contains the
        # images, templates and plots for the report.
        skin = Seasons
        enable = true
       HTML_ROOT=/var/www/html/weewx/Seasons

  [[Belchertown]]
.....
.....
        skin = Belchertown
        enable = true           
        HTML_ROOT=/var/www/html/weewx
# or HTML_ROOT=/var/www/html/weewx/Belchertown

for Belchertown that's an example/guess - might be different in your weewx.conf  (as I said, I'm not familiar with Belchertown) - important is that they write to different directories

Then you can get it working with Seasons first and later on move to Belchertown which may be (or not - just guessing) more complicated.
You can see the skin at http://IP address/HTML_ROOT (*)  e.g. http://192.168.1.77/weewx/Seasons if the HTML_ROOT=/var/www/html/weewx/Seasons
(the directory must exist [if not, sudo mkdir /var/www/html/weewx/Seasons] and must allow read access to the web server [sudo chmod -R 755 /var/www/html/weewx])

(*) of the Seasons skin - the Belchertown skin will have another one
« Last Edit: April 15, 2021, 06:40:21 AM by Gyvate »
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

 

anything