Reference: https://github.com/weewx/weewx/wiki/Accumulators
1. It says that lightning_strike_count is one of the default accumulator
variables, so I believe that means I do NOT need to declare it in an
[Accumulators] section of weewx.conf?
2. Where do I put the code that alerts WeeWX that a lightning strike
occurred?
In the [MQTTSubscribeService] section of the weewx.conf file?
3. How do I tell WeeWX that a lightning strike has occurred?
Set lightning_strike_count =1 and let the accumulator function add 1 to the
total for me?
Like this?
[MQTTSubscribeService]
[[[tele/AS3935/SENSOR]]]
[[[[Time]]]]
ignore = true
[[[[AS3935_Event]]]]
# Use the default variable name from MQTT
# MQTT messages with and event value in the following will
be ignored.
filter_out_message_when = 0, 2, 3, 4, 5, 6, 7, 8, 9
conversion_type = int
* lightning_strike_count = 1*
[[[[AS3935_Distance]]]]
# Use the default variable name from MQTT.
[[[[AS3935_Energy]]]]
name = lightning_energy
[[[[AS3935_Stage]]]]
ignore = true
On Friday, June 25, 2021 at 8:15:48 PM UTC-5 Eric K wrote:
> I've made some progress and I have MQTT messages getting received into
> MQTTSubscribe and put into the weewx database file!
>
> Here's the relevant section from the MQTTSubscribe section of weewx.conf:
>
> *[MQTTSubscribeService]*
>
> * enable = true*
>
> * host = localhost*
>
> * port = 1883*
>
> * keepalive = 60*
>
> * username = None*
>
> * password = None*
>
> * binding = loop*
>
> * [[message_callback]]*
>
> * type = json*
>
> * [[[tele/AS3935/SENSOR]]]*
> * [[[[Time]]]]*
> * ignore = true*
>
> * [[[[AS3935_Event]]]]*
> * # Use the default variable name from MQTT*
> * # MQTT messages with and event value in the following
> will be ignored.*
> * filter_out_message_when = 0, 2, 3, 4, 5, 6, 7, 8, 9*
> * conversion_type = int*
>
> * [[[[AS3935_Distance]]]]*
> * # Use the default variable name from MQTT.*
>
> * [[[[AS3935_Energy]]]]*
> * name = lightning_energy*
>
> * [[[[AS3935_Stage]]]]*
> * ignore = true*
>
> Here are a few lines from the /var/log/syslog showing the AS3935 messages
> coming in and getting conditionally ignored.
> So, we know that part is working.
>
>
> *Jun 25 19:50:46 pi3 weewx[31711] DEBUG user.MQTTSubscribe: (Service)
> MessageCallbackProvider data-> incoming topic: tele/AS3935/SENSOR, QOS: 0,
> retain: 0, payload:
> b'{"Time":"2021-06-25T19:50:46","AS3935":{"Event":0,"Distance":0,"Energy":0,"Stage":7}}'*
> *Jun 25 19:50:46 pi3 weewx[31711] INFO user.MQTTSubscribe: (Service)
> MessageCallbackProvider on_message_json filtered out tele/AS3935/SENSOR :
> b'{"Time":"2021-06-25T19:50:46","AS3935":{"Event":0,"Distance":0,"Energy":0,"Stage":7}}'
>
> with AS3935_Event=[0, 2, 3, 4, 5, 6, 7, 8, 9]*
>
> Then, in the Corrections section of weewx.conf, I am using a conditional
> statement to assign the AS3935 distance data to the weewx stock variable
> lightning_distance.
> I wasn't sure if my syntax was correct, but lightning distance data is
> appearing in the weewx database, so it appears to be working.
>
> *[StdCalibrate]*
>
> * [[Corrections]]*
>
> * outTemp = outTemp - 1.5*
> * barometer = barometer + 1.23*
> * lightning_distance = AS3935_Distance if AS3935_Event == 1 else
> None*
>
> Finally, I looked in the weewx.sdb database file and saw 3 lightning
> events listed in the variables lightning_distance and lightning_energy!
> See attached.
>
> I don't have the lightning_strike_count getting accumulated, yet....have
> to try and figure out which of the accumulator type to use.
>
> Progress.....
>
>
>
>
>
>
>
>
> On Wednesday, June 16, 2021 at 1:37:57 PM UTC-5 Eric K wrote:
>
>> Very cool, Rich!
>> I'll put some effort into it.
>>
>> Based on your earlier coaching, I've been able to successfully accept
>> MQTT data from every sensor I've tried, including from a Sonoff Zigbee
>> Bridge with a bunch of Sonoff SNZB-02 temperature sensors!
>>
>> [[[tele/ZBBridge/SENSOR]]]
>> # 0x4472 is #10 Living Room
>> [[[[ZbReceived_0x4472_Device]]]]
>> ignore = true
>>
>> [[[[ZbReceived_0x4472_Name]]]]
>> ignore = true
>>
>> [[[[ZbReceived_0x4472_Temperature]]]]
>> # The WeeWX name.
>> # Default is the name from MQTT.
>> name = inTemp
>>
>> [[[[ZbReceived_0x4472_Humidity]]]]
>> # The WeeWX name.
>> # Default is the name from MQTT.
>> name = inHumidity
>>
>> [[[[ZbReceived_0x4472_BatteryVoltage]]]]
>> ignore = true
>>
>> [[[[ZbReceived_0x4472_BatteryPercentage]]]]
>> ignore = true
>>
>> [[[[ZbReceived_0x4472_Endpoint]]]]
>> ignore = true
>>
>> [[[[ZbRecieved_0x4472_LinkQuality]]]]
>> ignore = true
>>
>>
>> On Wednesday, June 16, 2021 at 1:00:18 PM UTC-5 [email protected] wrote:
>>
>>> Eric,
>>> For (2), MQTTSubscribe has a 'filter_out_message_when' option. So, you
>>> would to do something like this in the MQTTSubscribe section
>>> [[topics]]
>>> [[[tele/AS3935/SENSOR]]]
>>> [[[[AS3935_Event]]]]
>>> ignore = True
>>> # MQTT messages with and event value in the following will be ignored.
>>> filter_out_message_when = 0, 2, 3, 4, 5, 6, 7, 8, 9
>>> conversion_type = int
>>> .
>>> .
>>> .
>>>
>>> A bit more detail on this option can be found here,
>>> https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring-additional-options#filter_out_message_when
>>> There is some background information here,
>>> https://github.com/bellrichm/WeeWX-MQTTSubscribe/discussions/112
>>>
>>> For (3), read up on WeeWX accumulators here,
>>> https://github.com/weewx/weewx/wiki/Accumulators
>>>
>>> If you get this working, this is exactly the type of MQTTSubscribe
>>> configuration that I would like to capture as an example to help others in
>>> the future.
>>> - Rich
>>>
>>>
>>> On Tuesday, 15 June 2021 at 19:35:19 UTC-4 Eric K wrote:
>>>
>>>> I just assembled this exact setup - AS3935 board with a Wemos D1 mini
>>>> clone and Tasmota 9.4.0 sensor firmware.
>>>> I didn't snap a picture before I deployed it, but it looks very much
>>>> like the attached photo.
>>>> I followed this page: https://tasmota.github.io/docs/AS3935/
>>>>
>>>> Its working and I'm getting live data in the Tasmota web interface.
>>>> I named it AS3935 in the Tasmota MQTT setup and it's sending telemetry
>>>> to my mosquitto MQTT broker.
>>>> The MQTT transmissions (seen from the Tasmota console) look like the
>>>> example on the tasmota.github AS3935 page:
>>>> 18:07:21.164 MQT: tele/AS3935/SENSOR =
>>>> {"Time":"2021-06-15T18:07:21","AS3935":{"Event":0,"Distance":0,"Energy":0,"Stage":7}}
>>>>
>>>> I think I need to:
>>>> 1. set the Tasmota setting AS3935lightevent to 1 so it only sends MQTT
>>>> messages when there is a lightning strike registered.
>>>> 2. set up weewx to read the MQTT Event variable so I only react to a
>>>> valid lightning strike with distance (event 1)
>>>> 3. Set up the lightning_count variable as an accumulator?
>>>>
>>>> I'm not quite sure:
>>>> 1. how often I should set Tasmota's MQTT report period so I don't miss
>>>> counting a lightning strike? Once per second?
>>>> 2. how to set up a conditional statement in the MQTTSubscribe section
>>>> of weewx.conf to increment the lightning_count only when valid lightning
>>>> events occur.
>>>>
>>>> I'll be looking for example weewx.conf file settings that deal with the
>>>> AS3935.
>>>> On Sunday, December 6, 2020 at 12:51:45 PM UTC-6 [email protected]
>>>> wrote:
>>>>
>>>>> Hello guys,
>>>>> did anyone tried to use *Lightning sensor AS3935* tinkered on cheap
>>>>> *ESP8266* with WeeWX?
>>>>>
>>>>> A time ago, I was user of Tasmota ESP8266 firmware and I know, it can
>>>>> publish MQTT + JSON data. Here is the manual how to tinker and flash
>>>>> those
>>>>> two together:
>>>>> https://tasmota.github.io/docs/AS3935/
>>>>> I assume, that with JSON / MQTT it would be prety easy to fill WeeWX
>>>>> database...
>>>>>
>>>>> Thanks,
>>>>> Miso,
>>>>> Slovakia
>>>>>
>>>>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/a5338646-58e0-462b-8943-e0559107d462n%40googlegroups.com.