lightning sensor made at home cheaply

980 views
Skip to first unread message

miso k

unread,
Dec 6, 2020, 1:51:45 PM12/6/20
to weewx-user
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:
I assume, that with JSON / MQTT it would be prety easy to fill WeeWX database...

Thanks,
Miso,
Slovakia

Eric K

unread,
Jun 15, 2021, 7:35:19 PM6/15/21
to weewx-user
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.
AS3935 & Tasmota Template.JPG
GY-AS3935 i2c config.JPG
AS3935 & Tasmota.JPG
PXL_20210527_033553036.PORTRAIT (Custom).jpg

bell...@gmail.com

unread,
Jun 16, 2021, 2:00:18 PM6/16/21
to weewx-user
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
  .
  .
  .
  
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

Eric K

unread,
Jun 16, 2021, 2:37:57 PM6/16/21
to weewx-user
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

Eric K

unread,
Jun 25, 2021, 9:15:48 PM6/25/21
to weewx-user
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.....








AS3935 lightning data 6-22-2021 6-15am.JPG
AS3935 lightning data 6-24-2021 4-00pm.JPG
AS3935 lightning data 6-21-2021 12-10pm.JPG

Eric K

unread,
Jun 27, 2021, 7:15:41 PM6/27/21
to weewx-user
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

bell...@gmail.com

unread,
Jun 28, 2021, 1:06:40 PM6/28/21
to weewx-user
Eric,
That is great that you have something working. Since it is working, I wouldn't change anything. But, I am surprised that you needed 'lightning_distance = AS3935_Distance if AS3935_Event == 1 else None'  in the StdCalibrate section. With MQTTSubscribe filtering by event values, I would have thought the following would have been enough.
[[[[AS3935_Distance]]]]
  name = lightning_distance

Anyway, happy to hear that have something working. 
rich

bell...@gmail.com

unread,
Jun 28, 2021, 2:15:50 PM6/28/21
to weewx-user
Eric,
I would think just renaming AS3935_Event to lightning_strike_count (via name = lightning_strike_count) should work. This gets the value into the WeeWX pipeline and since lightning_strike_count has a default accumulator that extracts the sum, you should be all set. Meaning something like this.
[[[[AS3935_Event]]]]
  # 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
  name = lightning_strike_count
rich

On Sunday, 27 June 2021 at 19:15:41 UTC-4 Eric K wrote:

Eric Koester

unread,
Jun 28, 2021, 2:45:17 PM6/28/21
to weewx...@googlegroups.com
Thanks for that idea, Rich.

Yesterday, I opened up the AS3935_Event to allow event 4 to pass through, because event 4 is "storm overhead".
So, now the AS3935_Event message could contain a 1 or a 4.

[[[AS3935_Event]]]
    filter_out_message_when = 0, 2, 3, 5, 6, 7, 8, 9
    conversion_type = int

I am trying this correction to change the event number to be a 1.

[StdCalibrate]
    [[Corrections]]
        outTemp = outTemp - 1.5
        barometer = barometer + 1.23
        lightning_strike_count = 1 if AS3935_Event > 0 else None

I'll report back on the results.





--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/TaLWUitdDmE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/6ed65ff9-fede-41c0-b38e-3270a9aef9dbn%40googlegroups.com.

Eric Koester

unread,
Jun 28, 2021, 6:51:11 PM6/28/21
to weewx...@googlegroups.com
IT'S WORKING!  
There is another thunderstorm approaching and it's capturing distances AND strike count!
image.png

Eric K

unread,
Jun 28, 2021, 7:16:40 PM6/28/21
to weewx-user
There we go! 
Now, I have proof its counting higher than 1!  :)


AS3935 Lightning sensor working.PNG

Here's my graph config from the Belchertown graphs.conf file:

    [[chart3]]
        title = Lightning
        [[[lightning_strike_count]]]
            yAxis = 0
            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_label = "Distance (miles)"
            stacking = normal
            color = "blue"
            lineWidth = 0
            [[[[marker]]]]
                enabled = true
                radius = 3
            [[[[states]]]]
                [[[[[hover]]]]]
                        lineWidthPlus = 0

