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

Add get_ap() method to WiFi #3684

Merged
merged 1 commit into from
Aug 7, 2022

Conversation

anatoly-savchenkov
Copy link
Contributor

What does this implement/fix?

Adds get_ap() method to make WiFi AP details available to applications. Can be useful to get auto-generated AP SSID name in case of fallback AP or captive portal.

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

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

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266

Example entry for config.yaml:

# Example config.yaml
esphome:
  name: ${devicename}
  name_add_mac_suffix: true

wifi:
  ap: {} # This spawns an AP with the device name and mac address with no password.

captive_portal:

# Nextion lambda to generate QR code with WiFi settings for captive portal
      lambda: |-
        id(disp).set_component_text_printf("qr_wifi", "WIFI:T:nopass;S:%s;P:;;", wifi::global_wifi_component->get_ap().get_ssid().c_str());

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:

Copy link
Contributor

@GregJArnold GregJArnold left a comment

Choose a reason for hiding this comment

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

Should do the trick.

@jesserockz jesserockz changed the title Add get_ap() method to make WiFi AP details available to applications Add get_ap() method to WiFi Aug 7, 2022
@jesserockz jesserockz merged commit 4791093 into esphome:dev Aug 7, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 9, 2022
@anatoly-savchenkov anatoly-savchenkov deleted the wifi_expose_ap branch August 16, 2022 21:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants