mirror of
https://github.com/esphome/esphome.git
synced 2025-10-28 21:53:48 +00:00
Merge branch 'integration' into memory_api
This commit is contained in:
@@ -470,7 +470,7 @@ async def wifi_disable_to_code(config, action_id, template_arg, args):
|
|||||||
return cg.new_Pvariable(action_id, template_arg)
|
return cg.new_Pvariable(action_id, template_arg)
|
||||||
|
|
||||||
|
|
||||||
_FLAGS = {"keep_scan_results": False}
|
KEEP_SCAN_RESULTS_KEY = "wifi_keep_scan_results"
|
||||||
|
|
||||||
|
|
||||||
def request_wifi_scan_results():
|
def request_wifi_scan_results():
|
||||||
@@ -480,13 +480,13 @@ def request_wifi_scan_results():
|
|||||||
call this function during their code generation. This prevents the WiFi component from
|
call this function during their code generation. This prevents the WiFi component from
|
||||||
freeing scan result memory after successful connection.
|
freeing scan result memory after successful connection.
|
||||||
"""
|
"""
|
||||||
_FLAGS["keep_scan_results"] = True
|
CORE.data[KEEP_SCAN_RESULTS_KEY] = True
|
||||||
|
|
||||||
|
|
||||||
@coroutine_with_priority(CoroPriority.FINAL)
|
@coroutine_with_priority(CoroPriority.FINAL)
|
||||||
async def final_step():
|
async def final_step():
|
||||||
"""Final code generation step to configure scan result retention."""
|
"""Final code generation step to configure scan result retention."""
|
||||||
if _FLAGS["keep_scan_results"]:
|
if CORE.data.get(KEEP_SCAN_RESULTS_KEY, False):
|
||||||
cg.add(
|
cg.add(
|
||||||
cg.RawExpression("wifi::global_wifi_component->set_keep_scan_results(true)")
|
cg.RawExpression("wifi::global_wifi_component->set_keep_scan_results(true)")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ async def to_code(config):
|
|||||||
await setup_conf(config, CONF_BSSID)
|
await setup_conf(config, CONF_BSSID)
|
||||||
await setup_conf(config, CONF_MAC_ADDRESS)
|
await setup_conf(config, CONF_MAC_ADDRESS)
|
||||||
if CONF_SCAN_RESULTS in config:
|
if CONF_SCAN_RESULTS in config:
|
||||||
wifi.request_wifi_scan_results()
|
|
||||||
await setup_conf(config, CONF_SCAN_RESULTS)
|
await setup_conf(config, CONF_SCAN_RESULTS)
|
||||||
|
wifi.request_wifi_scan_results()
|
||||||
await setup_conf(config, CONF_DNS_ADDRESS)
|
await setup_conf(config, CONF_DNS_ADDRESS)
|
||||||
if conf := config.get(CONF_IP_ADDRESS):
|
if conf := config.get(CONF_IP_ADDRESS):
|
||||||
wifi_info = await text_sensor.new_text_sensor(config[CONF_IP_ADDRESS])
|
wifi_info = await text_sensor.new_text_sensor(config[CONF_IP_ADDRESS])
|
||||||
|
|||||||
Reference in New Issue
Block a user