Rich,
Yes will do.

I was thinking to myself, whilst I was working on this, would it be possible to add an option to generate the loop data as a file? In this way it would be a complete solution providing live data as well. I assume that this is possible but way above my pay grade.
Ian

https://claydonsweather.org.uk

On 12 Aug 2025, at 18:14, [email protected] <[email protected]> wrote:

Thanks for sharing! Any interest in adding it to the examples repository at, https://github.com/bellrichm/WeeWX-MQTTSubscribe/tree/master/exampleConfigs?
rich

On Tuesday, 12 August 2025 at 01:08:20 UTC-4 Ian Millard wrote:
Just in case this is useful for anyone.

This is an example [MQTTSubscribeDriver] stanza to use in conjunction with Ecowitt MQTT weather service protocol which is now included in GW2000 and GW3000 gateway devices.

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

[MQTTSubscribeDriver]
    driver = user.MQTTSubscribe
    host = broker.mqtt.cool
    port = 1883
    keepalive = 60
    username = None
    password = None
    binding = loop
    
    [[topics]]
        unit_system = US
        [[[ecowitt/1C6920E3A8F3]]]
           subscribe = True
           ignore = False
            [[[[message]]]]
                type = keyword
                keyword_delimiter = "&"
            [[[[PASSKEY]]]]
                ignore = True
            [[[[stationtype]]]]
                ignore = True
            [[[[runtime]]]]
                ignore = True
            [[[[dns_err_cnt]]]]
                ignore = True
            [[[[cdnflg]]]]
                ignore = True
            [[[[dateutc]]]]
                ignore = True
            [[[[freq]]]]
                ignore = True
            [[[[model]]]]
                ignore = True
            [[[[baromrelin]]]]
                name = barometer
            [[[[baromabsin]]]]
                name = pressure
            [[[[dailyrainin]]]]
                name = dayRain
            [[[[drain_piezo]]]]
                name = p_dayRain
            [[[[erain_piezo]]]]
                name = p_stormRain
            [[[[eventrainin]]]]
                name = stormRain
            [[[[hourlyrainin]]]]
                name = hourRain
            [[[[hrain_piezo]]]]
                name = p_hourRain
            [[[[humidityin]]]]
                name = inHumidity
            [[[[humidity]]]]
                name = outHumidity
            [[[[last24hrain_piezo]]]]
                name = p_24Rain
            [[[[last24hrainin]]]]
                name = 24Rain
            [[[[lightning]]]]
                name = lightning_dist
            [[[[lightning_num]]]]
                name = lightning_strike_count
            [[[[lightning_time]]]]
                name = lightning_last_det_time
            [[[[monthlyrainin]]]]
                name = monthRain
            [[[[mrain_piezo]]]]
                name = p_monthRain
            [[[[rainratein]]]]
                name = rainRate
            [[[[rrain_piezo]]]]
                name = p_rainRate
            [[[[solarradiation]]]]
               name = radiation
            [[[[srain_piezo]]]]
                name = isRaining
            [[[[tempf]]]]
                name = outTemp
            [[[[tempinf]]]]
               name = inTemp
            [[[[uv]]]]
                name = UV
            [[[[weeklyrainin]]]]
                name = weekRain
            [[[[wrain_piezo]]]]
                name = p_weekRain
            [[[[winddir]]]]
                name = windDir
            [[[[windgustmph]]]]
                name = windGust
            [[[[windspeedmph]]]]
               name = windSpeed
            [[[[yearlyrainin]]]]
                name = yearRain
            [[[[yrain_piezo]]]]
                name = p_yearRain

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


On 11 Aug 2025, at 23:57, 'Ian Millard' via weewx-user <[email protected]> wrote:

Vince,
Bingo, you nailed it in one. It worked perfectly.
As always, thanks very much for your help.
Ian

On 11 Aug 2025, at 23:39, vince <[email protected]> wrote:

I’m sure Rich will chime in but my first impression is you should ignore the elements within the reply that cannot be mapped to weewx db elements, so ignore everything to the left of tempinf in the payload
On Monday, August 11, 2025 at 3:21:03 PM UTC-7 Ian Millard wrote:
Vince,
Sorry for the delay, I missed your post on my phone whilst away from home.

Status as follows: -

