marvinroger / async-mqtt-client

📶 An Arduino for ESP8266 asynchronous MQTT client implementation
MIT License
839 stars 266 forks source link

compilation error 'class MDNSResponder' has no member named 'IP' #308

Closed crbyxwpzfl closed 2 months ago

crbyxwpzfl commented 2 months ago

Hi I just tried to compile your examples/FullyFeatured-ESP32/FullyFeatured-ESP32.ino and got three errors. This one I was not able to resolve

/Users/***/Documents/Arduino/libraries/AsyncMqttClient/src/AsyncMqttClient.cpp:142:28: error: 'class MDNSResponder' has no member named 'IP'
  142 |                 _ip = MDNS.IP(0);
      |                            ^~
These two I resolved as the error said. ```c /Users/***/Desktop/test/test.ino: In function 'void WiFiEvent(arduino_event_id_t)': /Users/***/Desktop/test/test.ino:35:14: error: 'SYSTEM_EVENT_STA_GOT_IP' was not declared in this scope; did you mean 'IP_EVENT_STA_GOT_IP'? 35 | case SYSTEM_EVENT_STA_GOT_IP: | ^~~~~~~~~~~~~~~~~~~~~~~ | IP_EVENT_STA_GOT_IP /Users/***/Desktop/test/test.ino:41:14: error: 'SYSTEM_EVENT_STA_DISCONNECTED' was not declared in this scope; did you mean 'WIFI_EVENT_STA_DISCONNECTED'? 41 | case SYSTEM_EVENT_STA_DISCONNECTED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_DISCONNECTED ``` I replaced [line 35](https://github.com/marvinroger/async-mqtt-client/blob/58cc70449fbeb0ffeb5740da91870de089a8a21d/examples/FullyFeatured-ESP32/FullyFeatured-ESP32.ino#L35) with `case IP_EVENT_STA_GOT_IP:` and replaced [line 41](https://github.com/marvinroger/async-mqtt-client/blob/58cc70449fbeb0ffeb5740da91870de089a8a21d/examples/FullyFeatured-ESP32/FullyFeatured-ESP32.ino#L41) with `case WIFI_EVENT_STA_DISCONNECTED:` as the compiler error said.

I compiled for an Adafruit Feather Esp32s3. Please close this whenever. This likely is just me failing to read some docs correctly as no one reported this. Anyway Perhaps someone has a tip for me. And Thank you for this library!

doko-rr commented 2 months ago

I encountered the same error as well.

crbyxwpzfl commented 2 months ago

The second two issues perhaps are form Arduino core v3 see here. theelims/PsychicMqttClient lib is v3 compatible since this release. Sorry for suggesting an other lib here but I dont know enough to pr a fix.

knopserl commented 2 months ago

I have the same compile error since I switched from AsyncMQTT_ESP32 to this library and it seem not to work with the new ESP32 API's or ???

rustysoma commented 2 months ago

In the file AsyncMqttClient.cpp on line 142, replace _ip = MDNS.IP(0); with _ip = MDNS.address(0);

crbyxwpzfl commented 2 months ago

thank you @rustysoma this solves it. ill close this now.

RuiSantosdotme commented 2 months ago

@luebbe @cturqueti can you make this change to the develop branch?

Otherwise the current version is not compiling with ESP32 Arduino core v3

In the file AsyncMqttClient.cpp on line 142, replace _ip = MDNS.IP(0); with _ip = MDNS.address(0);

luebbe commented 2 months ago

Can you please provide a PR?