43 lines
2.1 KiB
Python
43 lines
2.1 KiB
Python
#!/usr/bin/python
|
|
|
|
from Cheetah.Template import Template
|
|
|
|
|
|
|
|
|
|
configItems = [
|
|
{"label":"_", "key":"magic", "type":"I", "default": ""},
|
|
{"label":"Config Username", "key":"confUser", "type":"C", "length":16, "default":"admin"},
|
|
{"label":"Config Password", "key":"confPasswd", "type":"C", "length":16, "default":"geheim123"},
|
|
{"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":32, "default":"broker.hottis.de"},
|
|
{"label":"MQTT Username", "key":"mqttUser", "type":"C", "length":32, "default":"RgbLed1"},
|
|
{"label":"MQTT Password", "key":"mqttPass", "type":"C", "length":32, "default":"geheim123"},
|
|
{"label":"MQTT ClientId", "key":"mqttClientId", "type":"C", "length":32, "default":"RgbLed1"},
|
|
{"label":"MQTT Port", "key":"mqttPort", "type":"I", "default":8883},
|
|
{"label":"MQTT Topic Number of LEDs", "key":"mqttTopicNumOfLeds", "type":"C", "length":64, "default":"IoT/RgbLed1/NumOfLeds"},
|
|
{"label":"MQTT Topic Color to all LEDs", "key":"mqttTopicColorAllLed", "type":"C", "length":64, "default":"IoT/RgbLed1/ColorAllLed"},
|
|
{"label":"MQTT Topic Color to one LED", "key":"mqttTopicColorOneLed", "type":"C", "length":64, "default":"IoT/RgbLed1/ColorLed"},
|
|
{"label":"MQTT Topic Status to all LED", "key":"mqttTopicStatusAllLed", "type":"C", "length":64, "default":"IoT/RgbLed1/StatusAllLed"},
|
|
{"label":"MQTT DebugTopic", "key":"mqttDebugTopic", "type":"C", "length":64, "default":"IoT/RgbLed1/Debug"},
|
|
{"label":"DebugMode", "key":"debugMode", "type":"I", "default":0}
|
|
]
|
|
|
|
|
|
magic = 0xC0DE0004
|
|
appName = "ESP8266 based TwoLedSignal"
|
|
confWifiSsid = "espconfig"
|
|
|
|
params = {
|
|
"magic":magic,
|
|
"appName":appName,
|
|
"confWifiSsid":confWifiSsid,
|
|
"configItems":configItems
|
|
}
|
|
|
|
h_file = Template(file="configuration_h.tmpl", searchList=[params])
|
|
open('configuration.h','w').write(str(h_file))
|
|
c_file = Template(file="configuration_c.tmpl", searchList=[params])
|
|
open('configuration.cpp','w').write(str(c_file))
|