mirror of
https://gitlab.com/zwirbel/illucat.git
synced 2025-12-14 17:35:22 +01:00
load config from file
This commit is contained in:
7
data/mqttConfig.json
Normal file
7
data/mqttConfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"mqttClientName" : "illucat00",
|
||||
"mqttBrokerHost" : "192.168.1.2",
|
||||
"mqttBrokerPort" : 1883,
|
||||
"mqttInTopicRoot" : "wirelos/led-in/",
|
||||
"mqttOutTopicRoot" : "wirelos/led-out/"
|
||||
}
|
||||
@@ -66,7 +66,9 @@
|
||||
<h2>Network</h2>
|
||||
<div class="Form" data-fileName="/config.json" data-name="configForm" data-from="/config.json" data-endpoint="/config"></div>
|
||||
<h2>NeoPixel</h2>
|
||||
<div class="Form" data-fileName="/pixelConfig.json" data-name="configForm" data-from="/pixelConfig.json" data-endpoint="/config"></div>
|
||||
<div class="Form" data-fileName="/pixelConfig.json" data-name="configForm" data-from="/pixelConfig.json" data-endpoint="/config"></div>
|
||||
<h2>MQTT</h2>
|
||||
<div class="Form" data-fileName="/mqttConfig.json" data-name="configForm" data-from="/mqttConfig.json" data-endpoint="/config"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings container collapsible">
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
WiFiNet *network;
|
||||
Sprocket *sprocket;
|
||||
AsyncWebServer *server;
|
||||
WebServerPlugin *webServerPlugin;
|
||||
WebConfigPlugin *webConfigPlugin;
|
||||
WebApiPlugin *webApiPlugin;
|
||||
@@ -42,6 +41,9 @@ void setup()
|
||||
CONNECT_TIMEOUT);
|
||||
network->connect();
|
||||
|
||||
webServerPlugin->server->serveStatic(PIXEL_CONFIG_FILE, SPIFFS, "pixelConfig.json");
|
||||
webServerPlugin->server->serveStatic(MQTT_CONFIG_FILE, SPIFFS, "mqttConfig.json");
|
||||
|
||||
sprocket->activate();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,15 +23,25 @@
|
||||
#define HOSTNAME "illucat"
|
||||
#define CONNECT_TIMEOUT 10000
|
||||
|
||||
// pixel config
|
||||
// config files
|
||||
#define PIXEL_CONFIG_FILE "/pixelConfig.json"
|
||||
#define MQTT_CONFIG_FILE "/mqttConfig.json"
|
||||
|
||||
// NeoPixel
|
||||
#define LED_STRIP_PIN D2
|
||||
#define LED_STRIP_LENGTH 8
|
||||
#define LED_STRIP_BRIGHTNESS 48
|
||||
#define LED_STRIP_UPDATE_INTERVAL 200
|
||||
#define LED_STRIP_DEFAULT_COLOR 100
|
||||
#define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR
|
||||
#define COLOR_NOT_CONNECTED 255
|
||||
|
||||
// mqtt config
|
||||
#define MQTT_CLIENT_NAME "mqcatt"
|
||||
#define MQTT_CLIENT_NAME "illucat"
|
||||
#define MQTT_HOST "192.168.1.2"
|
||||
#define MQTT_PORT 1883
|
||||
#define MQTT_TOPIC_IN "wirelos/illucat-in/"
|
||||
#define MQTT_TOPIC_OUT "wirelos/illucat-out/"
|
||||
#define MQTT_TOPIC_IN "wirelos/led-in/"
|
||||
#define MQTT_TOPIC_OUT "wirelos/led-out/"
|
||||
|
||||
// OTA config
|
||||
#define OTA_PORT 8266
|
||||
@@ -43,13 +53,5 @@
|
||||
#define WEB_DEFAULT_FILE "index.html"
|
||||
#define WEB_PORT 80
|
||||
|
||||
// NeoPixel
|
||||
#define LED_STRIP_PIN D2
|
||||
#define LED_STRIP_LENGTH 8
|
||||
#define LED_STRIP_BRIGHTNESS 48
|
||||
#define LED_STRIP_UPDATE_INTERVAL 200
|
||||
#define LED_STRIP_DEFAULT_COLOR 100
|
||||
#define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR
|
||||
#define COLOR_NOT_CONNECTED 255
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user