esphome / esphome/feature-requests

Add support for ESP-IDF's CONFIG_LWIP_DHCP_RESTORE_LAST_IP

Open
#2,557 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Describe the problem you have/What new integration you would like

Currently when using DHCP and deep-sleep, a full DHCP IP negotiation is required at every wakeup, which requires time and power. The current best-practice recommendation is to use static IPs to avoid this, but it makes managing all the devices a pain.

In theory this is not required, as the DHCP lease has a timeout that is typically 1h or more, and the DHCP lease could be saved in RTC memory and restored on wakeup. This would mean the DHCP lease would only have to be re-negotiated when the lease expires, avoiding lots of DHCP wifi activity on every wakeup. This is similar to how fast_connect: true saves the last connected access point and avoids doing a full scan every wakeup.

Many deep-sleep applications will sleep and wakeup every 1m, so saving and re-using a 1h DHCP lease will save about 59 dhcp IP negotiations every hour.

It turns out ESP-IDF already has support for this with a CONFIG_LWIP_DHCP_RESTORE_LAST_IP option. See the following docs for details;

https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-reference/kconfig.html#config-lwip-dhcp-restore-last-ip

Please describe your use case for this integration and alternatives you've tried:

Static IP's is an alternative, but it's annoying to manage.

Additional context

It's possible there already exists a way to enable this ESP-IDF config option for ESPHome, but I've not been able to find any documentation explaining how. Perhaps all that is needed here is docs explaining how to do it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files or tests are named. Start by checking ESP-IDF's CONFIG_LWIP_DHCP_RESTORE_LAST_IP documentation and how ESPHome exposes ESP-IDF configuration; done means either documenting the supported configuration path or confirming lease restoration across deep-sleep wakeups.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.