got connection to mqtt broker working again

This commit is contained in:
Andreas Doebeli
2020-09-14 03:01:16 +02:00
parent 7fb97d164a
commit ed191f28e7
10 changed files with 98 additions and 102 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.pioenvs .pioenvs
.piolibdeps .piolibdeps
.pio
.vscode .vscode
data/config.json data/config.json

View File

@@ -1,7 +1,7 @@
{ {
// See http://go.microsoft.com/fwlink/?LinkId=827846 // See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format // for the documentation about the extensions.json format
"recommendations": [ "recommendations": [
"platformio.platformio-ide" "platformio.platformio-ide"
] ]
} }

9
data/config/mqtt.json Normal file
View File

@@ -0,0 +1,9 @@
{
"mqttClientName": "illucat1",
"mqttBrokerHost": "192.168.88.110",
"mqttBrokerPort": 1883,
"mqttRootTopic": "wirelos/illucat",
"mqttUser": "",
"mqttPass": ""
}

View File

@@ -4,6 +4,6 @@
"apSSID": "illucat", "apSSID": "illucat",
"apPassword": "illumination", "apPassword": "illumination",
"connectTimeout": 5000, "connectTimeout": 5000,
"stationSSID": "wirelos", "stationSSID": "thobens-416257",
"stationPassword": "th3r31sn0sp00n" "stationPassword": "467304645DB5"
} }

View File

@@ -1,6 +1,9 @@
{ {
"mqttClientName" : "illucat1", "mqttClientName": "illucat1",
"mqttBrokerHost" : "192.168.1.2", "mqttBrokerHost": "192.168.4.1",
"mqttBrokerPort" : 1883, "mqttBrokerPort": 1883,
"mqttRootTopic" : "wirelos/illucat" "mqttRootTopic": "wirelos/illucat",
"mqttUser": "foo",
"mqttPass": ""
} }

View File

@@ -16,46 +16,23 @@
<span class="heading">Pixels</span> <span class="heading">Pixels</span>
<div class="content"> <div class="content">
<ul> <ul>
<li class="form-row ParamSelect" <li class="form-row ParamSelect" data-label="Hue" data-name="hue" data-topic="pixels/hue" data-default="0"
data-label="Hue"
data-name="hue"
data-topic="pixels/hue"
data-default="0"
data-external="/gradients.json"> data-external="/gradients.json">
</li> </li>
<li class="form-row ParamColor" <li class="form-row ParamColor" data-name="color" data-topic="pixels/color" data-label="Color">
data-name="color"
data-topic="pixels/color"
data-label="Color">
</li> </li>
<li class="form-row ParamColor" <li class="form-row ParamColor" data-name="color" data-topic="pixels/color2" data-label="Color 2">
data-name="color"
data-topic="pixels/color2"
data-label="Color 2">
</li> </li>
<!-- data-entries='[{"text": "Color", "value": "0"}, {"text": "Rainbow", "value": "1"}, {"text": "TheaterChase", "value": "2"}, {"text": "Wipe", "value": "3"}, {"text": "Scanner", "value": "4"}, {"text": "Fade", "value": "5"}]' --> <!-- data-entries='[{"text": "Color", "value": "0"}, {"text": "Rainbow", "value": "1"}, {"text": "TheaterChase", "value": "2"}, {"text": "Wipe", "value": "3"}, {"text": "Scanner", "value": "4"}, {"text": "Fade", "value": "5"}]' -->
<li class="form-row ParamSelect" <li class="form-row ParamSelect" data-label="Pattern" data-name="pattern" data-topic="pixels/pattern"
data-label="Pattern" data-default="0"
data-name="pattern" data-entries='[{"text": "None", "value": "0"}, {"text": "Rainbow", "value": "1"}, {"text": "TheaterChase", "value": "2"}, {"text": "Color Wipe", "value": "3"}, {"text": "Scanner", "value": "4"}, {"text": "Fade", "value": "5"}, {"text": "Fire", "value": "6"}]'>
data-topic="pixels/pattern"
data-default="0"
data-entries='[{"text": "None", "value": "0"}, {"text": "Rainbow", "value": "1"}, {"text": "TheaterChase", "value": "2"}, {"text": "Color Wipe", "value": "3"}, {"text": "Scanner", "value": "4"}, {"text": "Fade", "value": "5"}, {"text": "Fire", "value": "6"}]'
></li>
<li class="form-row ParamSlider"
data-name="brightness"
data-min="0"
data-max="255"
data-value="64"
data-topic="pixels/brightness"
data-label="Brightness">
</li> </li>
<li class="form-row ParamSlider" <li class="form-row ParamSlider" data-name="brightness" data-min="0" data-max="255" data-value="64"
data-name="totalSteps" data-topic="pixels/brightness" data-label="Brightness">
data-min="1" </li>
data-max="255" <li class="form-row ParamSlider" data-name="totalSteps" data-min="1" data-max="255" data-value="16"
data-value="16" data-topic="pixels/totalSteps" data-label="Steps">
data-topic="pixels/totalSteps"
data-label="Steps">
</li> </li>
</ul> </ul>
</div> </div>
@@ -69,27 +46,30 @@
<div class="settings container collapsible"> <div class="settings container collapsible">
<span class="heading">Settings</span> <span class="heading">Settings</span>
<div class="content"> <div class="content">
<h2>Network</h2> <h2>Network</h2>
<div class="Form" data-fileName="/config/wifi.json" data-name="configForm" data-from="/config/wifi.json" data-endpoint="/config"></div> <div class="Form" data-fileName="/config/wifi.json" data-name="configForm" data-from="/config/wifi.json"
<h2>NeoPixel</h2> data-endpoint="/config"></div>
<div class="Form" data-fileName="/pixelConfig.json" data-name="configForm" data-from="/pixelConfig.json" data-endpoint="/config"></div> <h2>NeoPixel</h2>
<!-- <h2>MQTT</h2> <div class="Form" data-fileName="/pixelConfig.json" data-name="configForm" data-from="/pixelConfig.json"
<div class="Form" data-fileName="/mqttConfig.json" data-name="configForm" data-from="/mqttConfig.json" data-endpoint="/config"></div> data-endpoint="/config"></div>
<h2>IRC</h2> <h2>MQTT</h2>
<div class="Form" data-fileName="/config/mqtt.json" data-name="configForm" data-from="/config/mqtt.json"
data-endpoint="/config"></div>
<!-- <h2>IRC</h2>
<div class="Form" data-fileName="/ircConfig.json" data-name="configForm" data-from="/ircConfig.json" data-endpoint="/config"></div> --> <div class="Form" data-fileName="/ircConfig.json" data-name="configForm" data-from="/ircConfig.json" data-endpoint="/config"></div> -->
</div> </div>
</div> </div>
<div class="settings container collapsible"> <div class="settings container collapsible">
<span class="heading">System</span> <span class="heading">System</span>
<div class="content"> <div class="content">
<div><label>Free Heap: </label><span class="js-heap"></span><span>&nbsp;bytes</span><br><br></div> <div><label>Free Heap: </label><span class="js-heap"></span><span>&nbsp;bytes</span><br><br></div>
<form method='POST' action='/update' enctype='multipart/form-data'> <form method='POST' action='/update' enctype='multipart/form-data'>
<input type='file' name='update'><input type='submit' value='Update'> <input type='file' name='update'><input type='submit' value='Update'>
</form> </form>
<br> <br>
<button class="js-restart">Restart</button> <button class="js-restart">Restart</button>
</div>
</div> </div>
</div>
</div> </div>
</body> </body>

View File

@@ -15,8 +15,8 @@
framework = arduino framework = arduino
platform = espressif8266@2.0.4 platform = espressif8266@2.0.4
board = esp12e board = esp12e
upload_speed = 921600 upload_speed = 115200
monitor_baud = 115200 monitor_baud = 74880
lib_deps = lib_deps =
Hash Hash
TaskScheduler TaskScheduler

View File

