Too many things per adapter?

Hi,

I managed to set up a couple of sensors. But now I got stuck. I have 2 DHT22’s, a MAX6675, and a digittal out channel coupled and listed as things: Works fine. But if I add another thing, no matter whether it is an LED to control or another sensor, the things crashe and are corrupted:
The things lose their infos and values:
grafik

If I access them directly via the browser (http://192.168.0.100/things/DHT_WEST/properties), I can perfectly see the JSON-object and even the properites are updated (http://192.168.0.100/things/DHT_WEST/properties)

Is there a limited number of things per adapter or am I missing something else?

Here the code:

// ***************************Libraries***************************
// Defintions for WebThings
#define LARGE_JSON_BUFFERS 1
#define ARDUINOJSON_USE_LONG_LONG 1

// Necessary libraries to use WebThings
#include <Arduino.h>
#include "Thing.h"
#include "EthernetWebThingAdapter.h" // Switch to the Wifi Adapter if you go wireless

// Necessary library to use DHT11/DHT22 sensors
#include <DHT.h>;
//Define pins fot DHT sensors
#define DHTPIN1 2   // connect a DHT22 from the WEST wall to this plug [D2-D3]
#define DHTPIN2 6   // connect a DHT22 from the EAST wall to this plug [D6-D7]
// Instance of the DHT class, name = dht 
DHT dht[] = {
  {DHTPIN1, DHT22},
  {DHTPIN2, DHT22},
};

// Necessary libraries to use thermo couples via voltage amplifier MAX6675
#include "max6675.h"
// Define input pins as constants
const int snPin2 = A0;         // connect grove moisture sensor 1 of the WEST wall to this Pin [D4-D5]
//const int snPin3 = 0;         // connect grove moisture sensor 2 of the WEST wall to this Pin [D4]
const int snPin5 = 8;         // connect grove moisture sensor 1 of the EAST wall to this Pin [D8-D9]
const int snPin6 = 10;        // connect grove moisture sensor 2 of the EAST wall to this Pin [D10-D11]
const int snPin7 = 12;        // connect grove moisture sensor of the NORTH wall to this Pin [D12-D13]
//Define the 3 pins where the MAY6675 is connected:
const int max6675SO = 3;    // Serial Output am PIN [D3]
const int max6675CS = 5;   // Chip Select am PIN [D5]
const int max6675CLK =7;   // Serial Clock am PIN [D7]
// Define output pins as constants
const int snPin8 = 9;         // connect switch for fan WEST/NORTH channel to this Pin [D9]
const int snPin9 = 11;        // connect switch for fan EAST channel to this Pin [D11]
// Define the interval length to read the sensors
const long interval = 10000;           // interval at which the sensor block is read (milliseconds)

// Initialisation of variables
double moisW = -1;          // Moisture West wall 1
//double moisW2 = -1;         // Moisture West wall 2
double moisE1 = -1;         // Moisture East wall 1
double moisE2 = -1;         // Moisture East wall 2
double moisN  = -1;         // Moisture North wall 1
double tempF  = -1;         // Temperature Floor
bool fan1lastOn = false;
bool fan2lastOn = false;
unsigned long previousMillis = 0;        // will store last time the sensors were updated
float humidity[2];
float temperature[2];

// Initialisation of ktc, a MAX6675 instance according to the pin definition up here
MAX6675 ktc(max6675CLK, max6675CS, max6675SO);

// ***************************MOZILLA-WebThings***************************
WebThingAdapter *adapter;
//Set up DHT-thing 1
const char *dhtType1[] = {"TemperatureSensor", "MultiLevelSensor", nullptr};
ThingDevice DHT1("DHT_WEST", "DHT sensor guest room, west channel", dhtType1);
ThingProperty TempProp1("Temperature", "Digital Input Pin", NUMBER, "TemperatureProperty");
ThingProperty HumProp1("Humidity", "Digital Input Pin", NUMBER, "LevelProperty");

//Set up DHT-thing 2
const char *dhtType2[] = {"TemperatureSensor", "MultiLevelSensor", nullptr};
ThingDevice DHT2("DHT_EAST", "DHT sensor guest room, east channel", dhtType2);
ThingProperty TempProp2("Temperature", "Digital Input Pin", NUMBER, "TemperatureProperty");
ThingProperty HumProp2("Humidity", "Digital Input Pin", NUMBER, "LevelProperty");

//Set up MAX6675-thing 2
const char *MAX6675type[] = {"TemperatureSensor", nullptr};
ThingDevice MAX6675_1("Floor", "Thermo couple guest room, bath in the floor", MAX6675type);
ThingProperty TempProp3("Temperature", "Digital Input Pins", NUMBER, "TemperatureProperty");

//Set up Seed moisture sensor 1
const char *seedMoistureTypes[] = {"MultiLevelSensor", nullptr};
ThingDevice SeedMoisture1("Moist_WEST", "Seed moisture sensor guest room, west channel", seedMoistureTypes);
ThingProperty MoisProp1("Moisture", "Analog Input Pin", NUMBER, "LevelProperty");

////Set up Seed moisture sensor 2
//ThingDevice SeedMoisture2("Moist_EAST1", "Seed moisture sensor guest room, east channel", seedMoistureTypes);
//ThingProperty MoisProp2("Moisture", "Digital Input Pin", NUMBER, "LevelProperty");
//
////Set up Seed moisture sensor 3
//ThingDevice SeedMoisture3("Moist_EAST2", "Seed moisture sensor guest room, east channel", seedMoistureTypes);
//ThingProperty MoisProp3("Moisture", "Digital Input Pin", NUMBER, "LevelProperty");
//
////Set up Seed moisture sensor 4
//ThingDevice SeedMoisture4("Moist_North", "Seed moisture sensor guest room, north channel", seedMoistureTypes);
//ThingProperty MoisProp4("Moisture", "Digital Input Pin", NUMBER, "LevelProperty");

//Set up Fan-thing 1
const char *fanTypes[] = {"Fan", nullptr};
ThingDevice fan1("fanWEST", "Fan in the west channel", fanTypes);
ThingProperty fanOn1("on", "", BOOLEAN, "OnOffProperty");

//Set up Fan-thing 2
//ThingDevice fan2("fanEAST", "Fan in the west channel", fanTypes);
//ThingProperty fanOn2("on", "", BOOLEAN, "OnOffProperty");


// ***************************Ehternet part***************************
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xFB, 0x80 };
IPAddress ip(192, 168, 0, 100);