These are my settings in the Tasmota firmware for the AS3935:
17:48:03.739 CMD: AS3935settings
17:48:03.753 MQT: tele/AS3935/RESULT = {"AS3935_Settings":{"Gain":"Indoors","NFfloor":7,"uVrms":146,"Tunecaps":2,"MinNumLight":1,"Rejection":2,"Wdthreshold":2,"MinNFstage":0,"NFAutoTime":4,"DisturberAutoTime":1,"Disturber":"On","NFauto":"Off","Disturberauto":"Off","NFautomax":"On","Mqttlightevent":"On","Mqttnoirqevent":"On"}}
The last 2 surpress MQTT messages when there's no lightning events.
Reference:  https://tasmota.github.io/docs/AS3935/

There have been a LOT of close strikes detected in the last 15 mintues!
This is from the Tasmota console of the ESP-12F module (with AS3935 sensor connected):
17:58:07.173 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T17:58:07","AS3935":{"Event":4,"Distance":1,"Energy":372650,"Stage":7}}
17:58:34.168 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T17:58:34","AS3935":{"Event":4,"Distance":1,"Energy":155946,"Stage":7}}
17:59:36.153 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T17:59:36","AS3935":{"Event":4,"Distance":1,"Energy":0,"Stage":7}}
18:00:02.150 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:00:02","AS3935":{"Event":4,"Distance":1,"Energy":77455,"Stage":7}}
18:00:14.167 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:00:14","AS3935":{"Event":4,"Distance":1,"Energy":14477,"Stage":7}}
18:01:34.195 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:01:34","AS3935":{"Event":4,"Distance":1,"Energy":16,"Stage":7}}
18:01:54.162 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:01:54","AS3935":{"Event":4,"Distance":1,"Energy":42975,"Stage":7}}
18:02:33.154 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:02:33","AS3935":{"Event":4,"Distance":1,"Energy":55903,"Stage":7}}
18:04:02.170 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:04:02","AS3935":{"Event":4,"Distance":1,"Energy":59064,"Stage":7}}
18:04:26.163 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:04:26","AS3935":{"Event":4,"Distance":1,"Energy":0,"Stage":7}}
18:04:45.170 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:04:45","AS3935":{"Event":4,"Distance":1,"Energy":25788,"Stage":7}}
18:05:12.146 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:05:12","AS3935":{"Event":4,"Distance":1,"Energy":22788,"Stage":7}}
18:05:50.188 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:05:50","AS3935":{"Event":4,"Distance":1,"Energy":17632,"Stage":7}}
18:07:22.161 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:07:22","AS3935":{"Event":4,"Distance":1,"Energy":51215,"Stage":7}}
18:08:29.185 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:08:29","AS3935":{"Event":4,"Distance":1,"Energy":62226,"Stage":7}}
18:08:34.168 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:08:34","AS3935":{"Event":4,"Distance":1,"Energy":148630,"Stage":7}}
18:08:40.172 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:08:40","AS3935":{"Event":4,"Distance":1,"Energy":25560,"Stage":7}}
18:11:16.176 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:11:16","AS3935":{"Event":4,"Distance":1,"Energy":208620,"Stage":7}}
18:12:17.187 MQT: tele/AS3935/SENSOR = {"Time":"2021-06-28T18:12:17","AS3935":{"Event":4,"Distance":1,"Energy":67149,"Stage":7}}

Silvio Schömann

unread,
Jan 2, 2022, 7:54:14 AM1/2/22
to weewx-user
Unfortunately I can't find the error why it's an invalid type. Thanks for the help


