JAndrassy / WiFiEspAT

Arduino networking library. Standard Arduino WiFi networking API over ESP8266 or ESP32 AT commands.
GNU Lesser General Public License v2.1
288 stars 44 forks source link

How to print esp client hostname? #6

Closed heinemannj closed 4 years ago

heinemannj commented 4 years ago

I'm using a persistent WiFi connection with dhcp enabled in client mode. How to print esp client hostname?

Goal: I want to feed an mqtt_clientId with the default esp hostname

const char* mqtt_clientId = "WEMOSMega_A0FFFF";

JAndrassy commented 4 years ago

Sorry, right now there isn't a function to read the hostname. I will add it tomorrow.

JAndrassy commented 4 years ago

can you try the 'git version'?

heinemannj commented 4 years ago

Hi Juraj, I confirm that WiFi.hostname() in the new measter version is working for me:

char hostname[33]; WiFi.hostname(hostname); Serial.print("hostname "); Serial.println(hostname);

11:42:41.563 -> hostname ESP-C60650

Many thanks for your support! Cheers