Interceptor and WH57 Lightning sensor from Ecowitt

903 views
Skip to first unread message

Gert Andersen

unread,
Jun 6, 2020, 4:28:48 AM6/6/20
to weewx-user
Hi

I get these infos from the log:

INFO user.interceptor: unrecognized parameter lightning_time=
INFO user.interceptor: unrecognized parameter lightning_num=0
INFO user.interceptor: unrecognized parameter lightning=
INFO user.interceptor: unrecognized parameter wh57batt=5

I could not see a new version at Github, the latest version include wh40 and is 4 month old. Seems to be version 0.53

Is there a newer version around which include the lightning sensor.

Gert

NanoG5Kite

unread,
Jun 6, 2020, 5:36:41 AM6/6/20
to weewx-user
Hi,

I can not really help you yet as my WH57 is not delivered yet, but on github:


Might this be an option to define a WH57 mapping in the weewx.conf?

Driver options

To configure the driver beyond the default values, set parameters in the
[Interceptor] section of the weewx configuration file.

As follows, but tweaked then for the WH57:

For hardware such as the GW1000 that use the ecowitt-client protocol, use the sensor_map_extensions to add/modify sensor mappings without having to specify the entire mapping. For example, this would use the readings from the first temperature sensor as the indoor temperature, and the readings from the fourth temperature sensor as the outdoor temperature. All of the other sensors would be mapped using the default sensor mapping for ecowitt-client. [Interceptor] driver = user.interceptor device_type = ecowitt-client ... [[sensor_map_extensions]] inTemp = temperature_1 inHumidity = humidity_1 outTemp = temperature_4 outHumidity = humidity_4

But just read this...:
https://github.com/matthewwall/weewx-interceptor/issues/69


NanoG5Kite

unread,
Jun 6, 2020, 5:48:05 AM6/6/20
to weewx-user
interceptor.py

Gert Andersen

unread,
Jun 6, 2020, 9:46:32 AM6/6/20
to weewx-user
Hi NanoG5Kite

Thanks for your help.

I guess I also must create the lightning fields in th DB or will the sensor map extension do that? 

I'm already at the patched version to solve another warning.

Gert

NanoG5Kite

unread,
Jun 6, 2020, 11:39:54 AM6/6/20
to weewx-user
Hi Gert,

I contacted Oliver for advise today - he is the "father" of the great generic Foshkplugin:

He answered and already and replied on Github:

Further he send me "his" today patched interceptor.py adressing this issue/his quick hack..
I guess (hope) he don´t mind, me attaching the file here... but maybe you like to give this a try...

Regards,

Matthias
interceptor.py

Benjamin Trey Blue

unread,
Jun 17, 2020, 8:12:23 PM6/17/20
to weewx-user
Hello,

Thank you for the patched interceptor driver - I just got a WH57 for my GW1000 and am trying to get the observations added to the WeeWX DB. With the patched driver, the lightning observations are showing in my raw packets:

weewx[29068] DEBUG user.interceptor: raw packet: {'wind_speed': 0.0, 'humidity_in': 44.0, 'temperature_in': 69.4, 'solar_radiation': 0.0, 'wind_gust': 1.12, 'wh65_battery': 0.0, 'lightning': '', 'humidity_out': 81.0, 'uv': 0.0, 'lightning_num': 0.0, 'rain': 0.0, 'dateTime': 1592366447, 'pressure': 30.076, 'temperature_out': 68.0, 'wind_dir': 314.0, 'wh57_battery': 5.0, 'rain_total': 0.0, 'lightning_time': '', 'rain_rate': 0.0, 'usUnits': 1}

I'm using WeeWX 4.1.0, so it's my understanding that the DB already has types for lightning_strike_count and lightning_distance, but when I map the 'lightning' observation tho the lightning_distance type, like so 

 [[sensor_map_extensions]]
        lightning_strike_count
= lightning_num
        lightning_distance
= lightning

then WeeWX shuts down after receiving one of the packets:

Jun 17 19:44:23 raspberrypi weewx[21398] DEBUG user.interceptor: mapped packet: {u'lightning_strike_count': 0.0, 'txBatteryStatus': 0.0, 'pressure': 30.014, 'outHumidity': 97.0, 'UV': 0.0, 'radiation': 7.7, u'lightning_distance': '', 'rain': None, 'dateTime': 1592437461, 'windDir': 130.0, 'outTemp': 71.1, 'windSpeed': 0.89, 'inHumidity': 58.0, 'inTemp': 76.3, 'windGust': 1.12, 'rainRate': 0.118, 'usUnits': 1}
Jun 17 19:44:23 raspberrypi weewx[21398] INFO weewx.engine: Main loop exiting. Shutting engine down.
Jun 17 19:44:23 raspberrypi weewx[21398] DEBUG weewx.restx: Shut down MQTT thread.
Jun 17 19:44:23 raspberrypi weewx[21398] DEBUG weewx.restx: Shut down PWSWeather thread.
Jun 17 19:44:23 raspberrypi weewx[21398] INFO user.interceptor: shutting down server thread
Jun 17 19:44:23 raspberrypi weewx[21398] DEBUG user.interceptor: stop tcp server
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__: Caught unrecoverable exception:
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****  could not convert string to float: 
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****  Traceback (most recent call last):
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****    File "/usr/share/weewx/weewxd", line 154, in main
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****      engine.run()
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 191, in run
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****      self.dispatchEvent(weewx.Event(weewx.NEW_LOOP_PACKET, packet=packet))
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 224, in dispatchEvent
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****      callback(event)
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 557, in new_loop_packet
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****      self.accumulator.addRecord(event.packet, add_hilo=self.loop_hilo)
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/accum.py", line 429, in addRecord
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****      func(self, record, obs_type, add_hilo, weight)
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/accum.py", line 487, in add_value
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****      self[obs_type].addHiLo(val, record['dateTime'])
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/accum.py", line 163, in addHiLo
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****      val = to_float(val)
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****    File "/usr/share/weewx/weeutil/weeutil.py", line 1250, in to_float
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****      return float(x) if x is not None else None
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****  ValueError: could not convert string to float: 
Jun 17 19:44:23 raspberrypi weewx[21398] CRITICAL __main__:     ****  Exiting.

This doesn't happen if I map lightning_strike_count = lightning_num only, just when I add in lightning_distance = lightning 

Does anyone have any recommendations for addressing this?

Thank you,
Trey

Gert Andersen

unread,
Jun 18, 2020, 11:44:40 AM6/18/20
to weewx-user
Hi

I did the same and got the same error.

Running Weewx 4.1.1

Gert
Message has been deleted

NanoG5Kite

unread,
Jun 18, 2020, 12:00:08 PM6/18/20
to weewx-user
Me too and I gave up for the moment...

I started now to investigate if PWS_Dashboard could be the better solution for me as more Sensors are supported, as well the WH57.
Also Wim gives a great support and feedback...

My PWS-Site, still not ready but operational..._

rich T

unread,
Jun 18, 2020, 12:28:22 PM6/18/20
to weewx-user

Looks like the driver is trying to convert the string to a float.

'lightning': ''




olicat

unread,
Jun 18, 2020, 2:44:27 PM6/18/20
to weewx-user
Hi,

I just made another attempt. Perhaps this helps ...


Regards, Oliver

oli-interceptor.zip

Benjamin Trey Blue

unread,
Jun 18, 2020, 3:46:51 PM6/18/20
to weewx-user
Thank you Oliver, I made that change and was able to start WeeWX with no errors - now just to wait for some lightning! 

Normally that's an almost every afternoon occurrence this time of year in Florida, but as my luck would have it, the forecast looks unusually clear right now.

Thank you for your work!

NanoG5Kite

unread,
Jun 18, 2020, 5:02:07 PM6/18/20
to weewx-user
Hi Oliver,

also many thanks from my site to jump in here again!

Will also test asap...

Best regards,

Matthias

Gert Andersen

unread,
Jun 19, 2020, 12:42:15 AM6/19/20
to weewx-user
Hi 
I'm also waiting to the next strike.

What do you do with the 2 other fields:
lightning_time
wh57batt

Currently they are not in the database, so have you updated the database with these fields or just forget them?

Thanks to Oliver for the help.

Gert

NanoG5Kite

unread,
Jun 19, 2020, 1:28:47 AM6/19/20
to weewx-user
Hi Gert,

I‘m not sure about the Battery Value, but has your sensor and gw1000 ever detected one strike before? You need this first strike to get all data points.

Br,

Matthias

Gert Andersen

unread,
Jun 19, 2020, 3:53:49 AM6/19/20
to weewx-user
Hi Matthias

Yes I have the data and data inserted into the DB. But with this setting:

[[sensor_map_extensions]]
        lightning_strike_count 
= lightning_num
        lightning_distance 
= lightning

You're missing this information:
lightning_time
wh57batt

Because these fields are not mapped to any fields in the DB. So the question is, should I extend the DB to include these fields or are there any other solution. What have you done? If you have done the mapping which types are you then mapping lightning_time and wh57batt to in the weewx.sdb.

I'm using the extended scheme.

Gert

NanoG5Kite

unread,
Jun 19, 2020, 6:28:10 AM6/19/20
to weewx-user
Hi Gert,

then you are further than me the last time and I also did another error last time, using:
[[sensor_map]]insteadt of [[sensor_map_extensions]]

So I have no really good answer for now. But will try also over the weekend.

What I know so far. The lightning_time is Unix time - so for now/noon something like :

1592562248 - for me without further conversion to a normal/understandable time string not usable...

Br, Matthias



John Burricelli

unread,
Jun 23, 2020, 11:11:30 AM6/23/20
to weewx-user
You would have to script it, but this command will convert the date.

