#!/usr/bin/python3 # --- # Script to generate the energy.yaml package file. import jinja2 as j2 # Serial Numbers for Panel Inverters INVERTER_SNS = [ 202147113780, 202147116830, 202147117162, 202147117631, 202147122858, 202147123517, 202147125027, 202147125590, 202147125734, 202147125902, 202147126079, 202147126357, 202147126997, 202147128369, 202147129445, 202147130152, 202147130290, ] def main(): """Generate the YAML File.""" env = j2.Environment( block_start_string='[%', block_end_string='%]', variable_start_string='[[', variable_end_string=']]', comment_start_string='[#', comment_end_string='#]', loader=j2.FileSystemLoader('.'), ) with open('energy.yaml', 'w') as f: tmpl = env.get_template('energy.yaml.j2') f.write(tmpl.render(serial_numbers=INVERTER_SNS)) if __name__ == '__main__': main()