MQTTSubscribe - when no data is avail, archive function appears to halt

172 views
Skip to first unread message

bdf0506

unread,
Jul 9, 2021, 2:18:39 PM7/9/21
to weewx-user
This might be more appropriate for an issue on GitHub, but figured I would start here.

I have Weewx 4.5.1 running with Weewx-MQTTSubscribe v 2.0.0. MQTTSubscribe is running as a driver. For my DB, I'm using MySQL.

Everything works fine as is, but what I've found is that if I simply stop publishing data to my MQTT broker, *something* will silently die. If this happens at the Archive interval, the reporting is delayed until the data comes back and the driver picks up at least one loop packet.

To make matters worse, if I stop publishing my data for more than 5 minutes, WeeWx loses the connection to MySQL and then has to re-establish (not sure where the mysql timeout is set? I don't believe this is a mysql server side, I think its a weewx client side issue). The good news is that there is already logic built in to recover from the errors, so worse case on all this is just a delayed Archive report.

Relevant weewx.conf:

[Station]
    station_type = MQTTSubscribeDriver

[MQTTSubscribeDriver]
    # This section is for the MQTTSubscribe driver.

    # The driver to use:
    driver = user.MQTTSubscribe

    # The MQTT server.
    # Default is localhost.
    host = unraid.home

    # The port to connect to.
    # Default is 1883.
    port = 1883

    # Maximum period in seconds allowed between communications with the broker.
    # Default is 60.
    keepalive = 60

    # username for broker authentication.
    # Default is None.
    username = mqtt

    # password for broker authentication.
    # Default is None.
    password = mqtt

    # Configuration for the message callback.
    [[message_callback]]
        type = individual

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

        [[[rtl_433/devices/Acurite-Tower/2070/temperature_C]]]
              name = extraTemp1
              units = degree_C
        [[[rtl_433/devices/Acurite-Tower/2070/humidity]]]
              name = extraHumid1
        [[[rtl_433/devices/Acurite-Tower/2070/battery_ok]]]
              name = batteryStatus1
.........trimmed....many more topics listed....

[DataBindings]

    [[wx_binding]]
        database = archive_mysql
        table_name = archive
        manager = weewx.manager.DaySummaryManager
        schema = schemas.wview_extended.schema

[Databases]
    [[archive_mysql]]
        database_name = weewx_cb_july_6_3
        database_type = MySQL

[DatabaseTypes]

    [[MySQL]]
        driver = weedb.mysql
        # The host where the database is located
        host = unraid.home
        # The user name for logging in to the host
        user = weewx
        # The password for the user name (quotes guard against parsing errors)
        password = "weewx"


Here's two examples:

First example shows it stopped for only 3 minutes, but it was stopped during the scheduled Archive window, so archive was delayed until data reappeared.

Jul  9 13:48:35 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Acurite-Tower/14680/battery_ok: batteryStatus6: 1.0, dateTime: 1625852913.3931665, usUnits: 1
Jul  9 13:48:35 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Acurite-Tower/14680/battery_ok 2021-07-09 13:48:33 EDT (1625852913): batteryStatus6: 1.0, dateTime: 1625852913.3931665, usUnits: 1
Jul  9 13:48:35 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Acurite-Tower/14680/battery_ok: batteryStatus6: 1.0, dateTime: 1625852913.3937244, usUnits: 1
Jul  9 13:48:35 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Acurite-Tower/14680/battery_ok 2021-07-09 13:48:33 EDT (1625852913): batteryStatus6: 1.0, dateTime: 1625852913.3937244, usUnits: 1
Jul  9 13:48:35 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Acurite-Tower/14680/battery_ok: batteryStatus6: 1.0, dateTime: 1625852913.3942847, usUnits: 1
Jul  9 13:48:35 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Acurite-Tower/14680/battery_ok 2021-07-09 13:48:33 EDT (1625852913): batteryStatus6: 1.0, dateTime: 1625852913.3942847, usUnits: 1

<stopped publishing data here for a few min, but during archive period>

Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/battery_ok, QOS: 0, retain: 0, payload: b'1'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/battery_ok: outTempBatteryStatus: 1.0
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/temperature_C, QOS: 0, retain: 0, payload: b'31.1'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/temperature_C: outTemp: 87.98
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/humidity, QOS: 0, retain: 0, payload: b'68'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/humidity: outHumidity: 68.0
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/wind_dir_deg, QOS: 0, retain: 0, payload: b'239'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/wind_dir_deg: windDir: 239.0
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/wind_avg_m_s, QOS: 0, retain: 0, payload: b'0'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/wind_avg_m_s: windSpeed: 0.0
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/rain_mm, QOS: 0, retain: 0, payload: b'0'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/rain_mm: rain: None
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/uv, QOS: 0, retain: 0, payload: b'108'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/uv: radiation: 108.0
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/uvi, QOS: 0, retain: 0, payload: b'0'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/uvi: UV: 0.0
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/light_lux, QOS: 0, retain: 0, payload: b'12958.0'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/light_lux: luminosity: 12958.0
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/temperature_C: dateTime: 1625853195.18606, outTemp: 87.98, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/temperature_C 2021-07-09 13:53:15 EDT (1625853195): dateTime: 1625853195.18606, outTemp: 87.98, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) No archive topic configured.
Jul  9 13:53:15 weewx[17] INFO weewx.manager: Added record 2021-07-09 13:50:00 EDT (1625853000) to database 'weewx_cb_july_6_3'
Jul  9 13:53:15 weewx[17] INFO weewx.manager: Added record 2021-07-09 13:50:00 EDT (1625853000) to daily summary in 'weewx_cb_july_6_3'
Jul  9 13:53:15 weewx[17] DEBUG weewx.reportengine: Running reports for latest time in the database.
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/humidity: dateTime: 1625853195.18632, outHumidity: 68.0, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG weewx.reportengine: Running report 'SeasonsReport'
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/humidity 2021-07-09 13:53:15 EDT (1625853195): dateTime: 1625853195.18632, outHumidity: 68.0, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/battery_ok: dateTime: 1625853195.1856647, outTempBatteryStatus: 1.0, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/battery_ok 2021-07-09 13:53:15 EDT (1625853195): dateTime: 1625853195.1856647, outTempBatteryStatus: 1.0, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/rain_mm: dateTime: 1625853195.1869624, rain: None, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/rain_mm 2021-07-09 13:53:15 EDT (1625853195): dateTime: 1625853195.1869624, rain: None, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/uvi: UV: 0.0, dateTime: 1625853195.187348, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/uvi 2021-07-09 13:53:15 EDT (1625853195): UV: 0.0, dateTime: 1625853195.187348, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/uv: dateTime: 1625853195.1871548, radiation: 108.0, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/uv 2021-07-09 13:53:15 EDT (1625853195): dateTime: 1625853195.1871548, radiation: 108.0, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/light_lux: dateTime: 1625853195.187578, luminosity: 12958.0, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/light_lux 2021-07-09 13:53:15 EDT (1625853195): dateTime: 1625853195.187578, luminosity: 12958.0, usUnits: 1
Jul  9 13:53:15 weewx[17] DEBUG weewx.reportengine: Found configuration file /home/weewx/skins/Seasons/skin.conf for report 'SeasonsReport'
Jul  9 13:53:15 weewx[17] DEBUG weewx.cheetahgenerator: Using search list ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo', 'weewx.cheetahgenerator.Extras', 'weewx.cheetahgenerator.JSONHelpers']
Jul  9 13:53:15 weewx[17] DEBUG weewx.manager: Daily summary version is 4.0
Jul  9 13:53:16 weewx[17] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 0.72 seconds