@@ -7,23 +7,23 @@
#define _TASK_PRIORITY #define _TASK_PRIORITY
// Chip config // Chip config
#define SPROCKET_TYPE "ILLUCAT" #define SPROCKET_TYPE "ILLUCAT"
#define SERIAL_BAUD_RATE 115200 #define SERIAL_BAUD_RATE 74880
#define STARTUP_DELAY 1000 #define STARTUP_DELAY 5000
// Mesh config // Mesh config
#define SPROCKET_MODE 0 #define SPROCKET_MODE 0
#define WIFI_CHANNEL 11 #define WIFI_CHANNEL 11
#define MESH_PORT 5555 #define MESH_PORT 5555
#define AP_SSID "illucat" #define AP_SSID "illucat"
#define AP_PASSWORD "illumination" #define AP_PASSWORD "illumination"
#define MESH_PREFIX "illucat-mesh" #define MESH_PREFIX "illucat-mesh"
#define MESH_PASSWORD "th3r31sn0sp00n" #define MESH_PASSWORD "th3r31sn0sp00n"
#define STATION_SSID "MyAP" #define STATION_SSID "thobens-416257"
#define STATION_PASSWORD "th3r31sn0sp00n" #define STATION_PASSWORD "467304645DB5"
#define HOSTNAME "illucat" #define HOSTNAME "illucat"
#define CONNECT_TIMEOUT 10000 #define CONNECT_TIMEOUT 10000
#define MESH_DEBUG_TYPES ERROR | STARTUP | CONNECTION #define MESH_DEBUG_TYPES ERROR | STARTUP | CONNECTION
//#define MESH_DEBUG_TYPES ERROR | MESH_STATUS | CONNECTION | SYNC | COMMUNICATION | GENERAL | MSG_TYPES | REMOTE //#define MESH_DEBUG_TYPES ERROR | MESH_STATUS | CONNECTION | SYNC | COMMUNICATION | GENERAL | MSG_TYPES | REMOTE
#define PIXEL_CONFIG_FILE "/pixelConfig.json" #define PIXEL_CONFIG_FILE "/pixelConfig.json"
@@ -46,5 +46,6 @@
#define LED_STRIP_DEFAULT_COLOR 100 #define LED_STRIP_DEFAULT_COLOR 100
#define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR #define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR
#define COLOR_NOT_CONNECTED 255 #define COLOR_NOT_CONNECTED 255
#define LED_STRIP_DEFAULT_PATTERN 1
#endif #endif

View File

