mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Generate variable for each custom component id (#382)
* Generate variable for each custom component id * Change variable to Pvariable for custom components
This commit is contained in:
		
				
					committed by
					
						 Otto Winter
						Otto Winter
					
				
			
			
				
	
			
			
			
						parent
						
							5fcda34c45
						
					
				
				
					commit
					e3f7e0d14a
				
			| @@ -2,7 +2,7 @@ import voluptuous as vol | ||||
|  | ||||
| import esphomeyaml.config_validation as cv | ||||
| from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_COMPONENTS | ||||
| from esphomeyaml.cpp_generator import process_lambda, variable | ||||
| from esphomeyaml.cpp_generator import process_lambda, variable, Pvariable | ||||
| from esphomeyaml.cpp_helpers import setup_component | ||||
| from esphomeyaml.cpp_types import Component, ComponentPtr, esphomelib_ns, std_vector | ||||
|  | ||||
| @@ -25,8 +25,9 @@ def to_code(config): | ||||
|  | ||||
|     rhs = CustomComponentConstructor(template_) | ||||
|     custom = variable(config[CONF_ID], rhs) | ||||
|     for i, comp in enumerate(config.get(CONF_COMPONENTS, [])): | ||||
|         setup_component(custom.get_component(i), comp) | ||||
|     for i, comp_config in enumerate(config.get(CONF_COMPONENTS, [])): | ||||
|         comp = Pvariable(comp_config[CONF_ID], custom.get_component(i)) | ||||
|         setup_component(comp, comp_config) | ||||
|  | ||||
|  | ||||
| BUILD_FLAGS = '-DUSE_CUSTOM_COMPONENT' | ||||
|   | ||||
		Reference in New Issue
	
	Block a user