Closed sticilface closed 9 years ago
Ah, I see. The server hostname/IP address is only used in connect(), so it should be safe to set/change it before then.
With this update you create your global client object:
PubSubClient mqttclient;
And then later assign the server ip address:
mqttclient.set_server(MQTTserver);
haha... I've just been modifying the example script to show that it doesn't work and you've come up with a solution! fantastic. Thank you!
Will try it out
Works perfectly. Thank you... I've been going bonkers trying to get that to work today...
Hi,
I've started using your fork as the older version no longer compiled on the ESP arduino IDE.
I have got it working apart from one thing, I can't assign the IP address dynamically. I want to read the IP address from the EEPROM then start the MQTT based on this. When i define MQTTserver as below it all works...
If i do not, and try to assign MQTT server from EEPROM... during set up... I get the right IP but it fails to connect...
Any ideas why? I had this working before when the IP address was a char array..