# date -d @1592562248
Fri 19 Jun 06:24:08 EDT 2020

olicat

unread,
Jun 23, 2020, 3:51:37 PM6/23/20
to weewx-user
Hi!

Are there any experiences with the adjusted script regarding lightning?
Does it work for you now?

Regards, Oliver

NanoG5Kite

unread,
Jun 23, 2020, 11:35:43 PM6/23/20
to weewx-user
Oli, I don‘t think so. Possible most users like me do not have the (scripting/programming) skills to change necessary lines in the interceptor.py or weewx to adapt new/additional sensor values.
I gave up for the moment - Even if I could  get the lightning counts adapted, I would fail with the needed on the fly conversion of the unix time to normal time - last time strike... Without this time not useful for me at all and wasted time;-) As it seems  there is no process on the interceptor driver development, I take it as it is for now.

Regards,

Matthias

Gert Andersen

unread,
Jun 24, 2020, 12:46:53 AM6/24/20
to weewx-user
Hi Oliver

I'm using your patched script and it's working fine.

I insert these fields into th database:

[[sensor_map_extensions]]
        lightning_strike_count 
= lightning_num
        lightning_distance 
= lightning

These 2 fields are also coming from the sensor:

lightning_time
wh57batt

But can't be mapped right now as far as I can see. There are other lightning types in the extended scheme, but they don't fit with these.

It could also be very nice, to implement the PASSKEY functionality.

Gert

John Burricelli

unread,
Jun 24, 2020, 7:51:03 AM6/24/20
to weewx-user
I had a decent storm come through last night with nearly 50 reported lightning strikes via my ecowitt app.  As far as i can tell however nothing is being inserted into the database.

INSERT INTO archive_day_lightning_energy VALUES(1592884800,NULL,NULL,NULL,NULL,0.0,0,0.0,0);
INSERT INTO archive_day_lightning_energy VALUES(1592971200,NULL,NULL,NULL,NULL,0.0,0,0.0,0);
CREATE TABLE archive_day_lightning_noise_count (dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY, min REAL, mintime INTEGER, max REAL, maxtime INTEGER, sum REAL, count INTEGER, wsum REAL, sumtime INTEGER);
INSERT INTO archive_day_lightning_noise_count VALUES(1592884800,NULL,NULL,NULL,NULL,0.0,0,0.0,0);
INSERT INTO archive_day_lightning_noise_count VALUES(1592971200,NULL,NULL,NULL,NULL,0.0,0,0.0,0);
CREATE TABLE archive_day_lightning_strike_count (dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY, min REAL, mintime INTEGER, max REAL, maxtime INTEGER, sum REAL, count INTEGER, wsum REAL, sumtime INTEGER);
INSERT INTO archive_day_lightning_strike_count VALUES(1592884800,NULL,NULL,NULL,NULL,0.0,0,0.0,0);
INSERT INTO archive_day_lightning_strike_count VALUES(1592971200,NULL,NULL,NULL,NULL,0.0,0,0.0,0);

John Burricelli

unread,
Jun 24, 2020, 8:13:38 AM6/24/20
to weewx-user
Also, has anyone been able to run the driver manually?  I get this error when I try it that way.

$ PYTHONPATH=bin python /usr/share/weewx/user/interceptor.py --device=ecowitt --mode=listen --port=8000
Traceback (most recent call last):
  File "/usr/share/weewx/user/interceptor.py", line 302, in <module>
    import weewx.drivers
ImportError: No module named weewx.drivers

gjr80

unread,
Jun 24, 2020, 10:42:03 AM6/24/20
to weewx-user
Your PYTHONPATH needs to include /usr/share/weewx. Try using:

$ PYTHONPATH=/usr/share/weewx python ......


Gary

John Burricelli

unread,
Jun 24, 2020, 10:51:40 AM6/24/20
to weewx-user
I got it to work, in addition to your help, I had to change python to python3 for some reason

# PYTHONPATH=/usr/share/weewx python3 /usr/share/weewx/user/interceptor.py --device=ecowitt-client --mode=listen --port=8000
mapped packet: {'dateTime': 1593010224, 'usUnits': 1, 'pressure': 29.202, 'inHumidity': 56.0, 'inTemp': 74.8}

gjr80

unread,
Jun 24, 2020, 11:06:33 AM6/24/20
to weewx-user
The interceptor driver is python 2/3 compatible. Most likely you only have the WeeWX python 3 prerequisites installed and hence running the driver under python 2 failed.

Gary

Vetti52

unread,
Jun 28, 2020, 6:38:42 AM6/28/20
to weewx-user

Am Saturday, 6. June 2020 11:48:05 UTC+2 NanoG5Kite wrote:

This commit will also avoid this kind of messages, which occurres after upgrading to python3:

weewx[18921] INFO user.interceptor: unrecognized parameter b'PASSKEY=

It will hopefully be included into the next version of interceptor.py


 
Reply all
Reply to author
Forward
0 new messages