Jan  2 13:50:58 raspberrypi weewx[18487] DEBUG user.MQTTSubscribe: (Service) TopicManager self.cached_fields is {}
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) message_callback_provider_name is user.MQTTSubscribe.MessageCallbackProvider
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) clientid is MQTTSubscribe-4719
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) client_session is True
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) host is localhost
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) port is 1883
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) keepalive is 60
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) username is None
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) min_delay is 1
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) max_delay is 120
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) password is set
Jan  2 13:50:58 raspberrypi weewx[18487] INFO user.MQTTSubscribe: (Service) Archive topic is None
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__: Caught unrecoverable exception:
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****  Invalid type configured: REPLACE_ME
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****  Traceback (most recent call last):
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****    File "/home/weewx/bin/weewxd", line 151, in main
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****      engine = weewx.engine.StdEngine(config_dict)
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/engine.py", line 93, in __init__
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****      self.loadServices(config_dict)
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/engine.py", line 161, in loadServices
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****      obj = weeutil.weeutil.get_object(svc)(self, config_dict)
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****    File "/home/weewx/bin/user/MQTTSubscribe.py", line 1812, in __init__
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****      self.subscriber = MQTTSubscriber(service_dict, self.logger)
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****    File "/home/weewx/bin/user/MQTTSubscribe.py", line 1567, in __init__
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****      self.manager)
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****    File "/home/weewx/bin/user/MQTTSubscribe.py", line 1294, in __init__
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****      raise ValueError("Invalid type configured: %s" % message_type)
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****  ValueError: Invalid type configured: REPLACE_ME
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****  Exiting.

bell...@gmail.com

unread,
Jan 2, 2022, 8:43:58 AM1/2/22
to weewx-user
Looks like you did not configure the message ‘type’.
rich

Silvio Schömann

unread,
Jan 2, 2022, 12:45:51 PM1/2/22
to weewx-user
Thanks for the quick reply Rich, I guess the guy can't be the reason. Here the conf setting


# Options for 'MQTTSubscribeService'

[MQTTSubscribeService]

    enable = true
    host = localhost
    port = 1883
    keepalive = 60
    binding = loop
#    username = None
#    password = None

    # The message handler to use
    [[message_callback]]
        type = json

    # The topics to subscribe to.
    [[topics]]
        unit_system = METRIC

        # The first topic to subscribe to.
        [[[tele/thunder01/SENSOR]]]

            [[[[Time]]]]
                ignore = True

            [[[[AS3935_Event]]]]
                ignore = True
                filter_out_message_when = 0, 8, 9
                conversion_type = int

            [[[[AS3935_Distance]]]]
                name = lightning_distance
                ignore = False
                contains_total = False
                conversion_type = float
                units = km

            [[[[AS3935_Energy]]]]
                ignore = False
                name = lightning_energy
                contains_total = False
                conversion_type = int

            [[[[AS3935_Stage]]]]
                ignore = True

bell...@gmail.com

unread,
Jan 2, 2022, 1:52:40 PM1/2/22
to weewx-user

Well, I’m stumped. These lines are saying ‘type = REPLACE_ME’ and not ‘type = json’.
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****    File "/home/weewx/bin/user/MQTTSubscribe.py", line 1294, in __init__ 
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****      raise ValueError("Invalid type configured: %s" % message_type) 
Jan  2 13:50:58 raspberrypi weewx[18487] CRITICAL __main__:     ****  ValueError: Invalid type configured: REPLACE_ME 

Could WeeWX be using a different configuration file?
rich

Silvio Schömann

unread,
Jan 2, 2022, 3:00:06 PM1/2/22
to weewx-user

I set everything up all over again. Let's see if the error comes back.

vince

unread,
Jan 2, 2022, 3:01:41 PM1/2/22
to weewx-user
Perhaps he edited the file and forgot to stop+restart weewx ?

Suggest trying:
     ps axu | grep weewx

A typical output would look like:

    # ps axu | grep weewx | grep -v grep
    root     24655 41.2 39.2 165944 48372 ?        Sl    2021 5890:56 /usr/bin/python3 /home/weewx/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /home/weewx/weewx.conf

Silvio Schömann

