Open darrenjlobb opened 6 months ago
Hi @darrenjlobb , I don't recognize the test you are getting back from the ESP. Could you post a longer serial log that does include serial print statements from the code, so we can see where in the code it gets stuck in the cycle?
Hi @darrenjlobb , I don't recognize the test you are getting back from the ESP. Could you post a longer serial log that does include serial print statements from the code, so we can see where in the code it gets stuck in the cycle?
Here is the full serial print from reboot.... Thanks for replying so soon!
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0030,len:1344 load:0x40078000,len:13964 load:0x40080400,len:3600 entry 0x400805f0 Setup: Serial opened INFO: Connecting to WiFi SSID EDIT .. mode:DIO, clock div:1 load:0x3fff0030,len:1344 load:0x40078000,len:13964 load:0x40080400,len:3600 entry 0x400805f0 Setup: Serial opened INFO: Connecting to WiFi SSID EDIT .. WiFi connected IP address: 10.0.0.136 Connecting to MySQL ...trying... ...got: 0 retrying... ...trying... ...got: 0 retrying... ...trying... ...got: 0 retrying...
And then just loops over and over... I should add, I am trying to run this on an ESP32, not an 8266, so have changed code to include WiFi.h rather than the 8266 file.
This seems to be a MySQL connection problem more than linked to my Watermeter code. Maybe the following thread will help you: https://forum.arduino.cc/t/mysql-connect-not-connect/951634/6 The recommendation is to check if you are allowed to remotely log into your MySQL server (MySQL user/remote rights or firewall issue) via MySQL logs, trying to log in from another host, or checking TCP traffic with wireshark. Hope this helps!
This seems to be a MySQL connection problem more than linked to my Watermeter code. Maybe the following thread will help you: https://forum.arduino.cc/t/mysql-connect-not-connect/951634/6 The recommendation is to check if you are allowed to remotely log into your MySQL server (MySQL user/remote rights or firewall issue) via MySQL logs, trying to log in from another host, or checking TCP traffic with wireshark. Hope this helps!
Thanks again for the reply, Sadly have already tried these steps.... Hence my confusion / post on here! I can sucessfully login to my MYSQL server no problem from multiple hosts on my network, using the user I have created for this application... So the SQL side of it seems to be working ok, Im guessing its because im using ESP32 and not 8266 as you were and the WiFi.h is somehow different?
I'm not an expert, but the main difference I know between ESP32 and 8266 is the WiFi libraries to use (the ESP8266 includes start with '8266' for WiFi.h and HTTPClient.h). So it could be that the WiFi/IP/TCP connection is not working on your hardware; maybe you can try to ping your database server or connect to another service on that server before connecting to the MySQL service, to make sure there is a connection?
I'm not an expert, but the main difference I know between ESP32 and 8266 is the WiFi libraries to use (the ESP8266 includes start with '8266' for WiFi.h and HTTPClient.h). So it could be that the WiFi/IP/TCP connection is not working on your hardware; maybe you can try to ping your database server or connect to another service on that server before connecting to the MySQL service, to make sure there is a connection?
Just as an update to this, I decided to try the code on an 8266, and other than having to roll a few libarys back to older versions to allow it to compile, it now works great! Have got 8 water meters running this code to central sql server, which am then using node-red and HA to present data to end users.
No idea why it wont work on the ESP32 but assume some kind of libary issue!
Connects to WiFi, have existing working MySQL server, have setup a new database called water, and imported the water table using the provided instruction, however upon programming / reboot, the ESP dosnt seem to connect... Have configued IP / User / Pass and database name...
Just get a cycle:
....trying... ...got: 0 retrying... ...trying... ...got: 0 retrying... ...trying... ...got: 0 retrying... ....trying..