diff --git a/esphome/components/wifi/__init__.py b/esphome/components/wifi/__init__.py index a364e9861c..1dca38bb69 100644 --- a/esphome/components/wifi/__init__.py +++ b/esphome/components/wifi/__init__.py @@ -486,10 +486,16 @@ async def wifi_disable_to_code(config, action_id, template_arg, args): return cg.new_Pvariable(action_id, template_arg) -@automation.register_action("wifi.save_ap_settings", WiFiSaveAPSettingsAction, cv.Schema({ - cv.Required(CONF_SSID): cv.templatable(cv.ssid), - cv.Required(CONF_PASSWORD): cv.templatable(validate_password), -})) +@automation.register_action( + "wifi.save_ap_settings", + WiFiSaveAPSettingsAction, + cv.Schema( + { + cv.Required(CONF_SSID): cv.templatable(cv.ssid), + cv.Required(CONF_PASSWORD): cv.templatable(validate_password), + } + ) +) async def wifi_save_settings_to_code(config, action_id, template_arg, args): var = cg.new_Pvariable(action_id, template_arg) ssid = await cg.templatable(config[CONF_SSID], args, cg.std_string) diff --git a/esphome/components/wifi/wifi_component.h b/esphome/components/wifi/wifi_component.h index 7dffcfe9a7..8722e83297 100644 --- a/esphome/components/wifi/wifi_component.h +++ b/esphome/components/wifi/wifi_component.h @@ -447,9 +447,7 @@ template class WiFiSaveAPSettingsAction : public Action { TEMPLATABLE_VALUE(std::string, password) void play(Ts... x) override { - global_wifi_component->save_wifi_sta( - this->ssid_.value(x...), this->password_.value(x...) - ); + global_wifi_component->save_wifi_sta(this->ssid_.value(x...), this->password_.value(x...)); } };