ubidots / ubidots-mqtt-esp

MIT License
40 stars 23 forks source link

Static IP #14

Open methaqali opened 4 years ago

methaqali commented 4 years ago

Hi @woakas, and @jotathebest Thank you for this wonderful work. I like to add static IP to ubidots publish code in order to connect with router by this IP. I tried the following modification but it lead to appear the error in the attached screenshot. Any Suggestion is appreciated.

include "UbidotsESPMQTT.h"

/****

Ubidots client(TOKEN);

/****

void callback(char topic, byte payload, unsigned int length) { Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i=0;i<length;i++) { Serial.print((char)payload[i]); } Serial.println(); } /****

jotathebest commented 4 years ago

unfortunately actually it is not possible to set a fixed Ip with the library, and the wifi method to set fixed ips generates conflicts with the actual way that we use the pubsubclient instance. I will add this to our feature request queue for future releases

methaqali commented 4 years ago

Thank you @jotathebest for your feedback. I think this is very important feature especially for switching of data from Ubidot to local main controller - in case of interruption of internet services - and visa versa. This in fact will enhance Ubidot good contribution for IoT services and make control systems more reliable. I hope that you will try more to modify the library.

All the best.