From 21de6afdc30ae8d520b155b5f8d32af4043b9d41 Mon Sep 17 00:00:00 2001 From: GumbaMyn82 Date: Wed, 22 Apr 2020 21:58:16 +0200 Subject: [PATCH] Added versioning --- data/index.html | 163 +++++++++++++++++++++++++----------------------- src/main.cpp | 8 ++- 2 files changed, 93 insertions(+), 78 deletions(-) diff --git a/data/index.html b/data/index.html index fe0bb1d..7090799 100644 --- a/data/index.html +++ b/data/index.html @@ -8,86 +8,95 @@ -
+
-

WIFI and MQTT configuration

-
-
-
-

General settings:

-
- -
- - # of the analog input the sensor is connected to -
-
-
- -
- - # of the digital output for the sensor trigger -
-
- -

WIFI Data:

-
- -
- - SSID of the wireless network to connect to -
-
-
- -
- - Key for the wireless network -
-
-

MQTT Data

-
- -
- - IP or hostname of the MQTT broker. Port is currently hard coded (1893) -
-
-
- -
- - Username for the MQTT broker -
-
-
- -
- - Password for the MQTT broker -
-
-
- -
- - - Topic for the sensor. the sensor reports data with this_topic/state
-
    -
  • Sleep duration of the ESP can be set with this_topic/SleepTime (must be between 1[s]...3600[s])
  • -
  • - Operation mode can be set with this_topic/Mode
    +
    +

    DeepSleepSensor

    +

    Version: %VERSION% +


    +
    +
    + +
    +

    General settings:

    +
    + +
    + + # of the analog input the sensor is connected to +
    +
    +
    + +
    + + # of the digital output for the sensor trigger +
    +
    +
    +
    +

    WIFI Data:

    +
    + +
    + + SSID of the wireless network to connect to +
    +
    +
    + +
    + + Key for the wireless network +
    +
    +
    +
    +

    MQTT Data

    +
    + +
    + + IP or hostname of the MQTT broker. Port is currently hard coded (1893) +
    +
    +
    + +
    + + Username for the MQTT broker +
    +
    +
    + +
    + + Password for the MQTT broker +
    +
    +
    + +
    + + + Topic for the sensor. the sensor reports data with this_topic/state
      -
    • CONFIG: ESP reboots and starts webserver
    • -
    • AP: ESP reboots, starts access point (192.168.4.1) and starts webserver
    • +
    • Sleep duration of the ESP can be set with this_topic/SleepTime (must be between 1[s]...3600[s])
    • +
    • + Operation mode can be set with this_topic/Mode
      +
        +
      • CONFIG: ESP reboots and starts webserver
      • +
      • AP: ESP reboots, starts access point (192.168.4.1) and starts webserver
      • +
      +
    -
  • -
- -
-
- -
+ +
+
+
+ + + diff --git a/src/main.cpp b/src/main.cpp index d6cf2bb..c3eb05d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,6 +7,8 @@ #include "ESPAsyncWebServer.h" #include +const char* version = "1.0"; + //################# DEFINES ################ /** * conversion factor from microseconds in seconds @@ -801,7 +803,7 @@ void Reboot() * @param var The response with templates from the webserver. See AsyncWebserver documentation */ String Processor(const String& var){ - Serial.println(var); + if(var == "SSID"){ return WiFi_SSID; @@ -834,6 +836,10 @@ String Processor(const String& var){ if(var == "TRIGGER_OUTPUT"){ return String(TriggerOutput); } + + if(var == "VERSION"){ + return version; + } return String(); }