NEWS
Maximale größe von Nachrichten per MQTT?
-
Hi ich habe folgendes verhalten.
Wenn ich folgendes Payload über den Broker jage, dann wird auf meinem Arduino keine Änderung im Message Bus angezeigt, sprich es wird kein Callback "gefeuert".
{"Temp":{"out":"1","in":26.2}, "img":["0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff",....... "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff"]}
Der Code beinhaltet einmal 2 Temperaturwerte und einmal ein Binary Image welches ich gern mitliefern würde. das ist 265x265 pixel groß.
Wenn ich das Bild rauslasse, dann wird der Callabck aufgerufen.
Des Weiteren habe ich auch das Problem das wenn ich ein JSON verschachtelt übermitteln will der Callback auch nicht ausgeführt wird. Beispiel:
{"Temp":{"out":"1","in":26.2}, "dummydata":{"a":123 , "test": {"b":233}}}
Meine Einstellung für den Datenenpunkt lautet wir folgt:
{ "from": "system.adapter.admin.0", "ts": 1546010467854, "common": { "name": "clients/nodemcu/eink/data", "role": "variable", "type": "mixed", "desc": "Manuell erzeugt", "def": "", "read": true, "write": true }, "native": { "topic": "clients/nodemcu/eink/data" }, "acl": { "object": 1636, "owner": "system.user.admin", "ownerGroup": "system.group.administrator", "state": 1636 }, "_id": "mqtt.0.clients.nodemcu.eink.data", "type": "state" }
Mein Code auf dem Arduino:
`void setup() { Serial.begin(115200); Serial.println(); Serial.println("setup"); initMqtt(); Serial.println("setup done"); } void initMqtt() { client.setServer(mqttServer, 1886); client.setCallback(callback); Ethernet.begin(mac, WiFi.localIP()); Serial.println("Setup MQTT completed"); } void reconnectMqtt() { while (!client.connected()) { Serial.println("Mqtt Client not connected"); if (client.connect("e-ink", IOBROKER_USER, IOBROKER_PASS)) // if (client.connect("e-ink")) { Serial.println("Perform subscribe"); //mqtt.0.clients.nodemcu.Sensors.Obergeschoss.Lux client.subscribe("clients/nodemcu/eink/data"); // client.subscribe("mqtt/0/clients/nodemcu/Sensors/Temp/1/Temperature"); Serial.println("subscribed"); } else { Serial.print("."); delay(1000); } } } void callback(char *topic, byte *payload, unsigned int length) { Serial.println("Callback fired"); // Set som vars. char buff[256], echostring[512]; int n; for (n = 0; (n < length) && (n < sizeof(buff) - 1); n++) { buff[n] = payload[n]; } // Clear the buffer to prevent memoy leaks buff[n] = 0; sprintf(echostring, "%s %s", topic, buff); Serial.println(echostring); sprintf(echostring, "%s", buff); if (strcmp(topic, "clients/nodemcu/eink/data") == 0) { Serial.println("Setting new outdoor Temperature value from Topic"); const size_t bufferSize = JSON_ARRAY_SIZE(8192) + 2 * JSON_OBJECT_SIZE(2); DynamicJsonBuffer jsonBuffer(bufferSize); JsonObject &root = jsonBuffer.parseObject(buff); ShowDashboard(root["in"], root["out"], root[time]); }` Gibt es eine Einstellung die ich da vergessen habe eventuell? Wenn noch Informationen Fehlen dann bitte bescheid geben, liefere dann direkt nacht. Danke schon mal im Vorraus.[/time]