j'essaye de comprendre le fonctionnement du protocole MQTT, entre un wemos D1 et Domoticz.
Si je n'ai pas de problème pour envoyer un résultat de mesure vers domoticz, je n'arrive pas à lire les infos provenant de domoticz/out.
Code : Tout sélectionner
// D'après http://m2mio.tumblr.com/post/30048662088/a-simple-example-arduino-mqtt-m2mio
void callback(char* topic, byte* payload, unsigned int length) {
DynamicJsonDocument jsonBuffer( MQTT_MAX_PACKET_SIZE );
String messageReceived="";
// Affiche le topic entrant - display incoming Topic
Serial.print("\nEntering MQTT Callback. Message arrived regarding topic [");
Serial.print(topic);
Serial.println("]");
// decode payload message
for (int i = 0; i < length; i++) {
messageReceived+=((char)payload[i]);
}
// display incoming message
Serial.println(messageReceived);
Avez vous une idée?