unread,
Jan 3, 2022, 8:37:47 AM1/3/22
to weewx-user
Even after a new installation the same error, here the log:

Jan  3 14:30:23 raspberrypi weewx[2427] INFO __main__: Initializing weewx version 4.5.1
Jan  3 14:30:23 raspberrypi weewx[2427] INFO __main__: Using Python 3.7.3 (default, Jan 22 2021, 20:04:44) #012[GCC 8.3.0]
Jan  3 14:30:23 raspberrypi weewx[2427] INFO __main__: Platform Linux-5.10.63-v7l+-armv7l-with-debian-10.11
Jan  3 14:30:23 raspberrypi weewx[2427] INFO __main__: Locale is 'de_DE.UTF-8'
Jan  3 14:30:23 raspberrypi weewx[2427] INFO __main__: PID file is /var/run/weewx.pid
Jan  3 14:30:23 raspberrypi weewx[2431] INFO __main__: Using configuration file /home/weewx/weewx.conf
Jan  3 14:30:23 raspberrypi weewx[2431] INFO __main__: Debug is 0
Jan  3 14:30:23 raspberrypi weewx[2431] INFO weewx.engine: Loading station type Simulator (weewx.drivers.simulator)
Jan  3 14:30:23 raspberrypi weewx[2416]: Starting weewx weather system: weewx.
Jan  3 14:30:23 raspberrypi systemd[1]: Started LSB: weewx weather system.
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) Version is 2.1.0-rc02
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) Log level: 0
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) Log debug setting: 0
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) Log console: False
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) Log file: None
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) message_callback_provider_name is user.MQTTSubscribe.MessageCallbackProvi
der
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) clientid is MQTTSubscribe-4131
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) client_session is True
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) host is localhost
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) port is 1883
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) keepalive is 60
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) username is None
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) min_delay is 1
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) max_delay is 120
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) password is set
Jan  3 14:30:23 raspberrypi weewx[2431] INFO user.MQTTSubscribe: (Service) Archive topic is None
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__: Caught unrecoverable exception:
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****  Invalid type configured: REPLACE_ME
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****  Traceback (most recent call last):
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****    File "/home/weewx/bin/weewxd", line 151, in main
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****      engine = weewx.engine.StdEngine(config_dict)
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/engine.py", line 93, in __init__
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****      self.loadServices(config_dict)
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/engine.py", line 161, in loadServices
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****      obj = weeutil.weeutil.get_object(svc)(self, config_dict)
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****    File "/home/weewx/bin/user/MQTTSubscribe.py", line 1812, in __init__
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****      self.subscriber = MQTTSubscriber(service_dict, self.logger)
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****    File "/home/weewx/bin/user/MQTTSubscribe.py", line 1567, in __init__
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****      self.manager)
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****    File "/home/weewx/bin/user/MQTTSubscribe.py", line 1294, in __init__
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****      raise ValueError("Invalid type configured: %s" % message_type)
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****  ValueError: Invalid type configured: REPLACE_ME
Jan  3 14:30:23 raspberrypi weewx[2431] CRITICAL __main__:     ****  Exiting.

Extract from the conf:

# Options for 'MQTTSubscribeService'
[MQTTSubscribeService]

    enable = true
    host = localhost
    port = 1883
    keepalive = 60
    binding = loop
#    username = None
#    password = None

    # The message handler to use
    [[message_callback]]
        type = json

    # The topics to subscribe to.
    [[topics]]
        unit_system = METRICWX


        # The first topic to subscribe to.
        [[[tele/thunder01/SENSOR]]]

            [[[[Time]]]]
                ignore = True

            [[[[AS3935_Event]]]]
                ignore = True
                filter_out_message_when = 0, 8, 9
                #the rest invalid events are filtered by Tasmota fw - see https://tasmota.github.io/docs/AS3935/#mqtt-events

                conversion_type = int

            [[[[AS3935_Distance]]]]
                name = lightning_distance
                ignore = False
                contains_total = False
                conversion_type = float
                units = km

            [[[[AS3935_Energy]]]]
                ignore = False
                name = lightning_energy
                contains_total = False
                conversion_type = int

            [[[[AS3935_Stage]]]]
                ignore = True