Second example here is showing the data being stopped for >10 minutes which causes WeeWX to terminate the MySQL connection and needs to re-establish before it can proceed:

Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/rain_mm: dateTime: 1625850427.0049827, rain: 0.0, usUnits: 1
Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/rain_mm 2021-07-09 13:07:07 EDT (1625850427): dateTime: 1625850427.0049827, rain: 0.0, usUnits: 1
Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/uvi: UV: 5.0, dateTime: 1625850427.0054584, usUnits: 1
Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/uvi 2021-07-09 13:07:07 EDT (1625850427): UV: 5.0, dateTime: 1625850427.0054584, usUnits: 1
Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/uv: dateTime: 1625850427.0052233, radiation: 2403.0, usUnits: 1
Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/uv 2021-07-09 13:07:07 EDT (1625850427): dateTime: 1625850427.0052233, radiation: 2403.0, usUnits: 1
Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/light_lux: dateTime: 1625850427.005688, luminosity: 81452.0, usUnits: 1
Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/light_lux 2021-07-09 13:07:07 EDT (1625850427): dateTime: 1625850427.005688, luminosity: 81452.0, usUnits: 1
Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing 1625849733.922914-windGust-windGustDir-windDir-windSpeed: dateTime: 1625850427.004458, usUnits: 1, windDir: 237.0, windSpeed: 0.0
Jul  9 13:07:08 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is 1625849733.922914-windGust-windGustDir-windDir-windSpeed 2021-07-09 13:07:07 EDT (1625850427): dateTime: 1625850427.004458, usUnits: 1, windDir: 237.0, windSpeed: 0.0

