New config to template (jinja) c2r.py

This commit is contained in:
Dirk Alders 2024-03-16 08:35:38 +01:00
parent 234766d874
commit fc2d8ed4a2

View File

@ -17,10 +17,10 @@ except (PermissionError, FileNotFoundError) as e:
print("Unable to open", '"' + src_file + '"')
sys.exit(18)
n = re.sub('^.*server: .*', ' server: mqtt://<mqtt_smarthome_hostname>', s, flags=re.MULTILINE)
n = re.sub('^.*user: .*', ' user: <mqtt_smarthome_username>', n, flags=re.MULTILINE)
n = re.sub('^.*password: .*', ' password: <mqtt_smarthome_password>', n, flags=re.MULTILINE)
n = re.sub('^.*auth_token: .*', ' auth_token: <zigbee_auth_token>', n, flags=re.MULTILINE)
n = re.sub('^.*server: .*', ' server: mqtt://{{ smart_sat_zigbee2mqtt_hostname }}', s, flags=re.MULTILINE)
n = re.sub('^.*user: .*', ' user: {{ smart_sat_zigbee2mqtt_username }}', n, flags=re.MULTILINE)
n = re.sub('^.*password: .*', ' password: {{ smart_sat_zigbee2mqtt_password }}', n, flags=re.MULTILINE)
n = re.sub('^.*auth_token: .*', ' auth_token: {{ smart_sat_zigbee2mqtt_auth_token }}', n, flags=re.MULTILINE)
try:
with open(dst_file, 'w') as fh: