mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	preen
This commit is contained in:
		| @@ -1013,27 +1013,21 @@ async def to_code(config): | |||||||
|             var.get_preset_change_trigger(), [], config[CONF_PRESET_CHANGE] |             var.get_preset_change_trigger(), [], config[CONF_PRESET_CHANGE] | ||||||
|         ) |         ) | ||||||
|  |  | ||||||
|     # Collect all custom preset names (from preset map + custom_presets list) |     # Collect custom preset names from preset map (non-standard) and custom_presets list | ||||||
|     all_custom_preset_names = [ |     custom_preset_names = [ | ||||||
|         preset_config[CONF_NAME] |         preset_config[CONF_NAME] | ||||||
|         for preset_config in config.get(CONF_PRESET, []) |         for preset_config in config.get(CONF_PRESET, []) | ||||||
|         if preset_config[CONF_NAME].upper() not in climate.CLIMATE_PRESETS |         if preset_config[CONF_NAME].upper() not in climate.CLIMATE_PRESETS | ||||||
|     ] |     ] | ||||||
|  |     custom_preset_names.extend(config.get(CONF_CUSTOM_PRESETS, [])) | ||||||
|  |     if custom_preset_names: | ||||||
|  |         cg.add(var.set_custom_presets(custom_preset_names)) | ||||||
|  |  | ||||||
|     # Add additional custom presets from custom_presets list |     # Collect custom fan modes (filter out standard enum fan modes) | ||||||
|     if CONF_CUSTOM_PRESETS in config: |     custom_fan_modes = [ | ||||||
|         all_custom_preset_names.extend(config[CONF_CUSTOM_PRESETS]) |         mode | ||||||
|  |         for mode in config.get(CONF_CUSTOM_FAN_MODES, []) | ||||||
|     # Set all custom presets at once |         if mode.upper() not in climate.CLIMATE_FAN_MODES | ||||||
|     if all_custom_preset_names: |     ] | ||||||
|         cg.add(var.set_custom_presets(all_custom_preset_names)) |     if custom_fan_modes: | ||||||
|  |         cg.add(var.set_custom_fan_modes(custom_fan_modes)) | ||||||
|     # Set custom fan modes (filter out standard enum fan modes) |  | ||||||
|     if CONF_CUSTOM_FAN_MODES in config: |  | ||||||
|         custom_fan_modes = [ |  | ||||||
|             mode |  | ||||||
|             for mode in config[CONF_CUSTOM_FAN_MODES] |  | ||||||
|             if mode.upper() not in climate.CLIMATE_FAN_MODES |  | ||||||
|         ] |  | ||||||
|         if custom_fan_modes: |  | ||||||
|             cg.add(var.set_custom_fan_modes(custom_fan_modes)) |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user