Adding lightening sensor to weewx

810 views
Skip to first unread message

dave.sp...@gmail.com

unread,
Jun 6, 2022, 6:16:10 PM6/6/22
to weewx...@googlegroups.com

Good afternoon all, I am trying to get the lightening detector sensor to show in weewx. The sensor is Acurite Atlas

 

I have added the following under [[sensor_map]]

        lightning_distance = strike_distance.0010.AcuriteAtlasPacket

        lightning_strike_count = strike_count.0010.AcuriteAtlasPacket

 

Any help getting this working would be great

 

Thanks

 

gjr80

unread,
Jun 6, 2022, 9:14:11 PM6/6/22
to weewx-user
Hi,

Going to need a little more info. What driver are you using? SDR? If so what does your weewx.conf [SDR] stanza contain? Again assuming SDR, have you run the driver directly as per the SDR readme? What does the WeeWX log show? Post a log extract with debug = 1 showing the full WeeWX startup and a couple of archive periods, this WeeWX wiki page will give you instructions on how to get such a log extract.

Gary

Mark Fraser

unread,
Jun 7, 2022, 6:26:31 AM6/7/22
to weewx...@googlegroups.com
I set up my lightning detector yesterday - a WH31L - which uses the SDR
driver and all I had to do was include these lines under [[sensor_map]]
and restart weewx. I'm now seeing a Lightning graph with the Seasons skin.

lightning_strike_count = strikes_total.52017.FOWH31LPacket
lightning_distance = distance.52017.FOWH31LPacket
txBatteryStatus = battery.52017.FOWH31LPacket
One thing I would like to do is add it to the Smartphone skin. Is this
easy to do?

dave.sp...@gmail.com

unread,
Jun 7, 2022, 6:19:27 PM6/7/22
to weewx...@googlegroups.com

Gary thanks for the reply. Sorry I didn’t provide enough data. So here it what I am running. My driver is SDR. I have verified that data is being received and stored into the database, but what I am not getting is any type of graph with the distance and strike counts on the web site. That is what I need help with. How do I make that show up?

 

I have included a log output

 

Thanks

Dave

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/cce095de-a364-4987-ad60-cae4f905c70fn%40googlegroups.com.

Strikes.txt

gjr80

unread,
Jun 7, 2022, 11:40:56 PM6/7/22
to weewx-user
Dave,

Thanks, the log is great resource for troubleshooting; if you include the WeeWX startup portion of the log it provides detail on how WeeWX is configured and if you have debug set high enough you get a good picture of what is going on. The log is the first place to look when things don't work.

It looks like the SDR driver is not being fed any data from rtl_433 that contains lightning related data. Your sensor map maps fields from AcuriteAtlasPacket packets (which appears to be correct) and correctly sets up lightning_strike_count as a delta:

Jun  7 16:14:29 raspberrypi weewx[25278] INFO user.sdr: sensor map is {'outTemp': 'temperature.0010.AcuriteAtlasPacket', 'outHumidity': 'humidity.0010.AcuriteAtlasPacket', 'windSpeed': 'wind_speed.0010.AcuriteAtlasPacket', 'windDir': 'wind_dir.0010.AcuriteAtlasPacket', 'UV': 'uv.0010.AcuriteAtlasPacket', 'rain_total': 'rain_total.0010.AcuriteAtlasPacket', 'radiation': 'lux.0010.AcuriteAtlasPacket', 'outTempBatteryStatus': 'battery.0010.AcuriteAtlasPacket', 'lightning_distance': 'strike_distance.0010.AcuriteAtlasPacket', 'lightning_strike_count': 'strike_count.0010.AcuriteAtlasPacket', 'luminosity': 'lux.0010.AcuriteAtlasPacket'}
Jun  7 16:14:29 raspberrypi weewx[25278] INFO user.sdr: deltas is {'rain': 'rain_total', 'lightning_strike_count': 'lightning_strike_count'}

but according to the log SDR is only seeing AcuriteTowerPacketV2 packets from rtl_433:

Jun  7 16:15:23 raspberrypi weewx[25278] INFO user.sdr: unmapped: ['{"time" : "2022-06-07 22:15:20", "model" : "Acurite-Tower", "id" : 9794, "channel" : "A", "battery_ok" : 1, "temperature_C" : 17.300, "humidity" : 48, "mic" : "CHECKSUM"}\n', '{"time" : "2022-06-07 22:15:20", "model" : "Acurite-Tower", "id" : 9794, "channel" : "A", "battery_ok" : 1, "temperature_C" : 17.300, "humidity" : 48, "mic" : "CHECKSUM"}\n'] ({'dateTime': 1654640120, 'usUnits': 16, 'protocol.2642.AcuriteTowerPacketV2': None, 'model.2642.AcuriteTowerPacketV2': 'Acurite-Tower', 'sensor_id.2642.AcuriteTowerPacketV2': '0000', 'channel.2642.AcuriteTowerPacketV2': 'A', 'temperature.2642.AcuriteTowerPacketV2': 17.3, 'humidity.2642.AcuriteTowerPacketV2': 48.0, 'battery.2642.AcuriteTowerPacketV2': 1, 'mod.2642.AcuriteTowerPacketV2': None, 'freq.2642.AcuriteTowerPacketV2': None, 'rssi.2642.AcuriteTowerPacketV2': None, 'snr.2642.AcuriteTowerPacketV2': None, 'noise.2642.AcuriteTowerPacketV2': None})
Jun  7 16:15:23 raspberrypi weewx[25278] INFO user.sdr: unmapped: ['{"time" : "2022-06-07 22:15:20", "model" : "Acurite-Tower", "id" : 9794, "channel" : "A", "battery_ok" : 1, "temperature_C" : 17.300, "humidity" : 48, "mic" : "CHECKSUM"}\n'] ({'dateTime': 1654640120, 'usUnits': 16, 'protocol.2642.AcuriteTowerPacketV2': None, 'model.2642.AcuriteTowerPacketV2': 'Acurite-Tower', 'sensor_id.2642.AcuriteTowerPacketV2': '0000', 'channel.2642.AcuriteTowerPacketV2': 'A', 'temperature.2642.AcuriteTowerPacketV2': 17.3, 'humidity.2642.AcuriteTowerPacketV2': 48.0, 'battery.2642.AcuriteTowerPacketV2': 1, 'mod.2642.AcuriteTowerPacketV2': None, 'freq.2642.AcuriteTowerPacketV2': None, 'rssi.2642.AcuriteTowerPacketV2': None, 'snr.2642.AcuriteTowerPacketV2': None, 'noise.2642.AcuriteTowerPacketV2': None})
Jun  7 16:15:23 raspberrypi weewx[25278] INFO user.sdr: unmapped: [] ({'dateTime': 1654640120, 'usUnits': 16, 'protocol.2642.AcuriteTowerPacketV2': None, 'model.2642.AcuriteTowerPacketV2': 'Acurite-Tower', 'sensor_id.2642.AcuriteTowerPacketV2': '0000', 'channel.2642.AcuriteTowerPacketV2': 'A', 'temperature.2642.AcuriteTowerPacketV2': 17.3, 'humidity.2642.AcuriteTowerPacketV2': 48.0, 'battery.2642.AcuriteTowerPacketV2': 1, 'mod.2642.AcuriteTowerPacketV2': None, 'freq.2642.AcuriteTowerPacketV2': None, 'rssi.2642.AcuriteTowerPacketV2': None, 'snr.2642.AcuriteTowerPacketV2': None, 'noise.2642.AcuriteTowerPacketV2': None})

I would take a step back and work through the How to diagnose problems section of the SDR readme. Start by running rtl_433 directly to see what packets it is picking up. If rtl_433 is not picking up any Acurite Atlas packets then SDR has no chance. I'm not an Acurite user but looking at some other threads on Acurite Atlas and SDR the Atlas seems to emit packets containing lightning data roughly every 15 seconds. By all means post the rtl_433 output if you wish.

Gary

dave.sp...@gmail.com

unread,
Jun 8, 2022, 8:49:17 PM6/8/22
to weewx...@googlegroups.com

Thanks for all the info you provided below, but I am still stumped. I only have one the Acurite Atlas with lightning detector and BME280. Might be thinking that my RTL-SDR is picking up other weather stations nearby.

 

I have attached separate files showing that the lightning distance and count that there is data there.

 

