mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	[ota] http_request update platform (#5586)
Co-authored-by: Keith Burzinski <kbx81x@gmail.com> Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Co-authored-by: Edward Firmo <94725493+edwardtfn@users.noreply.github.com>
This commit is contained in:
		| @@ -28,10 +28,6 @@ esphome: | ||||
|           body: "Some data" | ||||
|           verify_ssl: false | ||||
| 
 | ||||
| wifi: | ||||
|   ssid: MySSID | ||||
|   password: password1 | ||||
| 
 | ||||
| http_request: | ||||
|   useragent: esphome/tagreader | ||||
|   timeout: 10s | ||||
							
								
								
									
										36
									
								
								tests/components/http_request/common_ota.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								tests/components/http_request/common_ota.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| wifi: | ||||
|   ssid: MySSID | ||||
|   password: password1 | ||||
|  | ||||
| ota: | ||||
|   - platform: http_request | ||||
|     verify_ssl: ${verify_ssl} | ||||
|     on_begin: | ||||
|       then: | ||||
|         - logger.log: "OTA start" | ||||
|     on_progress: | ||||
|       then: | ||||
|         - logger.log: | ||||
|             format: "OTA progress %0.1f%%" | ||||
|             args: ["x"] | ||||
|     on_end: | ||||
|       then: | ||||
|         - logger.log: "OTA end" | ||||
|     on_error: | ||||
|       then: | ||||
|         - logger.log: | ||||
|             format: "OTA update error %d" | ||||
|             args: ["x"] | ||||
|     on_state_change: | ||||
|       then: | ||||
|         lambda: 'ESP_LOGD("ota", "State %d", state);' | ||||
|  | ||||
| button: | ||||
|   - platform: template | ||||
|     name: Firmware update | ||||
|     on_press: | ||||
|       then: | ||||
|         - ota_http_request.flash: | ||||
|             md5_url: http://my.ha.net:8123/local/esphome/firmware.md5 | ||||
|             url: http://my.ha.net:8123/local/esphome/firmware.bin | ||||
|         - logger.log: "This message should be not displayed (reboot)" | ||||
							
								
								
									
										38
									
								
								tests/components/http_request/test-nossl.esp8266.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								tests/components/http_request/test-nossl.esp8266.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| <<: !include common_http_request.yaml | ||||
|  | ||||
| wifi: | ||||
|   ssid: MySSID | ||||
|   password: password1 | ||||
|  | ||||
| ota: | ||||
|   - platform: http_request | ||||
|     esp8266_disable_ssl_support: true | ||||
|     on_begin: | ||||
|       then: | ||||
|         - logger.log: "OTA start" | ||||
|     on_progress: | ||||
|       then: | ||||
|         - logger.log: | ||||
|             format: "OTA progress %0.1f%%" | ||||
|             args: ["x"] | ||||
|     on_end: | ||||
|       then: | ||||
|         - logger.log: "OTA end" | ||||
|     on_error: | ||||
|       then: | ||||
|         - logger.log: | ||||
|             format: "OTA update error %d" | ||||
|             args: ["x"] | ||||
|     on_state_change: | ||||
|       then: | ||||
|         lambda: 'ESP_LOGD("ota", "State %d", state);' | ||||
|  | ||||
| button: | ||||
|   - platform: template | ||||
|     name: Firmware update | ||||
|     on_press: | ||||
|       then: | ||||
|         - ota_http_request.flash: | ||||
|             md5_url: http://my.ha.net:8123/local/esphome/firmware.md5 | ||||
|             url: http://my.ha.net:8123/local/esphome/firmware.bin | ||||
|         - logger.log: "This message should be not displayed (reboot)" | ||||
							
								
								
									
										4
									
								
								tests/components/http_request/test.esp32-c3-idf.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tests/components/http_request/test.esp32-c3-idf.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| substitutions: | ||||
|   verify_ssl: "true" | ||||
|  | ||||
| <<: !include common_ota.yaml | ||||
| @@ -1,2 +1,5 @@ | ||||
| packages: | ||||
|   common: !include common.yaml | ||||
| substitutions: | ||||
|   verify_ssl: "false" | ||||
|  | ||||
| <<: !include common_http_request.yaml | ||||
| <<: !include common_ota.yaml | ||||
|   | ||||
							
								
								
									
										4
									
								
								tests/components/http_request/test.esp32-idf.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tests/components/http_request/test.esp32-idf.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| substitutions: | ||||
|   verify_ssl: "true" | ||||
|  | ||||
| <<: !include common_ota.yaml | ||||
| @@ -1,2 +1,5 @@ | ||||
| packages: | ||||
|   common: !include common.yaml | ||||
| substitutions: | ||||
|   verify_ssl: "false" | ||||
|  | ||||
| <<: !include common_http_request.yaml | ||||
| <<: !include common_ota.yaml | ||||
|   | ||||
| @@ -1,2 +1,5 @@ | ||||
| packages: | ||||
|   common: !include common.yaml | ||||
| substitutions: | ||||
|   verify_ssl: "false" | ||||
|  | ||||
| <<: !include common_http_request.yaml | ||||
| <<: !include common_ota.yaml | ||||
|   | ||||
							
								
								
									
										4
									
								
								tests/components/http_request/test.rp2040.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tests/components/http_request/test.rp2040.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| substitutions: | ||||
|   verify_ssl: "false" | ||||
|  | ||||
| <<: !include common_ota.yaml | ||||
		Reference in New Issue
	
	Block a user