Hi!
I try to use Deep Sleep mode for NodeMCU. I connect D0 pin to RST
and i add code from https://docs.thinger.io/coding#esp8266-deep-sleep-and-smartconfig
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
ThingerSmartConfig thing(USERNAME,
DEVICE_ID,
DEVICE_CREDENTIAL,
false); // required for deep sleep
and i see the error
conflicting declaration ‘ThingerESP8266 thing’
I solved the problem without using ThingerSmartConfig
The main thing is to put this string ESP.deepSleep(60e6); in a separate function!
Not in loop or setup
I use Bucket settings -> Data Sourse -> From write call
working code below
#include <ThingerESP8266.h>
#include "DHTesp.h" //DHT sensor library for ESPx by beegee_tokyo
#define USERNAME "scratch"
#define DEVICE_ID "ESP8266"
#define DEVICE_CREDENTIAL "L@PvNva"
#define SSID "Xiaomi"
#define SSID_PASSWORD "12345"
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
DHTesp dht;
void setup() {
pinMode(2, INPUT);
Serial.begin(115200);
dht.setup(2, DHTesp::DHT11);
thing.add_wifi(SSID, SSID_PASSWORD);
thing["TempHum"] >> [](pson &out){
out["temperature"] = dht.getTemperature();
out["humidity"] = dht.getHumidity();
};
}
void bucket() {
thing.write_bucket("Bucket_1", "TempHum");
ESP.deepSleep(60e6);
}
void loop() {
thing.handle();
bucket();
}
It also had the same problem, it is curious, but fortunately it is enough to put the deepSleep in another context.
best