Chat freely about anything...

User avatar
By mattrix
#45497 Hi all,

I have a project where an ESP wakes up at set intervals, connects to WiFi and sends data via MQTT.

There will be multiple nodes that need to be "self setting up"
eg. No set WiFi details in file

Currently is uses DHCP to get an address from the server (a Raspberry Pi).
However, I want to minimize the time it is awake as much as possible to save power.

So, I thought I could do.

1) Use DHCP on first connect to get an IP address
2) Send that IP address and MAC address via MQTT to server
3) Server adds this as a static address to the DHCP server
4) ESP saves it's address to EEPROM - all address will start with 10.0.10.X so could just save the last digits.

5) Now on every boot, ESP gets address from EEPROM and uses that as static address to connect to WiFi

Does this sound OK? Only writes to EEPROM once then rest is reading.
If I do this every 30seconds, will EEPROM be OK to read every 30seconds for a decent amount of time before dying?
Last edited by mattrix on Fri Apr 15, 2016 5:00 am, edited 1 time in total.
User avatar
By mattrix
#45516 Sorted the hostapd problem.

I added a new CLI function to rebuild the WPA PSK keys.
I can now stop WPS clients reconnecting by removing them from the PSK file and then calling

hostapd_cli psk_rebuild

I can then use the existing

hostapd_cli deauthenticate MAC

to remove them immediately.

Both calls don't restart hostapd & keep the WiFi up :)

If I was feeling brave, I would make a PSK remove function that simply removes the MAC from the file and removes it from memory. But seems safest to change as little code as possible.