MySQL even shows that the data is there.

 

 

But the issue is on the website. There is no graph/data show lightning distance and strike count. Here is what the website is showing.

 

 

 

 

Any other ideas on what could be going on?

image001.png
image002.png
image003.png
sdr.txt
rtl.txt
weewxlog.txt

Andy

unread,
Jun 9, 2022, 10:29:28 AM6/9/22
to weewx-user
I have tried to get this to work with varying degrees of success. We seldom have lightning which makes troubleshooting more involved.

###
Comparing the raw output of your sdr driver (sdr.txt) with your sensor map in the first post, this looks correct. 

lightning_distance = strike_distance.0010.AcuriteAtlasPacket
lightning_strike_count = strike_count.0010.AcuriteAtlasPacket

parsed: {'dateTime': 1654733294, 'usUnits': 1, 'model.0010.AcuriteAtlasPacket': 'Acurite-Atlas', 'channel.0010.AcuriteAtlasPacket': 'A', 'sequence_num.0010.AcuriteAtlasPacket': 2, 'message_type.0010.AcuriteAtlasPacket': 39, 'strike_count.0010.AcuriteAtlasPacket': 27, 'strike_distance.0010.AcuriteAtlasPacket': 7, 'wind_speed.0010.AcuriteAtlasPacket': 8.0, 'uv.0010.AcuriteAtlasPacket': 1, 'lux.0010.AcuriteAtlasPacket': 45660, 'battery.0010.AcuriteAtlasPacket': 0}

###
And from the weewx log, we have a delta, which looks a bit odd:

INFO user.sdr: deltas is {'rain': 'rain_total', 'lightning_strike_count': 'lightning_strike_count'}

Reading here adds some background.

This is what I have, it may not be correct:

INFO user.sdr: deltas is {'lightning_strike_count': 'strikes_total', 'rain': 'rain_total'}

        lightning_distance = distance.3C47.AcuriteLightningPacket
        strikes_total = strikes_total.3C47.AcuriteLightningPacket

[StdCalibrate]

    [[Corrections]]
    
        #lightning_distance = lightning_distance if lightning_strike_count > 0 else None
        lightning_distance = None if lightning_strike_count == 0 or lightning_strike_count is None else lightning_distance

[Accumulator]
    [[lightning_strike_count]]
        extractor = sum
    [[lightning_distance]]
        extractor = min
        merger = minmax

Screenshot_2022-06-09_06-42-31.png
Screenshot_2022-06-09_07-28-30.png


root@debian:/home/weewx/skins/Seasons# sqlite3 /home/weewx/archive/weewx.sdb -header -column "select dateTime, lightning_distance, lightning_strike_count from archive where lightning_strike_count > 0 ORDER BY dateTime DESC LIMIT 10 ;"
dateTime    lightning_distance  lightning_strike_count
----------  ------------------  ----------------------
1654476300  28.0                1.0                  
1654434900  28.0                39.0                  
1654325400  28.0                128.0                
1653567000  28.0                39.0                  
1653128100  28.0                1.0                  
1653127800  28.0                1.0                  
1653095100  28.0                1.0                  
1652670600  0.0                 128.0                
1652222700  28.0                1.0                  
1652220600  15.0                2.0 

Andy

Greg Troxel

unread,
Jun 9, 2022, 10:42:19 AM6/9/22
to Andy, weewx-user

I am monitoring acurite strike data (6045M with rtl_433 not weewx).

One tricky thing about acurite is that strike count

1) is a cumulative count of strikes, so it needs differencing if you
want strikes in some interval. Presumably that's the count in the
archive interval for weewx.

2) rolls over from 255 to 0, so you also need to undo that if you want
cumulative count as a number. Then you need to figure out when you do
want to reset it, or how you want to deal with that, because the
un-wrapped value will increase without bound. But it will likely not
overflow an int32_t in your lifetime. I'm really unclear on how
people deal with this issue.

and then as your code indicates, distance is only valid in a
transmission where count has increased from the previous transmission.
That's complicated because if you miss a transmssion where it
increments, you miss it, but it seems the next one you will perceive the
incremented count and the distance will still be the same.

Hope this helps more than it is confounding.


signature.asc
Reply all
Reply to author
Forward
0 new messages