The new Ecowitt MQTT protocol is publishing to broker with no problem and I can see the data arriving in the broker browser.

In weewx.conf I have this: -

[MQTTSubscribeDriver]
    driver = user.MQTTSubscribe
    host = broker.mqtt.cool
    port = 1883
    keepalive = 60
    username = None
    password = None
    binding = loop
    
    [[topics]]
        unit_system = US
        [[[ecowitt/1C6920E3A8F3]]]
           subscribe = True
           ignore = False
            [[[[message]]]]
                type = keyword
                keyword_delimiter = "&"

Then, extract from journal log: -

Aug 11 23:18:27 dvm weewxd[764736]: INFO __main__: Starting up weewx version 5.1.0
Aug 11 23:18:27 dvm weewxd[764736]: DEBUG weewx.engine: Station does not support reading the time
Aug 11 23:18:27 dvm weewxd[764736]: INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'
Aug 11 23:18:27 dvm weewxd[764736]: INFO weewx.manager: Starting backfill of daily summaries
Aug 11 23:18:27 dvm weewxd[764736]: INFO weewx.manager: Daily summaries up to date
Aug 11 23:18:27 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) No archive topic configured.
Aug 11 23:18:27 dvm weewxd[764736]: INFO weewx.engine: Starting main packet loop.
Aug 11 23:18:27 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) TopicManager starting queue ecowitt/1C6920E3A8F3 size is: 0
Aug 11 23:18:27 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) TopicManager starting queue 1754950706.041299-windGust-windGustDir-windDir-windSpeed size is: 0
Aug 11 23:18:27 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) Queues are empty.
Aug 11 23:18:29 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) TopicManager starting queue ecowitt/1C6920E3A8F3 size is: 0
Aug 11 23:18:29 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) TopicManager starting queue 1754950706.041299-windGust-windGustDir-windDir-windSpeed size is: 0
Aug 11 23:18:29 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) Queues are empty.
Aug 11 23:18:29 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: ecowitt/1C6920E3A8F3, QOS: 0, retain: False, payload: b'PASSKEY=ED62ACE35A6D1A6CBFFC085BAADF1F1A&stationtype=GW3000A_V1.1.0&runtime=638367&heap=73048&dateutc=2025-08-11%2022%3A18%3A29&dns_err_cnt=0&cdnflg=42&tempinf=79.16&humidityin=51&baromrelin=30.064&baromabsin=29.763&tempf=71.78&humidity=60&vpd=0.314&winddir=169&winddir_avg10m=150&windspeedmph=4.25&windgustmph=6.26&maxdailygust=13.20&solarradiation=0.00&uv=0&rainratein=0.000&eventrainin=0.000&hourlyrainin=0.000&last24hrainin=0.000&dailyrainin=0.000&weeklyrainin=0.000&monthlyrainin=0.240&yearlyrainin=6.583&rrain_piezo=0.000&erain_piezo=0.000&hrain_piezo=0.000&last24hrain_piezo=0.000&drain_piezo=0.000&wrain_piezo=0.000&mrain_piezo=0.173&yrain_piezo=11.531&srain_piezo=0&ws90cap_volt=5.4&ws90_ver=143&lightning_num=0&lightning=24&lightning_time=1753979889&wh40batt=1.7&wh57batt=3&wh90batt=3.28&freq=868M&model=GW3000A&interval=60'
Aug 11 23:18:29 dvm weewxd[764736]: ERROR user.MQTTSubscribe: (Driver) MessageCallbackProvider on_message_keyword failed with <class 'user.MQTTSubscribe.ConversionError'> and reason Failed converting field PASSKEY with value ED62ACE35A6D1A6CBFFC085BAADF1F1A using 'lambda x: to_float(x)' with reason could not convert string to float: 'ED62ACE35A6D1A6CBFFC085BAADF1F1A'..
Aug 11 23:18:29 dvm weewxd[764736]: ERROR user.MQTTSubscribe: (Driver) **** MessageCallbackProvider Ignoring topic=ecowitt/1C6920E3A8F3 and payload=b'PASSKEY=ED62ACE35A6D1A6CBFFC085BAADF1F1A&stationtype=GW3000A_V1.1.0&runtime=638367&heap=73048&dateutc=2025-08-11%2022%3A18%3A29&dns_err_cnt=0&cdnflg=42&tempinf=79.16&humidityin=51&baromrelin=30.064&baromabsin=29.763&tempf=71.78&humidity=60&vpd=0.314&winddir=169&winddir_avg10m=150&windspeedmph=4.25&windgustmph=6.26&maxdailygust=13.20&solarradiation=0.00&uv=0&rainratein=0.000&eventrainin=0.000&hourlyrainin=0.000&last24hrainin=0.000&dailyrainin=0.000&weeklyrainin=0.000&monthlyrainin=0.240&yearlyrainin=6.583&rrain_piezo=0.000&erain_piezo=0.000&hrain_piezo=0.000&last24hrain_piezo=0.000&drain_piezo=0.000&wrain_piezo=0.000&mrain_piezo=0.173&yrain_piezo=11.531&srain_piezo=0&ws90cap_volt=5.4&ws90_ver=143&lightning_num=0&lightning=24&lightning_time=1753979889&wh40batt=1.7&wh57batt=3&wh90batt=3.28&freq=868M&model=GW3000A&interval=60'
Aug 11 23:18:29 dvm weewxd[764736]: ERROR user.MQTTSubscribe: (Driver) **** MessageCallbackProvider Traceback (most recent call last):
                                      File "/home/dvm/weewx-data/bin/user/MQTTSubscribe.py", line 1441, in _convert_value
                                        return conversion_func['compiled'](value)
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                      File "<string>", line 1, in <lambda>
                                      File "/home/dvm/weewx-venv/lib/python3.11/site-packages/weeutil/weeutil.py", line 1584, in to_float
                                        return float(x) if x is not None else None
                                               ^^^^^^^^
                                    ValueError: could not convert string to float: 'ED62ACE35A6D1A6CBFFC085BAADF1F1A'
                                    
                                    The above exception was the direct cause of the following exception:
                                    
                                    Traceback (most recent call last):
                                      File "/home/dvm/weewx-data/bin/user/MQTTSubscribe.py", line 1560, in _on_message_keyword
                                        (fieldname, value) = self._update_data(key, field[eq_index + 1:].strip(), fields, fields_conversion_func, unit_system)
                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                      File "/home/dvm/weewx-data/bin/user/MQTTSubscribe.py", line 1400, in _update_data
                                        value = self._convert_value(fields, default_field_conversion_func, orig_name, orig_value)
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                      File "/home/dvm/weewx-data/bin/user/MQTTSubscribe.py", line 1446, in _convert_value
                                        raise ConversionError(
                                    user.MQTTSubscribe.ConversionError: Failed converting field PASSKEY with value ED62ACE35A6D1A6CBFFC085BAADF1F1A using 'lambda x: to_float(x)' with reason could not convert string to float: 'ED62ACE35A6D1A6CBFFC085BAADF1F1A'.
Aug 11 23:18:31 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) TopicManager starting queue ecowitt/1C6920E3A8F3 size is: 0
Aug 11 23:18:31 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) TopicManager starting queue 1754950706.041299-windGust-windGustDir-windDir-windSpeed size is: 0
Aug 11 23:18:31 dvm weewxd[764736]: DEBUG user.MQTTSubscribe: (Driver) Queues are empty.







On 7 Aug 2025, at 17:44, vince <[email protected]> wrote:

What problems are you running into ?

Does my MQTT subscribe example not work ? I’ve been subscribing to MQTT ecowitt data for years that way.

On Thursday, August 7, 2025 at 12:15:47 AM UTC-7 steepleian wrote:
@james
Could you share your subscribe configuration please. I have the GW3000 publishing directly to a local broker which works fine. I am having problems with getting the settings right for Rich’s MQTTSubscribe. I usually manage to muddle my way through solutions but this one is evading me.
Many thanks in advance.
Ian


-- 
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].

-- 
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 visit https://groups.google.com/d/msgid/weewx-user/70e21a4c-c324-40d7-b86f-c8a52eb0a3b0n%40googlegroups.com.


--
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].

--
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 visit https://groups.google.com/d/msgid/weewx-user/f9ebf899-2fad-43ea-a642-0132fffd054cn%40googlegroups.com.

--
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 visit https://groups.google.com/d/msgid/weewx-user/F862D193-A5C1-428A-962F-7C9E2FA3F600%40btinternet.com.

Reply via email to