<stopped publishing data to MQTT server here, kept off for 10 min, just enough for MySQL to close the connection>

Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/battery_ok, QOS: 0, retain: 0, payload: b'1'
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/battery_ok: outTempBatteryStatus: 1.0
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/temperature_C, QOS: 0, retain: 0, payload: b'30.1'
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/temperature_C: outTemp: 86.18
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/humidity, QOS: 0, retain: 0, payload: b'73'
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/humidity: outHumidity: 73.0
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/wind_dir_deg, QOS: 0, retain: 0, payload: b'241'
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/wind_dir_deg: windDir: 241.0
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/wind_avg_m_s, QOS: 0, retain: 0, payload: b'0.06375'
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/wind_avg_m_s: windSpeed: 0.039612511961425186
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/rain_mm, QOS: 0, retain: 0, payload: b'0'
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/rain_mm: rain: 0.0
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/uv, QOS: 0, retain: 0, payload: b'2750'
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/uv: radiation: 2750.0
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/uvi, QOS: 0, retain: 0, payload: b'6'
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/uvi: UV: 6.0
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) MessageCallbackProvider data-> incoming topic: rtl_433/devices/Fineoffset-WH65B/202/light_lux, QOS: 0, retain: 0, payload: b'91558.0'
Jul  9 13:17:15 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> incoming rtl_433/devices/Fineoffset-WH65B/202/light_lux: luminosity: 91558.0
Jul  9 13:17:17 weewx[17] DEBUG user.MQTTSubscribe: (Driver) TopicManager data-> outgoing rtl_433/devices/Fineoffset-WH65B/202/temperature_C: dateTime: 1625851035.139255, outTemp: 86.18, usUnits: 1
Jul  9 13:17:17 weewx[17] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is rtl_433/devices/Fineoffset-WH65B/202/temperature_C 2021-07-09 13:17:15 EDT (1625851035): dateTime: 1625851035.139255, outTemp: 86.18, usUnits: 1
Jul  9 13:17:17 weewx[17] INFO weewx.engine: Main loop exiting. Shutting engine down.
Jul  9 13:17:17 weewx[17] INFO weewx.engine: Shutting down StdReport thread
Jul  9 13:17:17 weewx[17] DEBUG weewx.engine: StdReport thread has been terminated
Jul  9 13:17:17 weewx[17] DEBUG weewx.restx: Influx: Database OperationalError '(2013, 'Lost connection to MySQL server during query')'
Jul  9 13:17:17 weewx[17] DEBUG weewx.restx: MQTT: Database OperationalError '(2013, 'Lost connection to MySQL server during query')'
Jul  9 13:17:17 weewx[17] DEBUG weewx.restx: Shut down Influx thread.
Jul  9 13:17:17 weewx[17] DEBUG weewx.restx: Shut down MQTT thread.
Jul  9 13:17:17 weewx[17] INFO user.MQTTSubscribe: (Driver) Disconnected with result code 0
Jul  9 13:17:17 weewx[17] CRITICAL __main__: Database connection exception: (2013, 'Lost connection to MySQL server during query')
Jul  9 13:17:17 weewx[17] CRITICAL __main__:     ****  Waiting 60 seconds then retrying...
Jul  9 13:18:17 weewx[17] INFO __main__: retrying...
Jul  9 13:18:17 weewx[17] INFO __main__: Using configuration file /data/weewx.conf
Jul  9 13:18:17 weewx[17] INFO __main__: Debug is 1
Jul  9 13:18:17 weewx[17] DEBUG __main__: Initializing engine
Jul  9 13:18:17 weewx[17] INFO weewx.engine: Loading station type MQTTSubscribeDriver (user.MQTTSubscribe)
Jul  9 13:18:17 weewx[17] DEBUG user.MQTTSubscribe: (Driver) Using weewx version 4.5.1
Jul  9 13:18:17 weewx[17] DEBUG user.MQTTSubscribe: (Driver) Using Python 3.9.1 (default, Dec 11 2020, 14:22:09)  [GCC 8.3.0]
Jul  9 13:18:17 weewx[17] DEBUG user.MQTTSubscribe: (Driver) Platform Linux-4.19.107-Unraid-x86_64-with-glibc2.28
Jul  9 13:18:17 weewx[17] DEBUG user.MQTTSubscribe: (Driver) Locale is 'C.UTF-8'
Jul  9 13:18:17 weewx[17] INFO user.MQTTSubscribe: (Driver) Version is 2.0.0-rc03
Jul  9 13:18:17 weewx[17] INFO user.MQTTSubscribe: (Driver) Log level: 0
Jul  9 13:18:17 weewx[17] INFO user.MQTTSubscribe: (Driver) Log debug setting: 1
Jul  9 13:18:17 weewx[17] INFO user.MQTTSubscribe: (Driver) Log console: False
Jul  9 13:18:17 weewx[17] INFO user.MQTTSubscribe: (Driver) Log file: None


