Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve dualstack and IPv6 support #5449

Merged
merged 57 commits into from Feb 27, 2024
Merged

Conversation

HeMan
Copy link
Contributor

@HeMan HeMan commented Sep 28, 2023

What does this implement/fix?

Makes ESPHome work better with IPv6 by adding a datatype for multiple IP addresses. This adds support for reporting all addresses it got, via wifi_info/ethernet_info text-sensors, via MQTT and as part of debug message.
It makes MQTT resolve both IPv6 and IPv4 addresses, and connects over IPv6 (as well as over IPv4 as before).
Breaks external components that assumes ESPHome only has one IP address.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes
esphome/issues#5126

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3234

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP32 Ethernet
  • ESP8266
  • RP2040

Example entry for config.yaml:

esphome:
  name: ipv6mqtt

network:
  enable_ipv6: true

esp32:
  board: esp32dev
  framework:
    type: esp-idf

wifi:
  ssid: !secret wifissd
  password: !secret wifipwd

sensor:
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 60s

text_sensor:
  - platform: wifi_info
    ip_address:
      name: ESP IP Address
      address_0:
        name: ESP IP Address 0
      address_1:
        name: ESP IP Address 1
      address_2:
        name: ESP IP Address 2
      address_3:
        name: ESP IP Adress 3

debug:

logger:
  level: VERY_VERBOSE

web_server:
  port: 80

api:

ota:

mqtt:
  broker: mqtt6.example.com
  discovery: true

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@HeMan HeMan marked this pull request as ready for review October 10, 2023 20:02
@HeMan HeMan marked this pull request as ready for review December 21, 2023 15:58
@esphome esphome bot requested a review from jesserockz December 21, 2023 15:58
@codecov-commenter
Copy link

codecov-commenter commented Jan 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.81%. Comparing base (4d8b5ed) to head (2c1b98e).
Report is 28 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #5449      +/-   ##
==========================================
+ Coverage   53.70%   53.81%   +0.10%     
==========================================
  Files          50       50              
  Lines        9408     9438      +30     
  Branches     1654     1660       +6     
==========================================
+ Hits         5053     5079      +26     
+ Misses       4056     4052       -4     
- Partials      299      307       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@probot-esphome
Copy link

Hey there @OttoWinter, mind taking a look at this pull request as it has been labeled with an integration (async_tcp) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@HeMan
Copy link
Contributor Author

HeMan commented Jan 22, 2024

Libretiny depends on esphome/AsyncTCP#9

Copy link
Member

@jesserockz jesserockz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This almost looks good, just a couple of missing things 😉

esphome/components/wifi_info/wifi_info_text_sensor.h Outdated Show resolved Hide resolved
esphome/components/wifi_info/wifi_info_text_sensor.h Outdated Show resolved Hide resolved
@esphome esphome bot marked this pull request as draft February 27, 2024 03:15
@HeMan HeMan marked this pull request as ready for review February 27, 2024 07:23
@esphome esphome bot requested a review from jesserockz February 27, 2024 07:23
@HeMan
Copy link
Contributor Author

HeMan commented Feb 27, 2024

This almost looks good, just a couple of missing things 😉

Fixed! Found an unused variable as well.

@jesserockz jesserockz merged commit f73518d into esphome:dev Feb 27, 2024
93 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants