I forgot about the [SDR] section of the weewx.conf file.
weewx needs to convert the lightning strike count reported by the Acurite 
Atlas to a lightning strike delta number.
This is because the Atlas counts up lightning strikes and keeps 
incrementing the accumulated strike number (such as 5).
When the next strike ocurrs the Atlas will increment the number to 6, and 
so on.
You need weewx to watch for a change in that Atlas lightning strike number 
and report that difference (delta) between the last count and the current 
count.

from my weewx.conf file:
##############################################################################

[SDR]
    # This section is for the software-defined radio driver.
    # collect data from Acurite-Atlas sensor 0011
    
    # The driver to use
    driver = user.sdr
    cmd = rtl_433 -R 40 -M utc -F json
    
    [[sensor_map]]
        outTemp = temperature.0011.AcuriteAtlasPacket
        outHumidity = humidity.0011.AcuriteAtlasPacket
        windSpeed = wind_speed.0011.AcuriteAtlasPacket
        windDir = wind_dir.0011.AcuriteAtlasPacket
        UV = uv.0011.AcuriteAtlasPacket
        luminosity = lux.0011.AcuriteAtlasPacket
        Atlas_rain_total = rain_total.0011.AcuriteAtlasPacket
        Atlas_strike_count = strike_count.0011.AcuriteAtlasPacket
        lightning_distance = strike_distance.0011.AcuriteAtlasPacket
        windBatteryStatus = battery.0011.AcuriteAtlasPacket
        batteryStatus1 = battery.0011.AcuriteAtlasPacket
    
    [[deltas]]
        rain = Atlas_rain_total
        lightning_strike_count = Atlas_strike_count

##############################################################################

On Tuesday, June 13, 2023 at 1:58:17 PM UTC-5 Kevin Crivelli wrote:

> I added the line 
> lightning_distance = lightning_distance / 1.609 if lightning_strike_count 
> > 0 else None    #convert distance to miles 
>
> to the [StdCalibrate] [[Corrections]] section and I added your chart to my 
> graphs.conf 
>
> I am still getting the persistant distance of 5 miles as per the last 
> lightning distance that was recorded weeks ago. not sure where to go from 
> here but thank you for providing all of that for me. 
>
> [image: lightning5.JPG]
>
>
> On Sunday, June 11, 2023 at 5:09:28 PM UTC-4 Eric K wrote:
>
>> Hi Kevin,
>>
>> In the graphs.conf file (Belchertown skin) I have this:
>>
>>     [[chart6]]
>>         title = Lightning
>>         [[[lightning_strike_count]]]
>>             yAxis = 0
>>             yAxis_min = 0
>>             yAxis_tickInterval = 1
>>             yAxis_label = "Number of Strikes"
>>             stacking = normal
>>             color = "orange"
>>             lineWidth = 0
>>             [[[[marker]]]]
>>                 enabled = true
>>                 radius = 4
>>             [[[[states]]]]
>>                 [[[[[hover]]]]]
>>                         lineWidthPlus = 0                
>>         [[[lightning_distance]]]
>>             yAxis = 1
>>             yAxis_min = 0
>>             yAxis_label = "Distance (miles)"
>>             stacking = normal
>>             color = "blue"
>>             lineWidth = 0
>>             [[[[marker]]]]
>>                 enabled = true
>>                 radius = 3
>>             [[[[states]]]]
>>                 [[[[[hover]]]]]
>>                         lineWidthPlus = 0     
>>
>>
>> For the distance correction (conversion to miles) I have an entry in the 
>> StdCalibrate section of weewx.conf:
>>
>> ##############################################################################
>>
>> #   This section can adjust data using calibration expressions.
>>
>> [StdCalibrate]
>>     
>>     [[Corrections]]
>>         # For each type, an arbitrary calibration expression can be given.
>>         # It should be in the units defined in the StdConvert section.
>>         # Example:  foo = foo + 0.2
>>         outTemp = outTemp + 0.0
>>         barometer = barometer + 1.025
>>         radiation = luminosity * 0.00789 if luminosity > 0 else None
>>         lightning_distance = lightning_distance / 1.609 if 
>> lightning_strike_count > 0 else None    #convert distance to miles
>>
>>
>> ##############################################################################
>>
>>
>>
>> On Sunday, June 11, 2023 at 3:36:30 PM UTC-5 Kevin Crivelli wrote:
>>
>> Eric K, could you provide the chart.conf configuration for that chart and 
>> also what ended up being the correct way to add the correction in 
>> weewx.conf? Your chart is essentially what I am trying to accomplish
>>
>> On Tuesday, May 25, 2021 at 12:36:09 PM UTC-4 Eric K wrote:
>>
>> It's working as desired now!
>> Thanks for noticing the incorrect location of the [[Corrections]]
>>
>> [image: lightning_distance working.JPG]
>>
>> On Monday, May 24, 2021 at 7:39:25 AM UTC-5 gjr80 wrote:
>>
>> I can't explain it, it would require some detailed knowledge of how the 
>> Acurite lightning sensor behaves. For example, the Ecowitt lightning sensor 
>> reports distance when strikes are detected and that distance value persists 
>> for some time before eventually reporting 0. If you had debug logging of 
>> the SDR output (as you have in the log extract above) going on for some 
>> time previous you could probably work through the log looking at the 
>> distance value being obtained by the SDR driver from the Acurite. One thing 
>> is certain though, the SDR driver was not applying the correction as the 
>> SDR driver contains no code to read those config settings. And if the 
>> correction was not under [StdCalibrate] [[Corrections]] then WeeWX wasn't 
>> applying the correction either.
>>
>> Might just have to remain a mystery.
>>
>> Gary
>>
>> On Monday, 24 May 2021 at 07:33:56 UTC+10 Eric K wrote:
>>
>> Thanks for the pointer.  
>> I also had a [[Corrections]] sections under [StdCalibrate].
>>
>> I just moved the lightning_distance correction to the [StdCalibrate] 
>> section.
>> We'll see if that helps.
>>
>> Isn't it odd that it worked, when the lightning_distance was something 
>> other than 10?    
>>
>>
>> On Sunday, May 23, 2021 at 3:10:54 PM UTC-5 gjr80 wrote:
>>
>> I think you might find the [[Corrections]] stanza belongs under 
>> [StdCalibrate] <http://weewx.com/docs/usersguide.htm#StdCalibrate> 
>> rather than the SDR driver.
>>
>> Gary
>> On Monday, 24 May 2021 at 02:32:14 UTC+10 Eric K wrote:
>>
>> Here's a relevant section of the log which shows the Acurite Atlas 
>> lightning sensor sending the last distance (10) reading over and over.  
>> This is expected Acurite Atlas behavior, and the reason we have to put 
>> the "if > 0 else None" statement in our [[Corrections]] section.
>>
>> Referring back to the 5.64705882352941 value seen in my database:
>> I wonder if weewx isn't expecting a decimal reading to be in 
>> lightning_distance?
>> And that sends it into confusion?
>>
>> May 23 10:56:24 Ubuntu20-WEEWX weewx[14069] DEBUG user.sdr: 
>> lines=['{"time" : "2021-05-23 15:56:20", "model" : "Acurite-Atlas", "id" : 
>> 17, "channel" : "A", "sequence_num" : 0, "battery_ok" : 1, "message_type" : 
>> 38, "wind_avg_mi_h" : 4.000, "wind_dir_deg" : 190.000, "rain_in" : 2.040, 
>> "strike_count" : 45, "strike_distance" : 10, "exception" : 0, "raw_msg" : 
>> "c011668205f9cc8baab8"}\n', '{"time" : "2021-05-23 15:56:20", "model" : 
>> "Acurite-Atlas", "id" : 17, "channel" : "A", "sequence_num" : 1, 
>> "battery_ok" : 1, "message_type" : 38, "wind_avg_mi_h" : 4.000, 
>> "wind_dir_deg" : 190.000, "rain_in" : 2.040, "strike_count" : 45, 
>> "strike_distance" : 10, "exception" : 0, "raw_msg" : 
>> "c411668205f9cc8baabc"}\n', '{"time" : "2021-05-23 15:56:20", "model" : 
>> "Acurite-Atlas", "id" : 17, "channel" : "A", "sequence_num" : 2, 
>> "battery_ok" : 1, "message_type" : 38, "wind_avg_mi_h" : 4.000, 
>> "wind_dir_deg" : 190.000, "rain_in" : 2.040, "strike_count" : 45, 
>> "strike_distance" : 10, "exception" : 0, "raw_msg" : 
>> "c811668205f9cc8baac0"}\n']
>> May 23 10:56:24 Ubuntu20-WEEWX weewx[14069] DEBUG user.sdr: 
>> packet={'windSpeed': 4.0, 'windDir': 190.0, 'Atlas_rain_total': 2.04, 
>> 'Atlas_strike_count': 45, 'lightning_distance': 10, 'windBatteryStatus': 0, 
>> 'dateTime': 1621785380, 'usUnits': 1}
>> May 23 10:56:24 Ubuntu20-WEEWX weewx[14069] DEBUG user.MQTTSubscribe: 
>> (Service) data-> final packet is 2021-05-23 10:56:20 CDT (1621785380): 
>> Atlas_rain_total: 2.04, Atlas_strike_count: 45, dateTime: 1621785380, 
>> lightning_distance: 10, lightning_strike_count: 0, rain: 0.0, usUnits: 1, 
>> windBatteryStatus: 0, windDir: 190.0, windSpeed: 4.0
>> May 23 10:56:24 Ubuntu20-WEEWX weewx[14069] DEBUG user.sdr: 
>> packet={'windSpeed': 4.0, 'windDir': 190.0, 'Atlas_rain_total': 2.04, 
>> 'Atlas_strike_count': 45, 'lightning_distance': 10, 'windBatteryStatus': 0, 
>> 'dateTime': 1621785380, 'usUnits': 1}
>> May 23 10:56:24 Ubuntu20-WEEWX weewx[14069] DEBUG user.MQTTSubscribe: 
>> (Service) data-> final packet is 2021-05-23 10:56:20 CDT (1621785380): 
>> Atlas_rain_total: 2.04, Atlas_strike_count: 45, dateTime: 1621785380, 
>> lightning_distance: 10, lightning_strike_count: 0, rain: 0.0, usUnits: 1, 
>> windBatteryStatus: 0, windDir: 190.0, windSpeed: 4.0
>> May 23 10:56:24 Ubuntu20-WEEWX weewx[14069] DEBUG user.sdr: 
>> packet={'windSpeed': 4.0, 'windDir': 190.0, 'Atlas_rain_total': 2.04, 
>> 'Atlas_strike_count': 45, 'lightning_distance': 10, 'windBatteryStatus': 0, 
>> 'dateTime': 1621785380, 'usUnits': 1}
>> May 23 10:56:24 Ubuntu20-WEEWX weewx[14069] DEBUG user.MQTTSubscribe: 
>> (Service) data-> final packet is 2021-05-23 10:56:20 CDT (1621785380): 
>> Atlas_rain_total: 2.04, Atlas_strike_count: 45, dateTime: 1621785380, 
>> lightning_distance: 10, lightning_strike_count: 0, rain: 0.0, usUnits: 1, 
>> windBatteryStatus: 0, windDir: 190.0, windSpeed: 4.0
>> May 23 10:56:27 Ubuntu20-WEEWX weewx[14069] DEBUG user.sdr: lines=[]
>> May 23 10:56:29 Ubuntu20-WEEWX weewx[14069] DEBUG user.MQTTSubscribe: 
>> (Service) MessageCallbackProvider data-> incoming topic: 
>> tele/BMP280/SENSOR, QOS: 0, retain: 0, payload: 
>> b'{"Time":"2021-05-23T10:56:30","BMP280":{"Temperature":20.2,"Pressure":985.1},"PressureUnit":"hPa","TempUnit":"C"}'
>> May 23 10:56:29 Ubuntu20-WEEWX weewx[14069] DEBUG user.MQTTSubscribe: 
>> (Service) TopicManager data-> incoming tele/BMP280/SENSOR: appTemp1: 20.2, 
>> barometer: 985.1
>>
>>
>> On Sunday, May 23, 2021 at 11:19:26 AM UTC-5 Eric K wrote:
>>
>> I am seeing a weird problem with the lightning distance value, where the 
>> distance gets stuck reporting 10!
>>
>> I copied the [[Corrections]] scheme shown earlier in this thread.  
>> I'm pretty sure I got it right, because it works most of the time.
>>
>>
>> ##############################################################################
>>
>> [SDR]
>>     # This section is for the software-defined radio driver.
>>     # collect data from Acurite Atlas sensor
>>     
>>     # The driver to use
>>     driver = user.sdr
>>     cmd = rtl_433 -R 40 -M utc -F json
>>     
>>     [[sensor_map]]
>>         outTemp = temperature.0011.AcuriteAtlasPacket
>>         outHumidity = humidity.0011.AcuriteAtlasPacket
>>         windSpeed = wind_speed.0011.AcuriteAtlasPacket
>>         windDir = wind_dir.0011.AcuriteAtlasPacket
>>         UV = uv.0011.AcuriteAtlasPacket
>>         luminosity = lux.0011.AcuriteAtlasPacket
>>         Atlas_rain_total = rain_total.0011.AcuriteAtlasPacket
>>         Atlas_strike_count = strike_count.0011.AcuriteAtlasPacket
>>         lightning_distance = strike_distance.0011.AcuriteAtlasPacket
>>         windBatteryStatus = battery.0011.AcuriteAtlasPacket
>>         
>>     [[deltas]]
>>         rain = Atlas_rain_total
>>         lightning_strike_count = Atlas_strike_count
>>     
>>     [[Corrections]]
>>         lightning_distance = lightning_distance if lightning_strike_count 
>> > 0 else None
>>                 
>>
>> ##############################################################################
>>
>> But, I've now seen several storms with lightning and and the 
>> lightinig_distance value gets stuck reporting 10 forever after!
>> I see the 10 repeating in the database, so I believe that weewx is 
>> generating that number and sending it into the database.
>>
>> Here's a look in the database using DB Browser for SQLite.  
>> Note how a distance value of 5.64705882352941 from the Acurite Atlas 
>> appears and then it's 10 thereafter.
>> You can see the lightning_strike_count is zero.  
>> The "else None" part of the condition statement appears to stop working?
>>
>> [image: ksnip_20210523-111132.png]
>>
>> On Thursday, July 23, 2020 at 5:55:55 AM UTC-5 tarob...@gmail.com wrote:
>>
>> Thank you for the detailed explanation Gary! I have added the 
>> [Accumulator] section to my weewx.conf for lightning_strike_count -> 
>> extractor = sum and lightning_distance -> extractor = min. Now to wait for 
>> another storm.
>>
>>
>> -Troy 
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/dd45feba-9359-43b8-976a-44e1573f3009n%40googlegroups.com.

Reply via email to