Silvio Schömann

unread,
Jan 3, 2022, 11:39:14 AM1/3/22
to weewx-user
Sorry guys, I'm stupid too. I forgot to specify the correct host from the broker. Now it's going as it should.
thank you
Danke!


Jan  3 17:33:38 raspberrypi weewx[7118] INFO __main__: Initializing weewx version 4.5.1
Jan  3 17:33:38 raspberrypi weewx[7118] INFO __main__: Using Python 3.7.3 (default, Jan 22 2021, 20:04:44) #012[GCC 8.3.0]
Jan  3 17:33:38 raspberrypi weewx[7118] INFO __main__: Platform Linux-5.10.60-v7l+-armv7l-with-debian-10.11
Jan  3 17:33:38 raspberrypi weewx[7118] INFO __main__: Locale is 'de_DE.UTF-8'
Jan  3 17:33:38 raspberrypi weewx[7118] INFO __main__: PID file is /var/run/weewx.pid
Jan  3 17:33:39 raspberrypi weewx[7122] INFO __main__: Using configuration file /home/weewx/weewx.conf
Jan  3 17:33:39 raspberrypi weewx[7122] INFO __main__: Debug is 0
Jan  3 17:33:39 raspberrypi weewx[7122] INFO weewx.engine: Loading station type Vantage (weewx.drivers.vantage)
Jan  3 17:33:39 raspberrypi weewx[7107]: Starting weewx weather system: weewx.
Jan  3 17:33:39 raspberrypi systemd[1]: Started LSB: weewx weather system.
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Version is 2.1.0-rc02
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Log level: 0
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Log debug setting: 0
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Log console: False
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Log file: None
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) message_callback_provider_name is user.MQTTSubscribe.MessageCallbackProvider
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) clientid is MQTTSubscribe-4456
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) client_session is True
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) host is localhost
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) port is 1883
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) keepalive is 60
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) username is None
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) min_delay is 1
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) max_delay is 120
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) password is not set
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Archive topic is None
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) binding is loop
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Waiting for MQTT connection.
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Connected with result code 0
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Connected flags {'session present': 0}
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Subscribing to tele/thunder01/SENSOR has a mid 1 and rc 0
Jan  3 17:33:39 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) Subscribed to mid: 1 is size 1 has a QOS of 0
Jan  3 17:33:40 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) MQTT initialization complete.
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.engine: StdConvert target unit is 0x10
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.engine: Archive will use data binding wx_binding
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.engine: Record generation will be attempted in 'hardware'
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.engine: Using archive interval of 300 seconds (specified by hardware)
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.restx: StationRegistry: Registration not requested.
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.restx: Wunderground-PWS: Data for station IKASTL14 will be posted
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.restx: PWSWeather: Data for station IDKAST01 will be posted
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.restx: CWOP: Posting not enabled.
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.restx: WOW: Posting not enabled.
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.restx: AWEKAS: Data will be uploaded for user Silvio12
Jan  3 17:33:40 raspberrypi weewx[7122] INFO user.mqtt: service version is 0.23
Jan  3 17:33:40 raspberrypi weewx[7122] INFO user.mqtt: binding to ['archive', 'loop']
Jan  3 17:33:40 raspberrypi weewx[7122] INFO user.mqtt: topic is weather/
Jan  3 17:33:40 raspberrypi weewx[7122] INFO user.mqtt: desired unit system is METRIC
Jan  3 17:33:40 raspberrypi weewx[7122] INFO user.mqtt: data will be uploaded to mqtt://mqttuser:x...@v2202104146888151254.happysrv.de:1883
Jan  3 17:33:40 raspberrypi weewx[7122] INFO __main__: Starting up weewx version 4.5.1
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.engine: Clock error is -2.40 seconds (positive is fast)
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.manager: Starting backfill of daily summaries
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.manager: Daily summaries up to date
Jan  3 17:33:40 raspberrypi /weewxd: Calculated sunshineTime = 0.000000, based on radiation = 0.000000, and threshold = 0.000000
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.manager: Added record 2022-01-03 17:30:00 CET (1641227400) to database 'weewx.sdb'
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.manager: Added record 2022-01-03 17:30:00 CET (1641227400) to daily summary in 'weewx.sdb'
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.engine: Starting main packet loop.
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.restx: MQTT: Published record 2022-01-03 17:30:00 CET (1641227400)
Jan  3 17:33:40 raspberrypi weewx[7122] INFO weewx.restx: AWEKAS: Published record 2022-01-03 17:30:00 CET (1641227400)
Jan  3 17:33:41 raspberrypi weewx[7122] INFO weewx.restx: MQTT: Published record 2022-01-03 17:33:41 CET (1641227621)
Jan  3 17:33:41 raspberrypi weewx[7122] INFO weewx.restx: MQTT: Published record 2022-01-03 17:33:41 CET (1641227621)
Jan  3 17:33:41 raspberrypi weewx[7122] INFO weewx.restx: Wunderground-PWS: Published record 2022-01-03 17:30:00 CET (1641227400)
Jan  3 17:33:41 raspberrypi weewx[7122] INFO weewx.restx: PWSWeather: Published record 2022-01-03 17:30:00 CET (1641227400)
Jan  3 17:33:42 raspberrypi weewx[7122] INFO weewx.restx: MQTT: Published record 2022-01-03 17:33:42 CET (1641227622)
Jan  3 17:33:44 raspberrypi weewx[7122] INFO weewx.restx: MQTT: Published record 2022-01-03 17:33:44 CET (1641227624)
Jan  3 17:33:46 raspberrypi weewx[7122] INFO weewx.restx: MQTT: Published record 2022-01-03 17:33:46 CET (1641227626)
Jan  3 17:33:48 raspberrypi weewx[7122] INFO weewx.restx: MQTT: Published record 2022-01-03 17:33:48 CET (1641227628)
Jan  3 17:33:50 raspberrypi weewx[7122] INFO weewx.restx: MQTT: Published record 2022-01-03 17:33:50 CET (1641227630)
Jan  3 17:33:50 raspberrypi weewx[7122] INFO user.MQTTSubscribe: (Service) MessageCallbackProvider on_message_json filtered out tele/thunder01/SENSOR : b'{"Time":"2022-01-03T17:33:50","AS3935":{"Even
t":0,"Distance":0,"Energy":0,"Stage":2}}' with AS3935_Event=[0, 8, 9]


