Hello class Ubidots’ has no member named ‘getValueWithdatasource’ i got this fault i try getValue or etc but didn’t work i have 2 esp8266 . one is for relays other is sensors. i try to autocontrol relays with sensors.
Greetings @ergesama I hope you are doing great.
Can you please confirm that you are using the latest version of our ESP8266 library?
If not, you might consider updating your firmware to the latest version. Within the repository linked above, you can find examples to guide you.
Here’s a script that allows you to quickly retrieve values from your variables:
// This example retrieves last value of a variable from the Ubidots API
// using HTTP protocol.
/****************************************
* Include Libraries
****************************************/
#include "Ubidots.h"
/****************************************
* Define Constants
****************************************/
const char* UBIDOTS_TOKEN = "..."; // Put here your Ubidots TOKEN
const char* WIFI_SSID = "..."; // Put here your Wi-Fi SSID
const char* WIFI_PASS = "..."; // Put here your Wi-Fi password
const char* DEVICE_LABEL_TO_RETRIEVE_VALUES_FROM = "weather-station"; // Replace with your device label
const char* VARIABLE_LABEL_TO_RETRIEVE_VALUES_FROM = "humidity"; // Replace with your variable label
Ubidots ubidots(UBIDOTS_TOKEN, UBI_HTTP);
/****************************************
* Auxiliar Functions
****************************************/
// Put here your auxiliar functions
/****************************************
* Main Functions
****************************************/
void setup() {
Serial.begin(115200);
ubidots.wifiConnect(WIFI_SSID, WIFI_PASS);
// ubidots.setDebug(true); //Uncomment this line for printing debug messages
}
void loop() {
/* Obtain last value from a variable as float using HTTP */
float value = ubidots.get(DEVICE_LABEL_TO_RETRIEVE_VALUES_FROM, VARIABLE_LABEL_TO_RETRIEVE_VALUES_FROM);
// Evaluates the results obtained
if (value != ERROR_VALUE) {
Serial.print("Value:");
Serial.println(value);
}
delay(5000);
}
Please let us know if this was helpful for you.
Best regards
–Juan David
how can update my firmware and when i update my firmware can i use other nodemcu’s datas to first nodemcu?
Greetings @ergesama,
Based on your questions, it seems you are interested in:
- Updating the firmware on your NodeMCU.
- Maintaining Device and Variable Configuration After Firmware Update
Updating the firmware
To update your firmware, please download the latest version of our library from the Ubidots ESP8266 GitHub repository. You can do this by downloading the zip file from the master branch.
Here’s how to add our library to your project, which varies by the IDE you are using:
- For Arduino IDE, follow these instructions on Adding Libraries in the Arduino IDE.
- For PlatformIO, here’s a guide on Adding Libraries in PlatformIO.
Once added, flash the new firmware using your IDE’s tools.
Make sure to adjust your code to align with the usage examples provided in our library documentation.
Maintaining Device and Variable Configuration After Firmware Update
To ensure that both data transmission and reception continue seamlessly post-update, configure the device and variable labels in the new firmware to exactly match the previous settings. This alignment will ensure that your NodeMCU device maintains consistent communication, handling both incoming and outgoing data without interruption.
Particularly in this part of the example you can do so:
const char* DEVICE_LABEL_TO_RETRIEVE_VALUES_FROM = "weather-station"; // Replace with your device label
const char* VARIABLE_LABEL_TO_RETRIEVE_VALUES_FROM = "humidity"; // Replace with your variable label
Please let us know if this was helpful.
Best regards
– Juan David
i hope it can be worked otherwise i will try serial communication can i communicate with that?