Skip to content

Address ArduinoJson deprecation warnings #166

@MallocArray

Description

@MallocArray

In the package for API upload for devices with dual channel PM2.5 sensors, the way the JSON payload body is created is using deprecated options and should be updated to support the new methods before these go unavailable

/config/.esphome/packages/76b4402f/packages/airgradient_api_esp32-c3_dual_pms5003t.yaml: In lambda function:
/config/.esphome/packages/76b4402f/packages/airgradient_api_esp32-c3_dual_pms5003t.yaml:23:7: warning: 'template<unsigned int N> class ArduinoJson::V742HB22::StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
   23 |                 StaticJsonDocument<1024> doc;
      |       ^         ~~~~~~~~
In file included from .piolibdeps/ag-open-air-o-1ppt/ArduinoJson/src/ArduinoJson.hpp:65,
                 from .piolibdeps/ag-open-air-o-1ppt/ArduinoJson/src/ArduinoJson.h:9,
                 from src/esphome/components/json/json_util.h:11,
                 from src/esphome/core/string_ref.h:11,
                 from src/esphome/core/application.h:13,
                 from src/esphome/components/api/api_frame_helper.h:12,
                 from src/esphome/components/api/api_connection.h:5,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
.piolibdeps/ag-open-air-o-1ppt/ArduinoJson/src/ArduinoJson/compatibility.hpp:63:58: note: declared here
   63 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~
/config/.esphome/packages/76b4402f/packages/airgradient_api_esp32-c3_dual_pms5003t.yaml:39:51: warning: 'ArduinoJson::V742HB22::JsonObject ArduinoJson::V742HB22::JsonDocument::createNestedObject(TChar*) [with TChar = const char]' is deprecated: use doc[key].to<JsonObject>() instead [-Wdeprecated-declarations]
   39 |                 JsonObject channels = doc.createNestedObject("channels");
      |                             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from .piolibdeps/ag-open-air-o-1ppt/ArduinoJson/src/ArduinoJson.hpp:42:
.piolibdeps/ag-open-air-o-1ppt/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp:376:14: note: declared here
  376 |   JsonObject createNestedObject(TChar* key) {
      |              ^~~~~~~~~~~~~~~~~~
/config/.esphome/packages/76b4402f/packages/airgradient_api_esp32-c3_dual_pms5003t.yaml:41:58: warning: 'ArduinoJson::V742HB22::JsonObject ArduinoJson::V742HB22::JsonObject::createNestedObject(TChar*) [with TChar = const char]' is deprecated: use obj[key].to<JsonObject>() instead [-Wdeprecated-declarations]
   41 |                 JsonObject channels_1 = channels.createNestedObject("1");
      |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from .piolibdeps/ag-open-air-o-1ppt/ArduinoJson/src/ArduinoJson.hpp:39:
.piolibdeps/ag-open-air-o-1ppt/ArduinoJson/src/ArduinoJson/Object/JsonObject.hpp:211:14: note: declared here
  211 |   JsonObject createNestedObject(TChar* key) {
      |              ^~~~~~~~~~~~~~~~~~
/config/.esphome/packages/76b4402f/packages/airgradient_api_esp32-c3_dual_pms5003t.yaml:49:58: warning: 'ArduinoJson::V742HB22::JsonObject ArduinoJson::V742HB22::JsonObject::createNestedObject(TChar*) [with TChar = const char]' is deprecated: use obj[key].to<JsonObject>() instead [-Wdeprecated-declarations]
   49 |                 JsonObject channels_2 = channels.createNestedObject("2");
      |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
.piolibdeps/ag-open-air-o-1ppt/ArduinoJson/src/ArduinoJson/Object/JsonObject.hpp:211:14: note: declared here
  211 |   JsonObject createNestedObject(TChar* key) {
      |              ^~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions