Author Topic: MQTT payload size exceeded  (Read 1444 times)

0 Members and 1 Guest are viewing this topic.

Offline PeterD

  • Member
  • *
  • Posts: 4
MQTT payload size exceeded
« on: April 10, 2019, 12:50:09 PM »
I've also tried posting a couple times to the weewx-user google group but my posts get instantly deleted there for some unknown reason.

Debian / weewx 3.9.1 with mqtt extension / belchertown / nginx / david vantage pro2


Here is the issue in short:

MQTT appears to be working internally but the payload is too large and prevents the website from updating.  A smaller fake payload used for testing is successful.  How do I truncate the data in the MQTT payload?   things like soil and leaf wetness are not required.

-------

Example from current setting obtained at the terminal

mosquitto_sub -h localhost -t weather/#

{"windSpeed10_kph": "0.0", "monthET": "0.0", "cloudbase_meter": "610.078192345", "outHumidity": "73.0", "pressure_mbar": "1004.21031119", "rain_cm": "0.0", "dayET": "0.0", "barometer_mbar": "1013.30892876", "yearRain_cm": "0.0", "consBatteryVoltage_volt": "1.25", "dewpoint_C": "-2.64673607144", "insideAlarm": "0.0", "inHumidity": "27.0", "sunrise": "1554924300.0", "windGust_kph": "0.0", "heatindex_C": "1.66666666667", "dayRain_cm": "0.0", "outsideAlarm1": "0.0", "forecastIcon": "6.0", "outsideAlarm2": "0.0", "windSpeed_kph": "0.0", "forecastRule": "45.0", "rainAlarm": "0.0", "altimeter_mbar": "1012.55702971", "windchill_C": "1.66666666667", "appTemp_C": "-0.674718834607", "outTemp_C": "1.66666666667", "extraAlarm1": "0.0", "extraAlarm2": "0.0", "extraAlarm3": "0.0", "extraAlarm4": "0.0", "extraAlarm5": "0.0", "extraAlarm6": "0.0", "extraAlarm7": "0.0", "extraAlarm8": "0.0", "humidex_C": "1.66666666667", "rain24_cm": "0.0", "hourRain_cm": "0.0", "inTemp_C": "23.5", "soilLeafAlarm4": "0.0", "trendIcon": "20.0", "soilLeafAlarm2": "0.0", "soilLeafAlarm3": "0.0", "usUnits": "16.0", "soilLeafAlarm1": "0.0", "leafWet4": "0.0", "txBatteryStatus": "1.0", "yearET": "0.0", "monthRain_cm": "0.0", "rainRate_cm_per_hour": "0.0", "dateTime": "1554913274.0", "stormRain_cm": "0.0", "sunset": "1554885600.0", "inDewpoint_C": "3.41268318248"}


The website site just shows "Connected.  Waiting for data.", no errors, no updates

--------

Using MQTT-admin I can see payload size errors:   https://i.imgur.com/skL3x35.png


---------

Sending a smaller fake payload from the terminal successfully updates the website:

mosquitto_pub -h localhost -t "weather" -m '{"UV": "0.68", "barometer_inHg": "30.4306066431", "outHumidity": "45.8", "maxSolarRad": "399.067737313", "dewpoint_F": "17.6078693897", "cloudbase_foot": "4723.66604779", "heatindex_F": "36.5", "altimeter_inHg": "30.3995019668", "dayRain_in": "0.0", "outTemp_F": "36.5", "appTemp_F": "31.2879264251", "windchill_F": "15.5", "hourRain_in": "0.0", "humidex_F": "36.5", "rainRate_inch_per_hour": "0.0", "pressure_inHg": "29.9401590264", "usUnits": "1.0", "txBatteryStatus": "0.0", "windSpeed_mph": "55.0", "rain24_in": "5.0", "dateTime": "1542561977", "radiation_Wpm2": "124.813456"}' -u weewx -P weewx


https://i.imgur.com/lnVyexP.png




Offline vreihen

  • El Niņo chaser
  • Forecaster
  • *****
  • Posts: 1216
  • K2BIG
Re: MQTT payload size exceeded
« Reply #1 on: April 10, 2019, 08:01:30 PM »
I'm running the exact same setup here (as well as a second instance using WeatherFlow hardware), and everything works fine.

weewx.conf tidbits:

Code: [Select]
   [[MQTT]]
        server_url = mqtt://user:passwd@127.0.0.1:1883/
        topic = weather
        unit_system = US
        binding = archive, loop
        aggregation = aggregate
        log_success = false


Code: [Select]
    [[Belchertown]]
        [[[Extras]]]
            .
            .
            .
            mqtt_websockets_enabled = 1
            mqtt_websockets_host = 192.168.1.112 (my WeeWX server's in-house IP, since I don't share MQTT data outside the house)
            mqtt_websockets_port = 1884
            mqtt_websockets_ssl = 0
            mqtt_websockets_topic = weather/loop

Assuming that you're using mosquitto for your MQTT server, make sure that it has websockets enabled.

The setting variable names in the Belchertown block above are for the pre-release v1.0 Belchertown skin, which looks awesome in dark mode on my wall-mounted tablet.....
WU Gold Stars for everyone! :lol:

Offline PeterD

  • Member
  • *
  • Posts: 4
Re: MQTT payload size exceeded
« Reply #2 on: April 11, 2019, 07:55:12 AM »
What is your raw JSON output at the terminal?   Does it include all the same useless fields as mine?

mosquitto_sub -h localhost -t weather/#

As mentioned, data is flowing from mosquitto / websocket just fine, it also works fine with a manual payload using less fields, it just appears the the default json payload is too large for whatever reason

Offline PeterD

  • Member
  • *
  • Posts: 4
Re: MQTT payload size exceeded
« Reply #3 on: April 11, 2019, 03:36:17 PM »
Actually, your conf did quietly have the answer, I needed to subscribe to the topic weather/loop instead of just weather.   All set