def write_cpp(config): _LOGGER.info("Generating C++ source...") CORE.add_job(core_config.to_code, config[CONF_ESPHOME], domain='esphome') for domain in PRE_INITIALIZE: if domain == CONF_ESPHOME or domain not in config: continue CORE.add_job(get_component(domain).to_code, config[domain], domain=domain) for domain, component, conf in iter_components(config): if domain in PRE_INITIALIZE or not hasattr(component, 'to_code'): continue CORE.add_job(component.to_code, conf, domain=domain) CORE.flush_tasks() add(RawStatement('')) add(RawStatement('')) all_code = [] for exp in CORE.expressions: if not config[CONF_ESPHOME][CONF_USE_CUSTOM_CODE]: if isinstance(exp, Expression) and not exp.required: continue all_code.append(text_type(statement(exp))) writer.write_platformio_project() code_s = indent('\n'.join(line.rstrip() for line in all_code)) writer.write_cpp(code_s) return 0
def write_cpp(config): _LOGGER.info("Generating C++ source...") for name, component, conf in iter_components(CORE.config): if component.to_code is not None: coro = wrap_to_code(name, component) CORE.add_job(coro, conf) CORE.flush_tasks() writer.write_platformio_project() code_s = indent(CORE.cpp_main_section) writer.write_cpp(code_s) return 0
def write_cpp_file(): writer.write_platformio_project() code_s = indent(CORE.cpp_main_section) writer.write_cpp(code_s) return 0