thissmarthouse / coogleiot Goto Github PK
View Code? Open in Web Editor NEWA ESP8266 Library for easy IOT device development
Home Page: https://www.thissmarthouse.net/coogleiot/
License: Other
A ESP8266 Library for easy IOT device development
Home Page: https://www.thissmarthouse.net/coogleiot/
License: Other
Trying to write a very bare bones application to get started. Works initially, sets up an AP, but when I enter SSID/password to connect as a client, after it reboots, it connects to the wifi ok, goes thru initialization but then constantly reboots after initialization with this message:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v00000000
~ld
Here's the code I'm running (I added the resetEEProm() so I could clear it, but it doesn't reset the EEProm). After setting up client wifi, it just constantly reboots.
#include <CoogleIOT.h>
CoogleIOT *iot;
PubSubClient *mqtt;
#define SERIAL_BAUD 115200
void setup()
{
iot = new CoogleIOT(LED_BUILTIN);
iot->enableSerial(SERIAL_BAUD);
iot->resetEEProm();
iot->initialize();
}
void loop()
{
iot->loop();
}
Hi,
when building with the Arduino IDE everythings fine - But building with arduino-mk fails with a linker error concerning DNSServer:
/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -g -Os -nostdlib -Wl,--no-check-sections -u call_user_start -u _printf_float -u _scanf_float -Wl,-static -L/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/tools/sdk/lib -L/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/tools/sdk/ld -L/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/tools/sdk/libc/xtensa-lx106-elf/lib -Teagle.flash.4m1m.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o build.nodemcu-2.4.2/tempsensor.elf -Wl,--start-group ./build.nodemcu-2.4.2/tempsensor.ino.cpp.o ./build.nodemcu-2.4.2/libraries/CoogleEEPROM.cpp.o ./build.nodemcu-2.4.2/libraries/CoogleIOTWebserver.cpp.o ./build.nodemcu-2.4.2/libraries/CoogleIOT.cpp.o ./build.nodemcu-2.4.2/libraries/DNSServer.cpp.o ./build.nodemcu-2.4.2/libraries/LUrlParser.cpp.o ./build.nodemcu-2.4.2/libraries/PubSubClient.cpp.o ./build.nodemcu-2.4.2/libraries/DNSServer.cpp.o ./build.nodemcu-2.4.2/libraries/EEPROM.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266HTTPClient.cpp.o ./build.nodemcu-2.4.2/libraries/Parsing.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266WebServer.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266WebServerSecureBearSSL.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266WebServerSecureAxTLS.cpp.o ./build.nodemcu-2.4.2/libraries/mimetable.cpp.o ./build.nodemcu-2.4.2/libraries/BearSSLHelpers.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266WiFiScan.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266WiFiSTA.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266WiFiAP.cpp.o ./build.nodemcu-2.4.2/libraries/CertStoreBearSSL.cpp.o ./build.nodemcu-2.4.2/libraries/WiFiServerSecureBearSSL.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266WiFiMulti.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266WiFi.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266WiFiGeneric.cpp.o ./build.nodemcu-2.4.2/libraries/WiFiUdp.cpp.o ./build.nodemcu-2.4.2/libraries/WiFiServer.cpp.o ./build.nodemcu-2.4.2/libraries/WiFiClient.cpp.o ./build.nodemcu-2.4.2/libraries/WiFiServerSecureAxTLS.cpp.o ./build.nodemcu-2.4.2/libraries/WiFiClientSecureBearSSL.cpp.o ./build.nodemcu-2.4.2/libraries/WiFiClientSecureAxTLS.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266httpUpdate.cpp.o ./build.nodemcu-2.4.2/libraries/ESP8266mDNS.cpp.o ./build.nodemcu-2.4.2/core/core.a -lhal -lphy -lpp -lnet80211 -llwip_gcc -lwpa -lcrypto -lmain -lwps -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group -L./build.nodemcu-2.4.2
./build.nodemcu-2.4.2/libraries/DNSServer.cpp.o: In function `DNSServer::setTTL(unsigned int const&)':
/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/libraries/DNSServer/src/DNSServer.cpp:6: multiple definition of `DNSServer::DNSServer()'
./build.nodemcu-2.4.2/libraries/DNSServer.cpp.o:/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/libraries/DNSServer/src/DNSServer.cpp:6: first defined here
./build.nodemcu-2.4.2/libraries/DNSServer.cpp.o: In function `DNSServer::setTTL(unsigned int const&)':
/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/libraries/DNSServer/src/DNSServer.cpp:6: multiple definition of `DNSServer::DNSServer()'
./build.nodemcu-2.4.2/libraries/DNSServer.cpp.o:/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/libraries/DNSServer/src/DNSServer.cpp:6: first defined here
./build.nodemcu-2.4.2/libraries/DNSServer.cpp.o: In function `String::operator+=(char)':
/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/libraries/DNSServer/src/DNSServer.cpp:28: multiple definition of `DNSServer::setErrorReplyCode(DNSReplyCode const&)'
./build.nodemcu-2.4.2/libraries/DNSServer.cpp.o:/home/flo/projects/arduino/tempsensor/Esp8266-Arduino-Makefile/esp8266-2.4.2/libraries/DNSServer/src/DNSServer.cpp:28: first defined here
./build.nodemcu-2.4.2/libraries/DNSServer.cpp.o: In function `DNSServer::processNextRequest()':
I trying to build with various combinations of
ARDUINO_LIBS=DNSServer CoogleIOT ESP8266HTTPClient ESP8266WiFi
USER_DEFINE=-DARDUINO_ESP8266_ESP01 -DMQTT_MAX_PACKET_SIZE=512
Flo
Hi.
I don't know whether CoogleIoT does something weird, or it is me who doesn't really understand how to use it or setup properly.
I've downloaded CoogleIoT v1.3.1 (github) and flashed the following sample firmware to a LoLin NodeMCU v3 dev board. After flashing it, the device does not stops flashing the main led. No wifi hotspot is published, and a lot of garbage is printed in the Serial Monitor of the Arduino studio.
#include <ESP8266WiFi.h>
#include <CoogleIOT.h>
const int SERIAL_BAUD = 115200;
const int SleepTime = 5e6;
CoogleIOT *iot;
void setup() {
iot = new CoogleIOT(LED_BUILTIN);
iot->enableSerial(SERIAL_BAUD)
.initialize();
iot->info("Setup finalised");
}
void loop() {
iot->loop();
iot->info("Going to sleep");
ESP.deepSleep(SleepTime); // Going to sleep. Pins are circuited correctly.
}
Any clue? Thanks in advance.
Not sure if this is an issue with the time library that I am using or this code. Basically the time pointer function for p_tm->tm_month returns a value between 0 (January) to 11 (December); therefore the timestamp it is off by a month ex: "timestamp" : "2018-05-13 19:50:24" versus "timestamp" : "2018-06-13 19:50:24" for June 13 2018.
This might be caused by the time library that I am using; I don't know. I am using the following library:
Git Repo: "https://github.com/PaulStoffregen/Time"
Webpage: "http://playground.arduino.cc/Code/Time"
If not cause by the time library then it's an easy fix which I can provide. Thank you for a great library; just wish I would have found this about 6 months ago instead of a few weeks ago; it would have saved me a lot of time.
I get an exception after configuration when it restarts, what is the problem?
[INFO UKWN] Connecting to remote AP
[INFO UKWN] Connected to Remote Access Point!
[INFO UKWN] Our IP Address is:
[INFO UKWN] 192.168.1.127
Exception (28):
epc1=0x402147bb epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
ctx: cont
sp: 3fff1430 end: 3fff17a0 offset: 01a0
>>>stack>>>
3fff15d0: 3fff21cc 4020c9fc 3fff30a4 3fff0778
3fff15e0: 3fffdad0 3ffe995c 3fff30a4 40208fb6
3fff15f0: 00000022 40103ee1 00040000 00000000
3fff1600: 3ffeeec0 40102ebe 00000000 4000050c
3fff1610: 3fffc278 40102d14 00000000 4000050c
3fff1620: 3fffc278 40102d14 3fffc200 00000022
3fff1630: 3fff1640 00000000 0000001f 40105789
3fff1640: 40206e95 00000030 0000000d ffffffff
3fff1650: 40206e8c 00000000 000003e8 00000000
3fff1660: 00000003 00000101 00000000 fffffffe
3fff1670: ffffffff 3fffc6fc 00000078 00048ac6
3fff1680: 00000000 00000000 3fff0526 00000030
3fff1690: 00000000 3fff17f4 3fff0778 00000030
3fff16a0: 00000000 00000000 00000001 3fff0771
3fff16b0: 00000000 3fffdad0 3fff0778 00000030
3fff16c0: 00000190 3fffc6fc 00000001 3fff0771
3fff16d0: 00000000 3fffdad0 3fff0778 00000030
3fff16e0: 00000000 3fffdad0 3fff0778 00000030
3fff16f0: 00000000 00000000 00000000 4021293f
3fff1700: 3fff0694 000005a4 000005a4 4010020c
3fff1710: 3fffdad0 3fff052c 3fff1740 4010068c
3fff1720: 3fff0694 00000218 00000218 4010020c
3fff1730: 00000000 00000000 00000000 3fff5454
3fff1740: 0000000f 00000000 3fff2e8c 0000000f
3fff1750: 00000000 3fff30a4 3fff30a4 40206c60
3fff1760: 00000000 00000000 00000000 3fff0778
3fff1770: 3fffdad0 00000000 3fff052c 40206f93
3fff1780: 3fffdad0 00000000 3fff0771 4021350c
3fff1790: feefeffe feefeffe 3fff0780 40100744
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
A stripped down garagedooropener crashes after first config via integrate AP. I set the MQTT port and after joining the WIFI the ESP Crashes:
[INFO UKWN] Coogle IOT v1.3.1 initializing..
09:35:44.372 -> [DEBUG UKWN] Introspecting on-board Flash Memory:
09:35:44.372 -> [DEBUG UKWN] Flash ID: 00164020
09:35:44.372 -> [DEBUG UKWN] Flash real size: 4194304
09:35:44.372 -> [DEBUG UKWN] Flash IDE Size: 4194304
09:35:44.372 -> [DEBUG UKWN] Flash IDE Speed: 40000000
09:35:44.372 -> [DEBUG UKWN] Flash IDE Mode: 1073645354
09:35:44.372 -> [DEBUG UKWN] Flash Chip Configuration Verified: OK
[INFO UKWN] EEPROM not initialized for platform, erasing..
[INFO UKWN] Log file successfully opened
[INFO UKWN] Cannot connect WiFi client, no remote AP specified
09:35:59.582 -> [ERROR UKWN] Failed to connect to remote AP
09:35:59.582 -> [INFO UKWN] Enabling Configuration Mode
09:35:59.582 -> [INFO UKWN] No AP Password found in memory
09:35:59.582 -> [INFO UKWN] Setting to default password: coogleiot
[INFO UKWN] No AP Name found in memory. Auto-generating AP name.
09:35:59.615 -> [INFO UKWN] Setting AP Name To:
09:35:59.615 -> [INFO UKWN] COOGLEIOT_893542
[INFO UKWN] Intiailzing Access Point
[INFO UKWN] Local IP Address:
[INFO UKWN] 192.168.0.1
09:36:01.503 -> [INFO UKWN] Initializing DNS Server
09:36:01.503 -> [INFO UKWN] Creating Configuration Web Server
09:36:01.503 -> [INFO UKWN] Initializing Webserver
09:36:01.503 -> [INFO UKWN] Webserver Initiailized!
[INFO UKWN] Not connected to WiFi. Attempting reconnection.
[INFO UKWN] Connecting to remote AP
[INFO UKWN] Connected to Remote Access Point!
09:37:01.796 -> [INFO UKWN] Our IP Address is:
09:37:01.796 -> [INFO UKWN] 192.168.227.159
09:37:01.995 -> Exception (28):
09:37:01.995 -> epc1=0x4021605b epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000008 depc=0x00000000
09:37:01.995 ->
09:37:01.995 -> >>>stack>>>
09:37:01.995 ->
09:37:01.995 -> ctx: cont
09:37:01.995 -> sp: 3ffffc60 end: 3fffffc0 offset: 01a0
09:37:02.028 -> 3ffffe00: 3fffdad0 3ffe9894 3fff0cb4 402093ee
09:37:02.028 -> 3ffffe10: 401039a2 0000007f 7fffffff 00000000
09:37:02.028 -> 3ffffe20: 0000007f 4010379e 00040000 4010233a
09:37:02.028 -> 3ffffe30: 40102817 00080000 4010277a 00000100
09:37:02.028 -> 3ffffe40: 00000000 0000007f 00000000 4000050c
09:37:02.028 -> 3ffffe50: 00000000 00000000 0000001f 40105135
09:37:02.028 -> 3ffffe60: 4000050c 00080000 00000000 4000050c
09:37:02.028 -> 3ffffe70: 4021596b 00000030 00000010 ffffffff
09:37:02.061 -> 3ffffe80: 40214adf 00000000 3fff1c40 ffff8000
09:37:02.061 -> 3ffffe90: 000000f2 3fff26b8 00000000 fffffffe
09:37:02.061 -> 3ffffea0: 00000190 3fffc6fc 00000001 3ffefeb0
09:37:02.061 -> 3ffffeb0: 00000000 3fffdad0 3ffefee0 00000030
09:37:02.061 -> 3ffffec0: 00000000 00000000 00000000 fffffffe
09:37:02.061 -> 3ffffed0: ffffffff 3fffc6fc 00000001 3ffefeb0
09:37:02.061 -> 3ffffee0: 00000000 3fffdad0 3ffefee0 00000030
09:37:02.155 -> 3ffffef0: 00000000 3fffdad0 3ffefee0 00000030
09:37:02.155 -> 3fffff00: 00000000 3fffdad0 3ffefee0 00000030
09:37:02.155 -> 3fffff10: 3ffef710 3fff0d58 00000000 40213de8
09:37:02.155 -> 3fffff20: 00000001 006ab885 3fff0d58 40213e04
09:37:02.155 -> 3fffff30: 3ffefd50 3ffeff58 3ffe95d4 402097f3
09:37:02.155 -> 3fffff40: 3ffeff74 00000147 00000147 40100630
09:37:02.155 -> 3fffff50: 00000000 00000000 00000000 3fff26bc
09:37:02.155 -> 3fffff60: 0000000f 00000000 3fff1c44 0000000f
09:37:02.155 -> 3fffff70: 00000000 00000000 3fff0cb4 40213e04
09:37:02.155 -> 3fffff80: 3fffdad0 00000000 3fff0cb4 3ffefee0
09:37:02.155 -> 3fffff90: 3fffdad0 00000000 3ffefeb0 402073e7
09:37:02.155 -> 3fffffa0: 3fffdad0 00000000 3ffefeb0 40214adc
09:37:02.155 -> 3fffffb0: feefeffe feefeffe 3ffe8544 40100ad1
09:37:02.155 -> <<<stack<<<
09:37:02.155 ->
09:37:02.155 -> ets Jan 8 2013,rst cause:2, boot mode:(1,6)
09:37:02.155 ->
Decoding the crash returns:
Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads
PC: 0x4021605b: PubSubClient::connected() at /home/flo/Arduino/libraries/PubSubClient/src/PubSubClient.cpp line 603
EXCVADDR: 0x00000008
Decoding stack results
0x402093ee: CoogleIOT::loop() at /home/flo/Arduino/libraries/CoogleIOT/src/CoogleIOT.cpp line 323
0x4021596b: run_scheduled_functions() at /home/flo/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/Schedule.cpp line 68
0x40214adf: loop_wrapper() at /home/flo/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/core_esp8266_main.cpp line 126
0x40213de8: String::invalidate() at /home/flo/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/WString.cpp line 141
0x40213e04: String::~String() at /home/flo/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/WString.cpp line 125
0x402097f3: CoogleIOT::initialize() at /home/flo/Arduino/libraries/CoogleIOT/src/CoogleIOT.cpp line 605
0x40100630: _umm_free at /home/flo/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/umm_malloc/umm_malloc.c line 1300
0x40213e04: String::~String() at /home/flo/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/WString.cpp line 125
0x402073e7: loop() at /home/flo/projects/arduino/tempsensor/tempsensor.ino line 144
0x40214adc: loop_wrapper() at /home/flo/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/core_esp8266_main.cpp line 125
The line is
601 boolean PubSubClient::connected() {
602 boolean rc;
603 if (_client == NULL ) {
604 rc = false;
605 } else {
Which is interesting - As _client is a private object pointer in the PubSubClient Class it seems there is no PubSubClient object instantiated or the pointer is NULL.
And no there is not a valid MQTT endpoint configured and yes i have increased the MAX packet size in MQTT.
Flo
It would be nice if it is possible to use CoogleIOT's logic to customize your own sketch, like:
Thanks for the great work.
I have downloaded and installed your library, but am unable to compile your example as the GarageDoor-Opener.h file is missing. I am unable to find it on GitHub.
Can you please provide the file?
Error during compiling: CoogleIOT/src/CoogleIOTWebserver.h:29:29: fatal error: WifiClientPrint.h: No such file or directory
#include "WifiClientPrint.h"
Apparently the src file name is wrong "WiFiClientPrint.h" (capital "F")
Change the filename back to "WifiClientPrint.h" would solve the issue.
You have:
mqtt->subscribe(GARAGE_DOOR_ACTION_TOPIC);
But that constant is not defined anywhere.
Hi,
The library looks great, I'm keen to start using it however I am unable to connect to an MQTT server.
I am trying to connect to;
host: broker.mqtt-dashboard.com
port: 1883
I've tried connecting to a few different servers but they all result in a loop of the following error.
[INFO 2018-02-12 22:52:31] Attempting to Connect to MQTT Server
[ERROR 2018-02-12 22:52:31] Failed to connect to MQTT Server!
[INFO 2018-02-12 22:52:31] Failed too many times to establish a MQTT connection. Restarting Device.
I've tried using the GarageDoorOpener, Coogle Feeder and Coogle Switch in case I was missing something in my code but they all have the same result.
If I use the PubSubClient sketch (https://github.com/knolleary/pubsubclient/blob/master/examples/mqtt_esp8266/mqtt_esp8266.ino) then I can connect to an MQTT server without issue.
Do you have any suggestions as to how I can get a more verbose error message?
Thanks in advance.
1) Function removed from ESP8222 core API
From ESP8266 Arduino core 3.0.0 version onwards the following prototype (previously deprecated) has been removed:
HTTPUpdateResult ESPhttpUpdate::update(const char* host, int& port, const char* uri, const char * currentVersion);
This methotd is used in CoogleIOT::checkForFirmwareUpdate()
at CoogleIOT.cpp line 987 (library version 1.3.1).
Od call:
firmwareUpdateStatus = ESPhttpUpdate.update(URL.m_Host.c_str(), port, URL.m_Path.c_str(), COOGLEIOT_VERSION);
The current prototype is
HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient & client, const String & host, uint16_t port, const String & uri, const String & currentVersion)
The call sholud be replaced with something like (it worked for me):
const String ver_str = COOGLEIOT_VERSION;
const String uri_str = URL.m_Path.c_str();
const String host_str = URL.m_Host.c_str();
firmwareUpdateStatus = ESPhttpUpdate.update(espClient, host_str, port, uri_str, ver_str);
**2) Missing return value in CoogleIOT::verifyFlashConfiguration();**
The memeber function bool CoogleIOT::verifyFlashConfiguration()
lacks a 'return ` statement. Quite puzzingly (for me) the compiler does not complain, but the code crashes on return of this function. The ESP exception decoder does not help too much, by the way, as it locates the fault elsewhere.
Just adding
return true;
at the end of the function (line 367) solves the problem and the initialization proceeds normally.
Hello,
Does it work with the ESP32?
Tks
Currently when CoogleIOT reconnects to the mqtt server it does so with the cleanSession flag set to true. This results in all subscribtions being cleared. As such it would be helpful to either have a callback that gets called after a successful reconnect or having CoogleIOT automatically restore all subscriptions.
if you setup a node with a mistake in the SSID or password,
the node will repeatedly attempt to connect (10 times) - then it will reset and do this again.
however during that process, there is no loop for the dns or web server, so it is impossible to re-configure the node to be able to use the correct credentials (save for wiping it and starting again).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.