Closed Vweston closed 3 years ago
Could you provide me a log from ESP starting from rebooting until this moment
Thanks
From: Vweston @.> Sent: Friday, March 26, 2021 10:59 PM To: Yurik72/ESPHap @.> Cc: Subscribed @.***> Subject: [Yurik72/ESPHap] /setup doesn’t appear to fully work (#85)
I compiled the AdvancedLED example. When I go to /setup from my web browser I get the following response:
{"setup_uri":"X-HM://005277SG7YK72","pin":"111-11-111"}
Instead of a qrcode.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Yurik72/ESPHap/issues/85 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKDREXJHI5UULCECZPPYKO3TFTYS5ANCNFSM4Z4CVJTQ . https://github.com/notifications/beacon/AKDREXJX7YWMDWF6UEGTJWDTFTYS5A5CNFSM4Z4CVJT2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4MRULFYA.gif
Here is a log from re-booting the 8266 device.
#$
⸮c⸮⸮ls⸮`⸮⸮o⸮*WM: [1]
I did try compiling it for a nodeMCU-32s, but was unable to get it compiled with the following error
`
In file included from /var/folders/_3/vxnqz7t138z2bkfd27wb91gh0000gq/T/arduino_modified_sketch_200835/EspHapAdvancedLed.ino:17:0: /Users/vweston/Documents/Arduino/libraries/ESPHap/hapweb/hap_webserver.hpp: In function 'void saveFileBrowse()': /Users/vweston/Documents/Arduino/libraries/ESPHap/hapweb/hap_webserver.hpp:433:59: error: cannot convert 'const char' to 'const __FlashStringHelper' for argument '1' to 'void saveFile(const FlashStringHelper*, const FlashStringHelper)' saveFile(FPSTR(FILE_BROWSE_FILE), FPSTR(FILE_BROWSE_HTML)); ^ /Users/vweston/Documents/Arduino/libraries/ESPHap/hapweb/hap_webserver.hpp: In function 'void saveSetup()': /Users/vweston/Documents/Arduino/libraries/ESPHap/hapweb/hap_webserver.hpp:446:47: error: cannot convert 'const char' to 'const FlashStringHelper*' for argument '1' to 'void saveFile(const FlashStringHelper, const __FlashStringHelper)' saveFile(FPSTR(FILE_SETUP), FPSTR(SETUP_HTML)); ^ /Users/vweston/Documents/Arduino/libraries/ESPHap/hapweb/hap_webserver.hpp: In function 'void saveIndex()': /Users/vweston/Documents/Arduino/libraries/ESPHap/hapweb/hap_webserver.hpp:450:57: error: cannot convert 'const char' to 'const __FlashStringHelper' for argument '1' to 'void saveFile(const FlashStringHelper*, const FlashStringHelper)' saveFile(FPSTR(FILE_INDEX), FPSTR(INDEX_HTML_INTERNAL)); ^ /var/folders/_3/vxnqz7t138z2bkfd27wb91gh0000gq/T/arduino_modified_sketch_200835/EspHapAdvancedLed.ino: In function 'void setup()': EspHapAdvancedLed:86:35: error: cannot convert 'const char' to 'const FlashStringHelper' for argument '1' to 'void set_indexhml(const __FlashStringHelper)' set_indexhml(FPSTR(INDEX_HTML)); ^ Multiple libraries were found for "WiFi.h" Used: /Users/vweston/Documents/Arduino/hardware/espressif/esp32/libraries/WiFi Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi exit status 1 cannot convert 'const char' to 'const __FlashStringHelper' for argument '1' to 'void set_indexhml(const FlashStringHelper*)' `
hope this helps.
-vw
On ESP32 i do not have compilation problem. So, please check
As well please read suggestions on isssue #51 . I would say there is not a problem with that. SPIFFS system are used for this purpose, therefore right partition should be selected. SPIFFS should be formatted. It coud happens with same device with previous firmware before.
So,
Any news ?
I gave up compiling for ESP32 after installing the Arduino IDE 1.8.13 on a clean install of MacOS Catalina. I used the Board Manager to install ESP8266 (v 2.7.4) & ESP32 (v 1.0.5 & even v 1.0.6). I installed just the necessary libraries (WifiManager v 0.16.0) (EspHap v 1.1.0) No matter what specific ESP32 board I select I get a compiler terminate trying to load ESP8266Wifi libraries. I think the ESP32 problem is an Arduino IDE issue where it isn’t recognizing the compiler directives. I’ll deal with the ESP32 later, for Now I’’m working on ESP8266 D1 Mini boards.
As for the ESP8266, that compiles correctly, but setup is still not displaying anything but what I shared earlier. I also flashed it to a D1 Mini with a Erase Flash option. Still no luck. The setup.html file is created, but is zero bytes according to /browse option. Otherwise it appears to work great.
-- VW
On Mar 29, 2021, at 1:00 AM, Yurik72 @.***> wrote:
Any news ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
after playing around with this, I was able to get a reliable result. Since setup.html was always a zero byte file I started there. I revised saveFile() in hap_webserver.hpp. here is the code I revised in hap_webserver.hpp
`//void saveFile(const FlashStringHelper* name, const FlashStringHelper* content) { // String data = FPSTR(content); // String filename = name; // if (!filename.startsWith("/")) filename = "/" + filename; // //INFO("Save file %s", filename.c_str()); // //INFO("Save file content %s", data.substring(1,90).c_str()); // File fb = SPIFFS.open(filename, "w+"); // if (fb) // fb.print(data); // else // ERROR("Save file failed %s", filename.c_str()); // if (fb) // fb.close(); //}
void saveFile(const FlashStringHelper* name, const FlashStringHelper* content) { //String data = FPSTR(content); String filename = name; if (!filename.startsWith("/")) filename = "/" + filename; //INFO("Save file %s", filename.c_str()); //INFO("Save file content %s", data.substring(1,90).c_str()); File fb = SPIFFS.open(filename, "w+"); if (!fb) ERROR("Save file failed %s",filename.c_str()); else { fb.print(content); //Serial.println(fb.size()); //read the file size here fb.close(); //INFO("%s File Saved", filename.c_str()); } }`
what I found was that data was always empty with the saveSetup() call therefore making setup.html always empty. by eliminating //String data = FPSTR(content);
and just printing content directly it appears to always work. I think because __FlashStringHelper*
has already occurred. Not sure on that.
here is my saveSetup()
void saveSetup() { saveFile(FPSTR(FILE_SETUP), FPSTR(SETUP_HTML)); };
It seams to work perfectly for index.html, setup.htm and file browse.html at least for ESP8266 boards. It should be ok for ESP32 but not tested.
/setup.html displays correctly with the appropriate qrcode & scans & adds the accessory properly now.
as for /setup
it appears to be doing what is says.
{"setup_uri":"X-HM://00527Y91QYK72","pin":"111-11-111"}
just like it was told to do.
server.on(PSTR("/setup"),[]() {server.send(200, FPSTR(TEXT_PLAIN), get_setup_json());}); \
it returns correctly. I just don't know how to get /setup to return /setup.html so that the pairing qrcode displays.
Hope this helps
Ok, I found an error, this is happens due to low memory on ESP.
File setup is 26k. If free heap is less is not written... :) This is my mistake. currently I have implemented proper way to save file
However is not finish with final logic. When file should be overwritted. Always , If not exists.....
You can check and help me with pull request
Please get latest commit
I've updated my EspHap library with your recent changes and am currently using them in my tests. So far its working great. I'll keep testing but haven't seen any issues so far. Great work!! I'll let you know if I find any issues.
I compiled the AdvancedLED example. When I go to /setup from my web browser I get the following response:
{"setup_uri":"X-HM://005277SG7YK72","pin":"111-11-111"}
Instead of a qrcode.