blu...@gmail.com

unread,
Jan 7, 2022, 3:13:06 PM1/7/22
to weewx-user
Any ideas?   I have not had any lightning events.

Caught unrecoverable exception in generator 'user.belchertown.HighchartsJsonGenerator’
ERROR weewx.reportengine:         ****  Error trying to use database binding wx_binding to graph observation lightning_strike_count. Error was: lightning_strike_count.

vince

unread,
Jan 7, 2022, 3:52:30 PM1/7/22
to weewx-user
On Friday, January 7, 2022 at 12:13:06 PM UTC-8 blu...@gmail.com wrote:
Any ideas?   I have not had any lightning events.

Caught unrecoverable exception in generator 'user.belchertown.HighchartsJsonGenerator’
ERROR weewx.reportengine:         ****  Error trying to use database binding wx_binding to graph observation lightning_strike_count. Error was: lightning_strike_count.

My idea is that you really need to give us more information about your setup.


My wild 'guess' is that you have no lightning strikes in your database so you're trying to graph something that has no matching records but that's pretty much just a guess, given you've given us no config information to go on.

blu...@gmail.com

unread,
Jan 7, 2022, 4:30:05 PM1/7/22
to weewx-user
My bad.  I didn't realize I needed to install MQTTSubscribe
Reply all
Reply to author
Forward
0 new messages