0

Strange MQTT error when HTTP POST'ing data to Adafruit IO fe
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Strange MQTT error when HTTP POST'ing data to Adafruit IO fe

by jschulenklopper on Wed Mar 03, 2021 9:13 am

I'm HTTP POST'ing data to a feed at Adafruit IO, with the following data (with irrelevant parts trimmed). The required field `value` is available.

Code: Select all | TOGGLE FULL SIZE
{
    "body": {
        "id":"0ENYRP3H80GEHREPQ4DJCRTEKW",
        "value":"88",
        "feed_id":1569564,
        "feed_key":"awair-element-score",
        "created_at":"2021-03-03T12:50:04Z"
    },
    "headers": {
      "Content-Type": "application/json; charset=utf-8",
      "Content-Length": 198
    }
  }


This datagram is received correctly at Adafruit IO, as the value `88` shows up in the feed and as live data in the account monitor. Adafruit IO also returns a `200` HTTP response code on the request.

The strange thing is that each correctly received datagram also triggers an error, visible as live errors in the account monitor:

"error saving data to jschulenklopper/feeds/awair-element-score, data missing required value"


and at the top of the monitor view and feed detail view as
MQTT ERROR: error saving data to jschulenklopper/feeds/awair-element-score, data missing required value


I cannot make sense of this error. It seems to be something 'inside' Adafruit in processing and storing the datagram / value. Any pointers?

jschulenklopper
 
Posts: 4
Joined: Wed Mar 03, 2021 4:14 am

Re: Strange MQTT error when HTTP POST'ing data to Adafruit I

by jschulenklopper on Wed Mar 03, 2021 9:15 am

I've made the feed public, so if you want a live update on the indoor air quality of my home office, as measured by an Awair Element, see https://io.adafruit.com/jschulenklopper ... ment-score.

jschulenklopper
 
Posts: 4
Joined: Wed Mar 03, 2021 4:14 am

Re: Strange MQTT error when HTTP POST'ing data to Adafruit I

by jschulenklopper on Wed Mar 03, 2021 10:23 am

Mmm... it seems that I'm sending two requests to Adafruit IO: one that I know of and that goes well, and one I cannot explain from my code (a Huginn agent) that results in the error.

Is there a way in Adafruit IO to see the exact / full HTTP POST requests received against a feed?

jschulenklopper
 
Posts: 4
Joined: Wed Mar 03, 2021 4:14 am

Re: Strange MQTT error when HTTP POST'ing data to Adafruit I

by jschulenklopper on Wed Mar 03, 2021 11:09 am

Problem solved (but cannot delete my post). Turns out that Huginn was sending data upon receiving an event, _and_ was sending (empty) data scheduled for every minute. That explains the error on missing `value`.

jschulenklopper
 
Posts: 4
Joined: Wed Mar 03, 2021 4:14 am

Please be positive and constructive with your questions and comments.