-->
Page 1 of 1

Access Linux shares from ESP8266?

PostPosted: Fri Dec 24, 2021 4:08 am
by Cool Javelin
Is there any way I can access Linux shares from my ESP8266?

I'd like to light some LEDs based in the status of a file or two.

Thanks, Mark.

Re: Access Linux shares from ESP8266?

PostPosted: Thu Jan 06, 2022 7:16 am
by rpiloverbd
It looks like nobody has done this and uploaded any tutorial on the internet. Theoretically, I think it's possible. You'd better ask this question on any other linux related forum.

Re: Access Linux shares from ESP8266?

PostPosted: Thu Jan 06, 2022 11:39 am
by QuickFix
You could, in theory, create an easy solution by enabling FTP on your Linux box with ReadOnly access rights for a limited user (the ESP) to the files (or folder) in question and let the ESP poll their state every once in a while. Or you could use an HTTP server that only lists the files you want to know the state of.

Shouldn't be too difficult.

Re: Access Linux shares from ESP8266?

PostPosted: Thu Jan 06, 2022 3:43 pm
by AE_Zero
Doing it over HTTP would be pretty easy. Make a PHP script that keeps an eye on the files you're interested in. Then have the ESP8266 pull up that page and fetch a value from it, then react accordingly.

For example, I have a remote sensor that works on variable deep sleep intervals. When the board uploads the current readings, the server stores them and returns it a value for when it wants the board to check in next. Example below.

Hope it helps!

Code: Select all    HTTPClient http;
    http.begin("http://192.168.210.5/collector.php?readings={\"air\":\"" + readingsAir + "\",\"light\":\"" + readingsLight + "\"}");
    int httpCode = http.GET();
    String payload = http.getString();
    http.end();

    naptime = naptime*1000000;
    Serial.println("Napping for " + String(naptime) + "us");
    ESP.deepSleep(naptime, WAKE_NO_RFCAL);