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
.piolibdeps
.pio
.vscode
data/config.json

View File

@@ -1,7 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"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",
"apPassword": "illumination",
"connectTimeout": 5000,
"stationSSID": "wirelos",
"stationPassword": "th3r31sn0sp00n"
"stationSSID": "thobens-416257",
"stationPassword": "467304645DB5"
}

View File

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

View File

@@ -16,46 +16,23 @@
<span class="heading">Pixels</span>
<div class="content">
<ul>
<li class="form-row ParamSelect"
data-label="Hue"
data-name="hue"
data-topic="pixels/hue"
data-default="0"
<li class="form-row ParamSelect" data-label="Hue" data-name="hue" data-topic="pixels/hue" data-default="0"
data-external="/gradients.json">
</li>
<li class="form-row ParamColor"
data-name="color"
data-topic="pixels/color"
data-label="Color">
<li class="form-row ParamColor" data-name="color" data-topic="pixels/color" data-label="Color">
</li>
<li class="form-row ParamColor"
data-name="color"
data-topic="pixels/color2"
data-label="Color 2">
<li class="form-row ParamColor" data-name="color" data-topic="pixels/color2" data-label="Color 2">
</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"}]' -->
<li class="form-row ParamSelect"
data-label="Pattern"
data-name="pattern"
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 class="form-row ParamSelect" data-label="Pattern" data-name="pattern" 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="totalSteps"
data-min="1"
data-max="255"
data-value="16"
data-topic="pixels/totalSteps"
data-label="Steps">
<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 class="form-row ParamSlider" data-name="totalSteps" data-min="1" data-max="255" data-value="16"
data-topic="pixels/totalSteps" data-label="Steps">
</li>
</ul>
</div>
@@ -69,27 +46,30 @@
<div class="settings container collapsible">
<span class="heading">Settings</span>
<div class="content">
<h2>Network</h2>
<div class="Form" data-fileName="/config/wifi.json" data-name="configForm" data-from="/config/wifi.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>
<!-- <h2>MQTT</h2>
<div class="Form" data-fileName="/mqttConfig.json" data-name="configForm" data-from="/mqttConfig.json" data-endpoint="/config"></div>
<h2>IRC</h2>
<h2>Network</h2>
<div class="Form" data-fileName="/config/wifi.json" data-name="configForm" data-from="/config/wifi.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>
<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>
</div>
<div class="settings container collapsible">
<span class="heading">System</span>
<div class="content">
<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'>
<input type='file' name='update'><input type='submit' value='Update'>
</form>
<br>
<button class="js-restart">Restart</button>
</div>
<span class="heading">System</span>
<div class="content">
<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'>
<input type='file' name='update'><input type='submit' value='Update'>
</form>
<br>
<button class="js-restart">Restart</button>
</div>
</div>
</div>
</body>

View File

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

View File

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

View File

@@ -1,6 +1,7 @@
#include "mqcatt_config.h"
#include <WiFiNet.h>
#include <Sprocket.h>
#include "../../IlluCat.h"
#include <ESPAsyncWebServer.h>
#include <WebServerConfig.h>
#include <WebServerPlugin.h>
@@ -21,7 +22,7 @@ void setup()
{
sprocket = new Sprocket({STARTUP_DELAY, SERIAL_BAUD_RATE});
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});
webConfigPlugin = new WebConfigPlugin(webServerPlugin->server);
webApiPlugin = new WebApiPlugin(webServerPlugin->server);
@@ -42,7 +43,7 @@ void setup()
network->connect();
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->publish("pixels/pattern", "1");

View File

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