chickey / RS485-WiFi-EPEver

This project is for connecting to EPEver charge controllers over WiFi for viewing running stats and also allows automatic posting of them to InfluxDB or MQTT.
https://www.tindie.com/products/plop211/epever-rs485-to-wifi-adaptor-v15/
Other
68 stars 22 forks source link

Compiling my own copy? #14

Closed mprowe closed 1 year ago

mprowe commented 2 years ago

I see the pre-compiled files and I see the src/RS485-WiFi-EPEver.ino. How can I compile the .ino in the Arduino IDE? I'd like to make one or two tweaks...

Regards, M

chickey commented 2 years ago

Hi Martin, all the code is there in the ino and associated files, once you've got the dependencies installed you can compile. If you use vscode it ensures that the relevant libraries are installed.

mprowe commented 2 years ago

Hi Colin, "once you've got the dependencies installed you can compile." That is my problem. Do you have a list of those dependencies? Or can I ask which is the library that will resolve this error?

/home/mprowe/Arduino/libraries/ESPUI/src/ESPUI.h:23:10: fatal error: ESPAsyncTCP.h: No such file or directory 23 | #include <ESPAsyncTCP.h> | ^~~~~~~~~~~~~~~ compilation terminated.

I have tried the similar sounding ESPAsync_WiFiManager" & ESPAsync_WiFiManager_Lite both by Khoi Hoang from the Arduino Library Manager with no luck.

And forgive my ignorance, but I do not understand what "If you use vscode it ensures that the relevant libraries are installed." means. Is this the sentence that unlocks the way forward? Regards, M.

mprowe commented 2 years ago

Hi again Colin, Forget above. Can you have a think about this:

In file included from /home/mprowe/Arduino/ESP8266/RS485-WiFi-EPEver/RS485-WiFi-EPEver.ino:49: /home/mprowe/Arduino/ESP8266/RS485-WiFi-EPEver/influxdb.h: In function 'void Influxdb_postData()': influxdb.h:76:13: error: call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url) 76 | http.begin(url); | ~~~~~~~~~~^~~~~ exit status 1 call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)

Is this relavent?

Regards, M.

chickey commented 2 years ago

Hi again Colin, Forget above. Can you have a think about this:

In file included from /home/mprowe/Arduino/ESP8266/RS485-WiFi-EPEver/RS485-WiFi-EPEver.ino:49: /home/mprowe/Arduino/ESP8266/RS485-WiFi-EPEver/influxdb.h: In function 'void Influxdb_postData()': influxdb.h:76:13: error: call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url) 76 | http.begin(url); | ~~~~~~~~~~^~~~~ exit status 1 call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)

Is this relavent?

Regards, M.

Hi, VScode is visual studio code and if you use the platformIO plugin in then the code in the repository will setup all dependancies and it should compile fine. You can look into the platformio.ini which shows the libraries used.

Thanks Col

mprowe commented 2 years ago

Thanks for the prompt advice Colin,

The point I was making in the last over was: That it will not compile in the Arduinio IDE with the latest ESP8266 (v3.0.2) core. I had to go back to version 2.7.4 for it to work.

artlab23 commented 2 years ago

This may be the same ESP8266HTTPClient issue as was tripping me up a year ago (we discussed on the Discord channel).

/*
 * Since both begin() functions take a reference to client as a parameter, you need to 
 * ensure the client object lives the entire time of the HTTPClient
 */
    bool begin(WiFiClient &client, const String& url);
    bool begin(WiFiClient &client, const String& host, uint16_t port, const String& uri = "/", bool https = false);

    // old API is now explicitly forbidden

What I did to get it (the 0.60 code) to compile:

Moved line 85 of influxdb.h:

WiFiClient client;

..up to line 75.

Changed line 76 from:

http.begin(url);

..to:

http.begin(client, url);

This compiles OK* in Arduino IDE for me across 3 different (fairly well updated) Linux machines, uploads and runs fine (webUI + feeding influxdb, I don't use MQTT).

(*Bar the usual whining about SPIFFS being deprecated).

This all only came up today as I borked mine with an OTA update because I fancied having the 'load' switch at the top of the first tab... It had been sitting out there chugging away for a whole year without demanding attention. So thanks again, Col, for all your work on this. Much appreciated. :)

mprowe commented 2 years ago

Thank you @artlab23 Amended as per your instruction and was able to compile using the Arduino esp8266 v3.2 core.

Should I close this issue or do you think I should let Colin vet and close?

Regards, M.