n8twj / Homie-OLED

128x64 OLED Display using the Homie ESP8266 Framework
MIT License
1 stars 0 forks source link

got this working, Just letting this here #1

Open sheda opened 7 years ago

sheda commented 7 years ago

include

// [...] AsyncMqttClient& mqttClient = Homie.getMqttClient(); void onMqttConnect(bool sessionPresent) { mqttClient.onMessage(onMqttMessage); uint16_t packetIdSub = mqttClient.subscribe("toto/titi/tata", 0); mqttClient.publish("toto/titi/tata/tutu", 0, false, "true", sizeof("true")); Serial << "Subscribing at QoS 1" << packetIdSub << endl; } // [...] void onMqttMessage(char topic, char payload, AsyncMqttClientMessageProperties properties, size_t len, size_t index, size_t total) { Serial.println(" Publish received "); // ... Serial.println(payload); } // [...] void setup() { Serial.begin(115200); Serial << endl << endl; // [...] mqttClient.onConnect(onMqttConnect); Homie.setup(); } // [...] void loop() { Homie.loop(); }

n8twj commented 7 years ago

The issue seems to be the "by reference" & :)

AsyncMqttClient& mqttClient = Homie.getMqttClient();

sheda commented 7 years ago

Hey n8twj, This pull request may interest you as well: https://github.com/marvinroger/homie-esp8266/pull/244