@@ -1,6 +1,7 @@
#include "mqcatt_config.h" #include "mqcatt_config.h"
#include <WiFiNet.h> #include <WiFiNet.h>
#include <Sprocket.h> #include <Sprocket.h>
#include "../../IlluCat.h"
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebServer.h>
#include <WebServerConfig.h> #include <WebServerConfig.h>
#include <WebServerPlugin.h> #include <WebServerPlugin.h>
@@ -21,7 +22,7 @@ void setup()
{ {
sprocket = new Sprocket({STARTUP_DELAY, SERIAL_BAUD_RATE}); sprocket = new Sprocket({STARTUP_DELAY, SERIAL_BAUD_RATE});
pixelPlugin = new PixelPlugin({LED_STRIP_PIN, LED_STRIP_LENGTH, LED_STRIP_BRIGHTNESS, LED_STRIP_UPDATE_INTERVAL}); pixelPlugin = new PixelPlugin({LED_STRIP_PIN, LED_STRIP_LENGTH, LED_STRIP_BRIGHTNESS, LED_STRIP_UPDATE_INTERVAL});
mqttPlugin = new MqttPlugin({MQTT_CLIENT_NAME, MQTT_HOST, MQTT_PORT, MQTT_ROOT_TOPIC}); mqttPlugin = new MqttPlugin({MQTT_CLIENT_NAME, MQTT_HOST, MQTT_PORT, MQTT_ROOT_TOPIC, MQTT_USER, MQTT_PASS});
webServerPlugin = new WebServerPlugin({WEB_CONTEXT_PATH, WEB_DOC_ROOT, WEB_DEFAULT_FILE, WEB_PORT}); webServerPlugin = new WebServerPlugin({WEB_CONTEXT_PATH, WEB_DOC_ROOT, WEB_DEFAULT_FILE, WEB_PORT});
webConfigPlugin = new WebConfigPlugin(webServerPlugin->server); webConfigPlugin = new WebConfigPlugin(webServerPlugin->server);
webApiPlugin = new WebApiPlugin(webServerPlugin->server); webApiPlugin = new WebApiPlugin(webServerPlugin->server);
@@ -42,7 +43,7 @@ void setup()
network->connect(); network->connect();
webServerPlugin->server->serveStatic(PIXEL_CONFIG_FILE, SPIFFS, "pixelConfig.json"); webServerPlugin->server->serveStatic(PIXEL_CONFIG_FILE, SPIFFS, "pixelConfig.json");
webServerPlugin->server->serveStatic(MQTT_CONFIG_FILE, SPIFFS, "mqttConfig.json"); webServerPlugin->server->serveStatic(MQTT_CONFIG_FILE, SPIFFS, "config/mqtt.json");
sprocket->activate(); sprocket->activate();
sprocket->publish("pixels/pattern", "1"); sprocket->publish("pixels/pattern", "1");

View File

@@ -7,25 +7,25 @@
#define _TASK_PRIORITY #define _TASK_PRIORITY
// Chip config // Chip config
#define SPROCKET_TYPE "ILLUCAT" #define SPROCKET_TYPE "ILLUCAT"
#define SERIAL_BAUD_RATE 115200 #define SERIAL_BAUD_RATE 74880
#define STARTUP_DELAY 1000 #define STARTUP_DELAY 5000
// Network config // Network config
#define WIFI_MODE 0 #define WIFI_MODE 0
#define WIFI_CHANNEL 11 #define WIFI_CHANNEL 11
#define AP_SSID "illucat" #define AP_SSID "illucat"
#define AP_PASSWORD "illumination" #define AP_PASSWORD "illumination"
#define MESH_PREFIX "illucat-mesh" #define MESH_PREFIX "illucat-mesh"
#define MESH_PASSWORD "th3r31sn0sp00n" #define MESH_PASSWORD "th3r31sn0sp00n"
#define STATION_SSID "MyAP" #define STATION_SSID "thobens-416257"
#define STATION_PASSWORD "th3r31sn0sp00n" #define STATION_PASSWORD "467304645DB5"
#define HOSTNAME "illucat" #define HOSTNAME "illucat"
#define CONNECT_TIMEOUT 10000 #define CONNECT_TIMEOUT 10000
// config files // config files
#define PIXEL_CONFIG_FILE "/pixelConfig.json" #define PIXEL_CONFIG_FILE "/pixelConfig.json"
#define MQTT_CONFIG_FILE "/mqttConfig.json" #define MQTT_CONFIG_FILE "/config/mqtt.json"
// NeoPixel // NeoPixel
#define LED_STRIP_PIN D2 #define LED_STRIP_PIN D2
@@ -35,17 +35,19 @@
#define LED_STRIP_DEFAULT_COLOR 100 #define LED_STRIP_DEFAULT_COLOR 100
#define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR #define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR
#define COLOR_NOT_CONNECTED 255 #define COLOR_NOT_CONNECTED 255
#define LED_STRIP_DEFAULT_PATTERN 1
// OTA config // OTA config
#define OTA_PORT 8266 #define OTA_PORT 8266
#define OTA_PASSWORD "" #define OTA_PASSWORD ""
// mqtt config // mqtt config
#define MQTT_CLIENT_NAME "illucat" #define MQTT_CLIENT_NAME "illucat"
#define MQTT_HOST "192.168.1.2" #define MQTT_HOST "192.168.88.110"
#define MQTT_PORT 1883 #define MQTT_PORT 1883
#define MQTT_ROOT_TOPIC "wirelos/illucat" #define MQTT_ROOT_TOPIC "wirelos/illucat"
#define MQTT_USER ""
#define MQTT_PASS ""
// WebServer // WebServer
#define WEB_CONTEXT_PATH "/" #define WEB_CONTEXT_PATH "/"
@@ -53,5 +55,4 @@
#define WEB_DEFAULT_FILE "index.html" #define WEB_DEFAULT_FILE "index.html"
#define WEB_PORT 80 #define WEB_PORT 80
#endif #endif