mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Validate that either networks, ap, or improv is set up (#1910)
This commit is contained in:
		| @@ -137,6 +137,18 @@ WIFI_NETWORK_STA = WIFI_NETWORK_BASE.extend( | |||||||
| ) | ) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def validate(config, item_config): | ||||||
|  |     if ( | ||||||
|  |         (CONF_NETWORKS in item_config) | ||||||
|  |         and (item_config[CONF_NETWORKS] == []) | ||||||
|  |         and (CONF_AP not in item_config) | ||||||
|  |     ): | ||||||
|  |         if "esp32_improv" not in config: | ||||||
|  |             raise ValueError( | ||||||
|  |                 "Please specify at least an SSID or an Access Point to create." | ||||||
|  |             ) | ||||||
|  |  | ||||||
|  |  | ||||||
| def _validate(config): | def _validate(config): | ||||||
|     if CONF_PASSWORD in config and CONF_SSID not in config: |     if CONF_PASSWORD in config and CONF_SSID not in config: | ||||||
|         raise cv.Invalid("Cannot have WiFi password without SSID!") |         raise cv.Invalid("Cannot have WiFi password without SSID!") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user