mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	[number] Skip set_mode call when using default AUTO mode (#11537)
This commit is contained in:
		| @@ -252,7 +252,10 @@ async def setup_number_core_( | |||||||
|     cg.add(var.traits.set_max_value(max_value)) |     cg.add(var.traits.set_max_value(max_value)) | ||||||
|     cg.add(var.traits.set_step(step)) |     cg.add(var.traits.set_step(step)) | ||||||
|  |  | ||||||
|     cg.add(var.traits.set_mode(config[CONF_MODE])) |     # Only set if non-default to avoid bloating setup() function | ||||||
|  |     # (mode_ is initialized to NUMBER_MODE_AUTO in the header) | ||||||
|  |     if config[CONF_MODE] != NumberMode.NUMBER_MODE_AUTO: | ||||||
|  |         cg.add(var.traits.set_mode(config[CONF_MODE])) | ||||||
|  |  | ||||||
|     for conf in config.get(CONF_ON_VALUE, []): |     for conf in config.get(CONF_ON_VALUE, []): | ||||||
|         trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var) |         trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user