25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
![]() |
#!/usr/bin/python
|
||
|
|
||
|
from Cheetah.Template import Template
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
configItems = [
|
||
|
{"label":"_", "key":"magic", "type":"I", "default": ""},
|
||
|
{"label":"Wifi SSID", "key":"wifiSsid", "type":"C", "length":32, "default":"test"},
|
||
|
{"label":"Wifi Key", "key":"wifiKey", "type":"C", "length":64, "default":"geheim"},
|
||
|
{"label":"MQTT Broker", "key":"mqttBroker", "type":"C", "length":64, "default":"broker.hottis.de"},
|
||
|
{"label":"MQTT Username", "key":"mqttUser", "type":"C", "length":32, "default":"esp1"},
|
||
|
{"label":"MQTT Password", "key":"mqttPass", "type":"C", "length":32, "default":"geheim"},
|
||
|
{"label":"MQTT ClientId", "key":"mqttClientId", "type":"C", "length":32, "default":"changeThis"},
|
||
|
{"label":"MQTT Topic", "key":"mqttTopic", "type":"C", "length":64, "default":"IoT/espThermometer2/measurement"},
|
||
|
{"label":"MQTT Port", "key":"mqttPort", "type":"I", "default":8883}
|
||
|
]
|
||
|
|
||
|
|
||
|
h_file = Template(file="configuration_h.tmpl", searchList=[{"configItems":configItems}])
|
||
|
open('configuration.h','w').write(str(h_file))
|
||
|
c_file = Template(file="configuration_c.tmpl", searchList=[{"configItems":configItems}])
|
||
|
open('configuration.cpp','w').write(str(c_file))
|