mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	fix safe_mode (#1421)
* Deprioritize automations Ensures safe mode is loaded before any automations are ran * Fix lint
This commit is contained in:
		| @@ -209,11 +209,8 @@ def _esp8266_add_lwip_type(): | |||||||
|     cg.add_build_flag('-DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH') |     cg.add_build_flag('-DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH') | ||||||
|  |  | ||||||
|  |  | ||||||
| @coroutine_with_priority(100.0) | @coroutine_with_priority(30.0) | ||||||
| def to_code(config): | def _add_automations(config): | ||||||
|     cg.add_global(cg.global_ns.namespace('esphome').using) |  | ||||||
|     cg.add(cg.App.pre_setup(config[CONF_NAME], cg.RawExpression('__DATE__ ", " __TIME__'))) |  | ||||||
|  |  | ||||||
|     for conf in config.get(CONF_ON_BOOT, []): |     for conf in config.get(CONF_ON_BOOT, []): | ||||||
|         trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], conf.get(CONF_PRIORITY)) |         trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], conf.get(CONF_PRIORITY)) | ||||||
|         yield cg.register_component(trigger, conf) |         yield cg.register_component(trigger, conf) | ||||||
| @@ -229,6 +226,14 @@ def to_code(config): | |||||||
|         yield cg.register_component(trigger, conf) |         yield cg.register_component(trigger, conf) | ||||||
|         yield automation.build_automation(trigger, [], conf) |         yield automation.build_automation(trigger, [], conf) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @coroutine_with_priority(100.0) | ||||||
|  | def to_code(config): | ||||||
|  |     cg.add_global(cg.global_ns.namespace('esphome').using) | ||||||
|  |     cg.add(cg.App.pre_setup(config[CONF_NAME], cg.RawExpression('__DATE__ ", " __TIME__'))) | ||||||
|  |  | ||||||
|  |     CORE.add_job(_add_automations, config) | ||||||
|  |  | ||||||
|     # Set LWIP build constants for ESP8266 |     # Set LWIP build constants for ESP8266 | ||||||
|     if CORE.is_esp8266: |     if CORE.is_esp8266: | ||||||
|         CORE.add_job(_esp8266_add_lwip_type) |         CORE.add_job(_esp8266_add_lwip_type) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user