void setup(void) {
  pinMode(snPin8, OUTPUT);
  digitalWrite(snPin8, HIGH);
  
  pinMode(snPin9, OUTPUT);
  digitalWrite(snPin9, HIGH);
  
  Serial.begin(9600);
  Serial.println("");
  Ethernet.begin(mac, ip);

  Serial.print("Server started. IP: ");
  Serial.println(Ethernet.localIP());
  
  for (auto& sensor : dht) {
    sensor.begin();
  }
  
  adapter = new WebThingAdapter("w25", Ethernet.localIP());
  
  TempProp1.unit = "degree celsius";
  DHT1.addProperty(&TempProp1);
  HumProp1.unit = "percent";
  HumProp1.title = "Humidity";
  HumProp1.readOnly = true;
  DHT1.addProperty(&HumProp1);
  
  TempProp2.unit = "degree celsius";
  DHT2.addProperty(&TempProp2);
  HumProp2.unit = "percent";
  HumProp2.title = "Humidity";
  HumProp2.readOnly = true;
  DHT2.addProperty(&HumProp2);

  TempProp3.unit = "degree celsius";
  MAX6675_1.addProperty(&TempProp3);
  
  MoisProp1.unit = "percent";
  MoisProp1.title = "Moisture";
  MoisProp1.readOnly = true;
  SeedMoisture1.addProperty(&MoisProp1);
  
//  MoisProp2.unit = "percent";
//  MoisProp2.title = "Moisture";
//  MoisProp2.readOnly = true;
//  SeedMoisture2.addProperty(&MoisProp2);
//  
//  MoisProp3.unit = "percent";
//  MoisProp3.title = "Moisture";
//  MoisProp3.readOnly = true;
//  SeedMoisture3.addProperty(&MoisProp3);
//  
//  MoisProp4.unit = "percent";
//  MoisProp4.title = "Moisture";
//  MoisProp4.readOnly = true;
//  SeedMoisture4.addProperty(&MoisProp4);

  fan1.addProperty(&fanOn1);

//  fan2.addProperty(&fanOn2);
  
  adapter->addDevice(&DHT1);
  adapter->addDevice(&DHT2);
  adapter->addDevice(&MAX6675_1);
  adapter->addDevice(&SeedMoisture1);
//  adapter->addDevice(&SeedMoisture2);
//  adapter->addDevice(&SeedMoisture3);
//  adapter->addDevice(&SeedMoisture4);
  adapter->addDevice(&fan1);
//  adapter->addDevice(&fan2);

  adapter->begin();

  Serial.println("HTTP server started with the following adresses to Things:");
  Serial.println("DHT1:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(DHT1.id);
  
  Serial.println("DHT2:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(DHT2.id);
  
  Serial.println("Thermocouple:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(MAX6675_1.id);
  
  Serial.println("Moisture1:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(SeedMoisture1.id);
  
//  Serial.println("Moisture2:");
//  Serial.print("http://");
//  Serial.print(Ethernet.localIP());
//  Serial.print("/things/");
//  Serial.println(SeedMoisture2.id);
//  
//  Serial.println("Moisture3:");
//  Serial.print("http://");
//  Serial.print(Ethernet.localIP());
//  Serial.print("/things/");
//  Serial.println(SeedMoisture3.id);
//  
//  Serial.println("Moisture4:");
//  Serial.print("http://");
//  Serial.print(Ethernet.localIP());
//  Serial.print("/things/");
//  Serial.println(SeedMoisture4.id);
  
  Serial.println("Fan west:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(fan1.id);
  
//  Serial.println("Fan east:");
//  Serial.print("http://");
//  Serial.print(Ethernet.localIP());
//  Serial.print("/things/");
//  Serial.println(fan2.id);
}

void loop(void) {
// It takes quite some time to read the sensors. In order to find the things quickly, 
// I read them out only every once in a while:

  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    // save the last time you blinked the LED
    for (int i = 0; i < 2; i++) {
      temperature[i] = dht[i].readTemperature();
      humidity[i] = dht[i].readHumidity();
    }
        
    tempF = ktc.readCelsius();
    moisW = 3.1415; //getMoistureValue(snPin2);
//    moisE1 = getMoistureValue(snPin5);
//    moisE2 = getMoistureValue(snPin6);
//    moisN = getMoistureValue(snPin7);
    previousMillis = currentMillis;
  }
  ThingPropertyValue Humidity1;
  Humidity1.number = humidity[0];
  HumProp1.setValue(Humidity1);
  ThingPropertyValue Temperature1;
  Temperature1.number = temperature[0];
  TempProp1.setValue(Temperature1);

  ThingPropertyValue Humidity2;
  Humidity2.number = humidity[1];
  HumProp2.setValue(Humidity2);
  ThingPropertyValue Temperature2;
  Temperature2.number = temperature[1];
  TempProp2.setValue(Temperature2);

  ThingPropertyValue Temperature3;
  Temperature3.number = tempF;
  TempProp3.setValue(Temperature3);

  ThingPropertyValue Moisture1;
  Moisture1.number = moisW;
  MoisProp1.setValue(Moisture1);
  
//  ThingPropertyValue Moisture2;
//  Moisture2.number = moisE1;
//  MoisProp2.setValue(Moisture2);
//  
//  ThingPropertyValue Moisture3;
//  Moisture3.number = moisE2;
//  MoisProp3.setValue(Moisture3);
//  
//  ThingPropertyValue Moisture4;
//  Moisture4.number = moisN;
//  MoisProp4.setValue(Moisture4);


  adapter->update();
  
  bool on = fanOn1.getValue().boolean;
  digitalWrite(snPin8, on ? LOW : HIGH); // active low led
  if (on != fan1lastOn) {
    Serial.print(fan1.id);
    Serial.print(": ");
    Serial.println(on);
  }
  fan1lastOn = on;
}



// getMoistureValue, reads the moisture sensor value i times and returns the average.
//    Takes the sensor pin as an input.
double getMoistureValue(int sensorPin){
  double sensorValue = 0;
  sensorValue = analogRead(sensorPin);
  return sensorValue/12;
}

Check out the Configuration section of the README.

Essentially, you’ll want to defined SMALL_JSON_DOCUMENT_SIZE and LARGE_JSON_DOCUMENT_SIZE instead of using LARGE_JSON_BUFFERS.

Thank you. Now a stupid question: By what factor would I increase their size?
And would I scale small and large doc size together?

#define LARGE_JSON_DOCUMENT_SIZE 4096 // => 8192 ? 
#define SMALL_JSON_DOCUMENT_SIZE 1024 // => 2048 ? 

//Use the long type to store integer values in JsonVariant:
#define ARDUINOJSON_USE_LONG_LONG 1
#include <ArduinoJson.h>

The problem is, if I make it bigger it is not shown in the browser, nor found as a thing. Do I need to adapt something else?

According to [https://arduinojson.org/v6/assistant/](http://ArduinoJson Assistant) the size of a DHT is 1317:
grafik

Every thing is sent via one JSON object, right?

Using LARGE_JSON_BUFFERS sets the following:

#define LARGE_JSON_DOCUMENT_SIZE 4096
#define SMALL_JSON_DOCUMENT_SIZE 1024

Since those are not working for your device, I’d recommend doubling those:

#define LARGE_JSON_DOCUMENT_SIZE 8192
#define SMALL_JSON_DOCUMENT_SIZE 2048

Yep, tried that. But then no JSON object is visible neither in the browser nor as a thing on the gateway.

Using the following code, things seem to work fine for me, using an Arduino Due:

// ***************************Libraries***************************
// Defintions for WebThings
#define LARGE_JSON_DOCUMENT_SIZE 8192
#define SMALL_JSON_DOCUMENT_SIZE 2048
#define ARDUINOJSON_USE_LONG_LONG 1

// Necessary libraries to use WebThings
#include <Arduino.h>
#include "Thing.h"
#include "EthernetWebThingAdapter.h" // Switch to the Wifi Adapter if you go wireless

// Necessary library to use DHT11/DHT22 sensors
#include <DHT.h>
//Define pins fot DHT sensors
#define DHTPIN1 2   // connect a DHT22 from the WEST wall to this plug [D2-D3]
#define DHTPIN2 6   // connect a DHT22 from the EAST wall to this plug [D6-D7]
// Instance of the DHT class, name = dht
DHT dht[] = {
  {DHTPIN1, DHT22},
  {DHTPIN2, DHT22},
};

// Necessary libraries to use thermo couples via voltage amplifier MAX6675
#include "max6675.h"
// Define input pins as constants
const int snPin2 = A0;         // connect grove moisture sensor 1 of the WEST wall to this Pin [D4-D5]
//const int snPin3 = 0;         // connect grove moisture sensor 2 of the WEST wall to this Pin [D4]
const int snPin5 = 8;         // connect grove moisture sensor 1 of the EAST wall to this Pin [D8-D9]
const int snPin6 = 10;        // connect grove moisture sensor 2 of the EAST wall to this Pin [D10-D11]
const int snPin7 = 12;        // connect grove moisture sensor of the NORTH wall to this Pin [D12-D13]
//Define the 3 pins where the MAY6675 is connected:
const int max6675SO = 3;    // Serial Output am PIN [D3]
const int max6675CS = 5;   // Chip Select am PIN [D5]
const int max6675CLK =7;   // Serial Clock am PIN [D7]
// Define output pins as constants
const int snPin8 = 9;         // connect switch for fan WEST/NORTH channel to this Pin [D9]
const int snPin9 = 11;        // connect switch for fan EAST channel to this Pin [D11]
// Define the interval length to read the sensors
const long interval = 10000;           // interval at which the sensor block is read (milliseconds)

// Initialisation of variables
double moisW = -1;          // Moisture West wall 1
//double moisW2 = -1;         // Moisture West wall 2
double moisE1 = -1;         // Moisture East wall 1
double moisE2 = -1;         // Moisture East wall 2
double moisN  = -1;         // Moisture North wall 1
double tempF  = -1;         // Temperature Floor
bool fan1lastOn = false;
bool fan2lastOn = false;
unsigned long previousMillis = 0;        // will store last time the sensors were updated
float humidity[2];
float temperature[2];

// Initialisation of ktc, a MAX6675 instance according to the pin definition up here
MAX6675 ktc(max6675CLK, max6675CS, max6675SO);

// ***************************MOZILLA-WebThings***************************
WebThingAdapter *adapter;
//Set up DHT-thing 1
const char *dhtType1[] = {"TemperatureSensor", "MultiLevelSensor", nullptr};
ThingDevice DHT1("DHT_WEST", "DHT sensor guest room, west channel", dhtType1);
ThingProperty TempProp1("Temperature", "Digital Input Pin", NUMBER, "TemperatureProperty");
ThingProperty HumProp1("Humidity", "Digital Input Pin", NUMBER, "LevelProperty");

//Set up DHT-thing 2
const char *dhtType2[] = {"TemperatureSensor", "MultiLevelSensor", nullptr};
ThingDevice DHT2("DHT_EAST", "DHT sensor guest room, east channel", dhtType2);
ThingProperty TempProp2("Temperature", "Digital Input Pin", NUMBER, "TemperatureProperty");
ThingProperty HumProp2("Humidity", "Digital Input Pin", NUMBER, "LevelProperty");

//Set up MAX6675-thing 2
const char *MAX6675type[] = {"TemperatureSensor", nullptr};
ThingDevice MAX6675_1("Floor", "Thermo couple guest room, bath in the floor", MAX6675type);
ThingProperty TempProp3("Temperature", "Digital Input Pins", NUMBER, "TemperatureProperty");

//Set up Seed moisture sensor 1
const char *seedMoistureTypes[] = {"MultiLevelSensor", nullptr};
ThingDevice SeedMoisture1("Moist_WEST", "Seed moisture sensor guest room, west channel", seedMoistureTypes);
ThingProperty MoisProp1("Moisture", "Analog Input Pin", NUMBER, "LevelProperty");

////Set up Seed moisture sensor 2
//ThingDevice SeedMoisture2("Moist_EAST1", "Seed moisture sensor guest room, east channel", seedMoistureTypes);
//ThingProperty MoisProp2("Moisture", "Digital Input Pin", NUMBER, "LevelProperty");
//
////Set up Seed moisture sensor 3
//ThingDevice SeedMoisture3("Moist_EAST2", "Seed moisture sensor guest room, east channel", seedMoistureTypes);
//ThingProperty MoisProp3("Moisture", "Digital Input Pin", NUMBER, "LevelProperty");
//
////Set up Seed moisture sensor 4
//ThingDevice SeedMoisture4("Moist_North", "Seed moisture sensor guest room, north channel", seedMoistureTypes);
//ThingProperty MoisProp4("Moisture", "Digital Input Pin", NUMBER, "LevelProperty");

//Set up Fan-thing 1
const char *fanTypes[] = {"Fan", nullptr};
ThingDevice fan1("fanWEST", "Fan in the west channel", fanTypes);
ThingProperty fanOn1("on", "", BOOLEAN, "OnOffProperty");

//Set up Fan-thing 2
//ThingDevice fan2("fanEAST", "Fan in the west channel", fanTypes);
//ThingProperty fanOn2("on", "", BOOLEAN, "OnOffProperty");


// ***************************Ehternet part***************************
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xFB, 0x80 };
IPAddress ip(192, 168, 0, 100);

void setup(void) {
  pinMode(snPin8, OUTPUT);
  digitalWrite(snPin8, HIGH);

  pinMode(snPin9, OUTPUT);
  digitalWrite(snPin9, HIGH);

  Serial.begin(9600);
  Serial.println("");
  Ethernet.begin(mac, ip);

  Serial.print("Server started. IP: ");
  Serial.println(Ethernet.localIP());

  for (auto& sensor : dht) {
    sensor.begin();
  }

  adapter = new WebThingAdapter("w25", Ethernet.localIP());

  TempProp1.unit = "degree celsius";
  DHT1.addProperty(&TempProp1);
  HumProp1.unit = "percent";
  HumProp1.title = "Humidity";
  HumProp1.readOnly = true;
  DHT1.addProperty(&HumProp1);

  TempProp2.unit = "degree celsius";
  DHT2.addProperty(&TempProp2);
  HumProp2.unit = "percent";
  HumProp2.title = "Humidity";
  HumProp2.readOnly = true;
  DHT2.addProperty(&HumProp2);

  TempProp3.unit = "degree celsius";
  MAX6675_1.addProperty(&TempProp3);

  MoisProp1.unit = "percent";
  MoisProp1.title = "Moisture";
  MoisProp1.readOnly = true;
  SeedMoisture1.addProperty(&MoisProp1);

//  MoisProp2.unit = "percent";
//  MoisProp2.title = "Moisture";
//  MoisProp2.readOnly = true;
//  SeedMoisture2.addProperty(&MoisProp2);
//
//  MoisProp3.unit = "percent";
//  MoisProp3.title = "Moisture";
//  MoisProp3.readOnly = true;
//  SeedMoisture3.addProperty(&MoisProp3);
//
//  MoisProp4.unit = "percent";
//  MoisProp4.title = "Moisture";
//  MoisProp4.readOnly = true;
//  SeedMoisture4.addProperty(&MoisProp4);

  fan1.addProperty(&fanOn1);

//  fan2.addProperty(&fanOn2);

  adapter->addDevice(&DHT1);
  adapter->addDevice(&DHT2);
  adapter->addDevice(&MAX6675_1);
  adapter->addDevice(&SeedMoisture1);
//  adapter->addDevice(&SeedMoisture2);
//  adapter->addDevice(&SeedMoisture3);
//  adapter->addDevice(&SeedMoisture4);
  adapter->addDevice(&fan1);
//  adapter->addDevice(&fan2);

  adapter->begin();

  Serial.println("HTTP server started with the following adresses to Things:");
  Serial.println("DHT1:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(DHT1.id);

  Serial.println("DHT2:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(DHT2.id);

  Serial.println("Thermocouple:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(MAX6675_1.id);

  Serial.println("Moisture1:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(SeedMoisture1.id);

//  Serial.println("Moisture2:");
//  Serial.print("http://");
//  Serial.print(Ethernet.localIP());
//  Serial.print("/things/");
//  Serial.println(SeedMoisture2.id);
//
//  Serial.println("Moisture3:");
//  Serial.print("http://");
//  Serial.print(Ethernet.localIP());
//  Serial.print("/things/");
//  Serial.println(SeedMoisture3.id);
//
//  Serial.println("Moisture4:");
//  Serial.print("http://");
//  Serial.print(Ethernet.localIP());
//  Serial.print("/things/");
//  Serial.println(SeedMoisture4.id);

  Serial.println("Fan west:");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(fan1.id);

//  Serial.println("Fan east:");
//  Serial.print("http://");
//  Serial.print(Ethernet.localIP());
//  Serial.print("/things/");
//  Serial.println(fan2.id);
}

void loop(void) {
// It takes quite some time to read the sensors. In order to find the things quickly,
// I read them out only every once in a while:

  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    // save the last time you blinked the LED
    for (int i = 0; i < 2; i++) {
      temperature[i] = dht[i].readTemperature();
      humidity[i] = dht[i].readHumidity();
    }

    tempF = ktc.readCelsius();
    moisW = 3.1415; //getMoistureValue(snPin2);
//    moisE1 = getMoistureValue(snPin5);
//    moisE2 = getMoistureValue(snPin6);
//    moisN = getMoistureValue(snPin7);
    previousMillis = currentMillis;
  }
  ThingPropertyValue Humidity1;
  Humidity1.number = humidity[0];
  HumProp1.setValue(Humidity1);
  ThingPropertyValue Temperature1;
  Temperature1.number = temperature[0];
  TempProp1.setValue(Temperature1);

  ThingPropertyValue Humidity2;
  Humidity2.number = humidity[1];
  HumProp2.setValue(Humidity2);
  ThingPropertyValue Temperature2;
  Temperature2.number = temperature[1];
  TempProp2.setValue(Temperature2);

  ThingPropertyValue Temperature3;
  Temperature3.number = tempF;
  TempProp3.setValue(Temperature3);

  ThingPropertyValue Moisture1;
  Moisture1.number = moisW;
  MoisProp1.setValue(Moisture1);

//  ThingPropertyValue Moisture2;
//  Moisture2.number = moisE1;
//  MoisProp2.setValue(Moisture2);
//
//  ThingPropertyValue Moisture3;
//  Moisture3.number = moisE2;
//  MoisProp3.setValue(Moisture3);
//
//  ThingPropertyValue Moisture4;
//  Moisture4.number = moisN;
//  MoisProp4.setValue(Moisture4);


  adapter->update();

  bool on = fanOn1.getValue().boolean;
  digitalWrite(snPin8, on ? LOW : HIGH); // active low led
  if (on != fan1lastOn) {
    Serial.print(fan1.id);
    Serial.print(": ");
    Serial.println(on);
  }
  fan1lastOn = on;
}



// getMoistureValue, reads the moisture sensor value i times and returns the average.
//    Takes the sensor pin as an input.
double getMoistureValue(int sensorPin){
  double sensorValue = 0;
  sensorValue = analogRead(sensorPin);
  return sensorValue/12;
}

Output:

[
  {
    "id": "DHT_WEST",
    "title": "DHT sensor guest room, west channel",
    "@context": "https://iot.mozilla.org/schemas",
    "base": "http://192.168.86.20/",
    "securityDefinitions": {
      "nosec_sc": {
        "scheme": "nosec"
      }
    },
    "security": "nosec_sc",
    "@type": [
      "TemperatureSensor",
      "MultiLevelSensor"
    ],
    "links": [
      {
        "rel": "properties",
        "href": "/things/DHT_WEST/properties"
      },
      {
        "rel": "actions",
        "href": "/things/DHT_WEST/actions"
      },
      {
        "rel": "events",
        "href": "/things/DHT_WEST/events"
      }
    ],
    "properties": {
      "Humidity": {
        "type": "number",
        "readOnly": 1,
        "unit": "percent",
        "title": "Humidity",
        "description": "Digital Input Pin",
        "@type": "LevelProperty",
        "links": [
          {
            "href": "/things/DHT_WEST/properties/Humidity"
          }
        ]
      },
      "Temperature": {
        "type": "number",
        "unit": "degree celsius",
        "description": "Digital Input Pin",
        "@type": "TemperatureProperty",
        "links": [
          {
            "href": "/things/DHT_WEST/properties/Temperature"
          }
        ]
      }
    },
    "href": "/things/DHT_WEST"
  },
  {
    "id": "DHT_EAST",
    "title": "DHT sensor guest room, east channel",
    "@context": "https://iot.mozilla.org/schemas",
    "base": "http://192.168.86.20/",
    "securityDefinitions": {
      "nosec_sc": {
        "scheme": "nosec"
      }
    },
    "security": "nosec_sc",
    "@type": [
      "TemperatureSensor",
      "MultiLevelSensor"
    ],
    "links": [
      {
        "rel": "properties",
        "href": "/things/DHT_EAST/properties"
      },
      {
        "rel": "actions",
        "href": "/things/DHT_EAST/actions"
      },
      {
        "rel": "events",
        "href": "/things/DHT_EAST/events"
      }
    ],
    "properties": {
      "Humidity": {
        "type": "number",
        "readOnly": 1,
        "unit": "percent",
        "title": "Humidity",
        "description": "Digital Input Pin",
        "@type": "LevelProperty",
        "links": [
          {
            "href": "/things/DHT_EAST/properties/Humidity"
          }
        ]
      },
      "Temperature": {
        "type": "number",
        "unit": "degree celsius",
        "description": "Digital Input Pin",
        "@type": "TemperatureProperty",
        "links": [
          {
            "href": "/things/DHT_EAST/properties/Temperature"
          }
        ]
      }
    },
    "href": "/things/DHT_EAST"
  },
  {
    "id": "Floor",
    "title": "Thermo couple guest room, bath in the floor",
    "@context": "https://iot.mozilla.org/schemas",
    "base": "http://192.168.86.20/",
    "securityDefinitions": {
      "nosec_sc": {
        "scheme": "nosec"
      }
    },
    "security": "nosec_sc",
    "@type": [
      "TemperatureSensor"
    ],
    "links": [
      {
        "rel": "properties",
        "href": "/things/Floor/properties"
      },
      {
        "rel": "actions",
        "href": "/things/Floor/actions"
      },
      {
        "rel": "events",
        "href": "/things/Floor/events"
      }
    ],
    "properties": {
      "Temperature": {
        "type": "number",
        "unit": "degree celsius",
        "description": "Digital Input Pins",
        "@type": "TemperatureProperty",
        "links": [
          {
            "href": "/things/Floor/properties/Temperature"
          }
        ]
      }
    },
    "href": "/things/Floor"
  },
  {
    "id": "Moist_WEST",
    "title": "Seed moisture sensor guest room, west channel",
    "@context": "https://iot.mozilla.org/schemas",
    "base": "http://192.168.86.20/",
    "securityDefinitions": {
      "nosec_sc": {
        "scheme": "nosec"
      }
    },
    "security": "nosec_sc",
    "@type": [
      "MultiLevelSensor"
    ],
    "links": [
      {
        "rel": "properties",
        "href": "/things/Moist_WEST/properties"
      },
      {
        "rel": "actions",
        "href": "/things/Moist_WEST/actions"
      },
      {
        "rel": "events",
        "href": "/things/Moist_WEST/events"
      }
    ],
    "properties": {
      "Moisture": {
        "type": "number",
        "readOnly": 1,
        "unit": "percent",
        "title": "Moisture",
        "description": "Analog Input Pin",
        "@type": "LevelProperty",
        "links": [
          {
            "href": "/things/Moist_WEST/properties/Moisture"
          }
        ]
      }
    },
    "href": "/things/Moist_WEST"
  },
  {
    "id": "fanWEST",
    "title": "Fan in the west channel",
    "@context": "https://iot.mozilla.org/schemas",
    "base": "http://192.168.86.20/",
    "securityDefinitions": {
      "nosec_sc": {
        "scheme": "nosec"
      }
    },
    "security": "nosec_sc",
    "@type": [
      "Fan"
    ],
    "links": [
      {
        "rel": "properties",
        "href": "/things/fanWEST/properties"
      },
      {
        "rel": "actions",
        "href": "/things/fanWEST/actions"
      },
      {
        "rel": "events",
        "href": "/things/fanWEST/events"
      }
    ],
    "properties": {
      "on": {
        "type": "boolean",
        "@type": "OnOffProperty",
        "links": [
          {
            "href": "/things/fanWEST/properties/on"
          }
        ]
      }
    },
    "href": "/things/fanWEST"
  }
]

Gateway:

I just tried, the same result. I get 400 as a response from the gateway and the raw data via the browser is {}

What kind of device are you using? I wonder if you’re running out of memory or something. You could try something in between, like:

#define LARGE_JSON_DOCUMENT_SIZE 6144
#define SMALL_JSON_DOCUMENT_SIZE 1536

1.5 times the memory: No, I tried that before, did not work either.

I use an Arduino MEGA, the corresponding Seeed Studio Shield, and an ethernet shield: Ethernet Schild Netzwerk Network Shield W5100 für Arduino UNO R3 Mega 2560.
The MAX6675 for the thermocouple and the DHT’s.

Hmm, I’m really not sure what to say. There’s no inherent limitation to the webthing library. I will say that it gets slower as you add more and more things, but as evidenced above, things work fine for me. I assume there aren’t any crashes or anything.

Thanks for your time so far.
I will see if it works with the example and let you know where I get with it. Maybe I make a mistake at some other point…

I just tried this easy example below, with the same result.
Then I started playing with the JSON document size.

works:
#define LARGE_JSON_DOCUMENT_SIZE 5555
#define SMALL_JSON_DOCUMENT_SIZE 1999
or this
#define LARGE_JSON_DOCUMENT_SIZE 5554
#define SMALL_JSON_DOCUMENT_SIZE 2000

doesn’t work:
#define LARGE_JSON_DOCUMENT_SIZE 5555
#define SMALL_JSON_DOCUMENT_SIZE 2000

so if the sum is smaller equal 7554, it works. Except of when the large JSON doc size is larger than 5560, then it won’t work, no matter how small the small size is

I am a bit lost. Any idea where/what I could look for?

#define LARGE_JSON_DOCUMENT_SIZE 5555
#define SMALL_JSON_DOCUMENT_SIZE 2000

#define ARDUINOJSON_USE_LONG_LONG 1

#include <Arduino.h>
#include <stdio.h>
#include "Thing.h"
#include "EthernetWebThingAdapter.h"
//
//#include <ESP8266WiFi.h>
//#include "SoftwareSerial.h"

WebThingAdapter *adapter;


const char *dhtTypes[] = {"HumidityTempSensor", "Sensor", nullptr};
ThingDevice DHTtemp1("SensorDevice", "DHT temperature sensor plugged into a single pin", dhtTypes);
ThingProperty DHTprop("Temperature", "Digital Input Pin", NUMBER, "TemperatureProperty");

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xFB, 0x80 };
IPAddress ip(192, 168, 0, 100);

void setup(void) {
  Serial.begin(9600);
  Serial.println("");
  Serial.println("");
  
  Ethernet.begin(mac, ip);
  Serial.print("Server started. IP: ");
  
  Serial.println(Ethernet.localIP());
  delay(100); // Give some time to initiate

  adapter = new WebThingAdapter("w25", Ethernet.localIP());
  DHTtemp1.addProperty(&DHTprop);
  adapter->addDevice(&DHTtemp1);
  adapter->begin();
  Serial.println("Starting HTTP server");
  Serial.print("http://");
  Serial.print(Ethernet.localIP());
  Serial.print("/things/");
  Serial.println(DHTtemp1.id);
}


void loop(void) {
  ThingPropertyValue levelValue;
  levelValue.number = random(0, 100);
  DHTprop.setValue(levelValue);
  adapter->update();
}

I tried it with the large code, here I can raise the large buffer size to something above 4550…