Tom Keffer

unread,
Jul 9, 2021, 3:08:46 PM7/9/21
to weewx-user
Yes, WeeWX blocks on LOOP packets. No LOOP packet = no action. It will sit and wait indefinitely.

The alternative is the complexity of select statements and asynchronous events. 

I suppose one thing you could do is to set a timeout in the driver so that if nothing is received after a while, it emits a minimal packet with no data.

--
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/22f1520d-4d6a-4f56-9b03-e11978c8040cn%40googlegroups.com.

Brad Furman

unread,
Jul 9, 2021, 3:11:28 PM7/9/21
to weewx...@googlegroups.com
That seems like a driver enhancement that would be needed. I’ll explore opening up an issue with that project to ask to make it an enhancement option. 

But what about the MySQL connection being lost as shown in the second example? Is that expected? Is that a timeout that can be set somewhere?

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/0XsF7BVYFXU/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/CAPq0zECoCT0G1EvvE51-%3DzG0c%3DmhPFSmNppqesHEpuRejeSmpg%40mail.gmail.com.
--

Tom Keffer

unread,
Jul 9, 2021, 3:26:27 PM7/9/21
to weewx-user
You can post it to the issues list, but I doubt it will go anywhere. It's not something that comes up very often. 

Googling around shows some strategies for dealing with dropped MySQL connections. Example: https://bitworks.software/en/2019-03-12-tornado-persistent-mysql-connection-strategy.html

bell...@gmail.com

unread,
Jul 9, 2021, 5:22:50 PM7/9/21
to weewx-user
Ironically I just finished up. an enhancement that might meet your needs. I added an option, ‘max_loop_interval’. If MQTTSubscribeDriver has not created a loop packet in ‘max_loop_interval’ seconds, an ‘empty’ loop packet is created. An ‘empty’ loop packet contains one dummy observation along with the required dateTime and usUnit fields.


With that being said, I’m not sure it is going to accomplish what you want. The loop packet(s) will allow WeeWX to kick off the archival/reporting, but because the loop packet(s) have no real data, nothing will be stored in the DB nor will the reports have any updates. 

This is beta code, so is subject to change, etc.
rich

Brad Furman

unread,
Jul 9, 2021, 5:29:09 PM7/9/21
to weewx...@googlegroups.com
Awesome! This might work for what I need. Thanks!

--

Graham Eddy

unread,
Jul 10, 2021, 1:13:38 AM7/10/21
to weewx...@googlegroups.com
perhaps introduce a ‘null’ driver which just pumps out empty packets, and everything else is a service that augments it
Reply all
Reply to author
Forward
0 new messages