Chat freely about anything...

User avatar
By btidey
#87900 Using the MAC address is indeed a useful method particularly if you need specific config data for different devices running the same code and applies even if they are all the same physical device.

I use this but with the multi-mac config file held on a central server that each device fetches and uses to configure itself. Storing it centrally just made it a bit easier to update. For example, I have a large number of sensors all running the same code and they use this one file to configure themselves with their sensor ID, sensor type, update intervals, action parameters etc.
User avatar
By Lea
#87913 Is there an example of uoloading a file from a server? I do not recall seeing one but I may have gotten lost in the shortcut titles.
I would still need a local file for initial access point selection but I can see that a central file for other configuration would be very useful.
Thanks.
User avatar
By btidey
#87926 Use the ESP8266HTTPClient as the easiest way of getting stuff from a web server.

The library has examples of its use e.g. BasicHttpClient

For a complete example see https://github.com/roberttidey/ds18b20-esp8266 where the getConfig routine fetches a simple line oriented config file and matches the MAC address to configure itself.

Note that if you use wifi manager then you can configure the wifi credentials without any specific local files and this also makes it easier to manage if you shift network or change credentials.