Where ESP Easy stores its config data?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
wax83
New user
Posts: 6
Joined: 25 Aug 2023, 10:13

Where ESP Easy stores its config data?

#1 Post by wax83 » 25 Aug 2023, 10:24

Hi all,
Do you know where ESP saves its config data like wifi credentials
Does it use eeprom, spiffs?

Thanks for your comments

User avatar
Ath
Normal user
Posts: 3520
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Where ESP Easy stores its config data?

#2 Post by Ath » 25 Aug 2023, 10:32

ESPEasy uses a local file system, mostly using SPIFFS, or LittleFS when that is part of the .bin filename (often for file systems > 1 MB). There the configuration is stored in some binary stored .dat files.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Where ESP Easy stores its config data?

#3 Post by TD-er » 25 Aug 2023, 10:43

The 'secrets', like credentials are stored in security.dat
The settings in config.dat

wax83
New user
Posts: 6
Joined: 25 Aug 2023, 10:13

Re: Where ESP Easy stores its config data?

#4 Post by wax83 » 25 Aug 2023, 10:51

So, as you're talking about file names, it means it's SPIFFS

My question wasn't about the files themselves but what kind of storage is used because I'm about to write my own code and I was wondering about the best practice.
So I wanted to know what is the ESP Easy dev team choice 😊😊

Thanks for all

User avatar
Ath
Normal user
Posts: 3520
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Where ESP Easy stores its config data?

#5 Post by Ath » 25 Aug 2023, 11:10

wax83 wrote: 25 Aug 2023, 10:51 So, as you're talking about file names, it means it's SPIFFS
SPIFFS has been deprecated for quite some time for Arduino development, in favor of LittleFS (also included in the Arduino libraries).
wax83 wrote: 25 Aug 2023, 10:51 ...but what kind of storage is used because I'm about to write my own code and I was wondering about the best practice.
So I wanted to know what is the ESP Easy dev team choice 😊😊
As usual: It depends.
If you intend to store only a few configuration items, and don't need to store other types of information, then using direct flash storage or eeprom would be just fine, but if other files, or logging, is going to be needed, then a file system is more than nice-to-have.
Depending on the intended hardware, and user-audience, you can also use an SD-card for storage, that's also quite easy to support in plain Arduino code (and also supported in ESPEasy, but as secondary storage).
An ESP Flash-based file system requires the flash to be partitioned correctly. Information about how to do that is plenty available from google searches (too many solutions to list here ;))
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Where ESP Easy stores its config data?

#6 Post by TD-er » 25 Aug 2023, 11:19

SPIFFS is more light-weight, but as Ton mentioned, is deprecated.

LittleFS is much faster when dealing with "large" file systems (> 1 MB), however it is quite a bit slower when you need to change something in a file.
Depending on where the change is in the file and filesize, it can be several factors slower. Even > 10x slower.

Opening files is also slower on LittleFS, so you may want to keep a file handle to speed up access.
Just make sure this (read)handle is closed when trying to write to the same file.

LittleFS is said to be more robust compared to SPIFFS, but for write-once-read-many situations this doesn't really matter.

TL;DR
If you need small binaries, small file system and dare to risk changing it later when SPIFFS might eventually be removed from the Arduino code base, then I think SPIFFS is still the better choice.

wax83
New user
Posts: 6
Joined: 25 Aug 2023, 10:13

Re: Where ESP Easy stores its config data?

#7 Post by wax83 » 25 Aug 2023, 12:20

I'm working on wemos D1 mini
I just need to connect a siren in order to fire it via jeedom and mqtt

So I'll run a small web server to be able to change wifi settings

My storage needs are wifi setting and one or 2 html pages

User avatar
Ath
Normal user
Posts: 3520
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Where ESP Easy stores its config data?

#8 Post by Ath » 25 Aug 2023, 12:23

Or install ESPEasy on the unit, and let it handle the MQTT messages for you :idea: :D
/Ton (PayPal.me)

wax83
New user
Posts: 6
Joined: 25 Aug 2023, 10:13

Re: Where ESP Easy stores its config data?

#9 Post by wax83 » 25 Aug 2023, 12:28

ESP Easy is already installed 😂😂
But it's like an educative project I'll make with my son. He's learning to code and I'm developer so.... 😁 😁

And as additional, I wanted to manage different alarm types directly into wemos and to be able to fire specific type with mqtt message

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Where ESP Easy stores its config data?

#10 Post by TD-er » 25 Aug 2023, 12:54

That's also possible with ESPEasy :)
You can do string formatting in the rules, which is already close to programming.

wax83
New user
Posts: 6
Joined: 25 Aug 2023, 10:13

Re: Where ESP Easy stores its config data?

#11 Post by wax83 » 25 Aug 2023, 16:04

Do you really think I can do the following (this is only an example) :
Message À => 1sec bip
Message B => 1sec bip 1sec off 1sec bip
Message C => continuous bip for 30sec
And so.....

User avatar
Ath
Normal user
Posts: 3520
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Where ESP Easy stores its config data?

#12 Post by Ath » 25 Aug 2023, 16:38

Sure, just use a Normal build (or any build when using an ESP32) and configure the MQTT Import plugin as a device (name: MQTTImport), using the Mapping feature you can translate a character to a number, and generate an event for that, that can be handled in Rules (must be enabled in Tools/Advanced page):
The matching Values entry for the receiving topic is named 'Siren', and 'Single event with all values:' is unchecked/off
Assuming A -> 1, B ->2, C -> 3 is mapped:
Screenshot - 25-08-2023 , 16_37_01.png
Screenshot - 25-08-2023 , 16_37_01.png (4.62 KiB) Viewed 1296 times
Having this in Rules:

Code: Select all

// Siren on GPIO 4
// 1 = Siren on, 0 = Siren off
On MQTTImport#Siren Do
  if %eventvalue1%=1
    longpulse_ms,4,1,1000 // 1sec on
  endif
  if %eventvalue1%=2
    longpulse_ms,4,1,1000,1000,2 // 1sec on, 1sec off, 2x
  endif
  if %eventvalue1%=3
    longpulse_ms,4,1,30000 // 30sec on
  endif
Endon
NB: I'm using the longpulse_ms command as that uses the scheduler to turn the GPIO pin on/off ;)

You will need an MQTT Controller configured and Enabled, best to use is the (very generic) Home Assistant (openHAB) MQTT controller.
/Ton (PayPal.me)

wax83
New user
Posts: 6
Joined: 25 Aug 2023, 10:13

Re: Where ESP Easy stores its config data?

#13 Post by wax83 » 25 Aug 2023, 19:59

Thank you a lot for all those informations

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests