jeelabs / esp-link

esp8266 wifi-serial bridge, outbound TCP, and arduino/AVR/LPC/NXP programmer
Other
2.82k stars 720 forks source link

How to get esp host name in uC? #437

Closed PomeloRock closed 5 years ago

PomeloRock commented 5 years ago

I find GetWifiStatus() but I would like to get esp host name in ELClient in Arduino.

Is there any way?

Thanks.

uzi18 commented 5 years ago

I think it is imposible now.

PomeloRock commented 5 years ago

@uzi18 Thanks!

uzi18 commented 5 years ago

elclient+esp-link need to be extended, with such feature

swilson86 commented 5 years ago

Depending on which version of esp-link/el-client you have, it can be done if you are using MQTT. See the notes at https://github.com/jeelabs/esp-link/issues/418

This particular block of code will return the MQTT name which usually is the same as the station name (with exception of slashes which might have to be substituted with a hyphen):

// Query the MQTT clientid Serial.print("MQTT client id : "); char *mqtt_clientid = cmd.mqttGetClientId(); Serial.println(mqtt_clientid);

uzi18 commented 5 years ago

It's some kind of workaround =)

PomeloRock commented 5 years ago

I will try and comment, thanks.

PomeloRock commented 5 years ago

error: 'class ELClientCmd' has no member named 'mqttGetClientId'

esp-link-v3.0.14-g963ffbb . Is it the last one, right?

el-client, I don't know where is the version, but I think is the last one too because I downloaded last week.

Any idea? Thanks.

swilson86 commented 5 years ago

esp-link v3.2.47-g9c6530d

PomeloRock commented 5 years ago

oh.. I thought v3.2 was unstable, I will try and comment. Gracias!

swilson86 commented 5 years ago

I have found it very solid for what I do. It's got some great bug fixes... especially in the area that you are I spoke about. Keep me posted! Ah... I still use the same old El-Client. Hasn't been updated for years.

PomeloRock commented 5 years ago

I have flashed v3.2 and is working ok, I have also working OTA with avrdude.

I still need hostname or wifi SSID.

swilson86 commented 5 years ago

Excellent! The notes on thread 418 on this forum show how it was solved getting the IP address etc. There is example working code there.

PomeloRock commented 5 years ago

Thanks for help.

uzi18 commented 5 years ago

related to #418