diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..49c43a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.pio/ +.vscode/ +src/secrets.h diff --git a/README.md b/README.md index 175426b..b6465a6 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,97 @@ # ESP32-PowerGuard - Digitalization in Energy Engineering -This repository contains the source code for our university group project focused on digitalizing energy engineering in the industrial sector. Our project aims to ensure save power distribution for retrofit mobile robots with capable mini PCs. This led to a little project using ESP32 and some relay boards. +This repository contains the source code for our university group project focused on digitalizing energy engineering in the industrial sector. Our project aims to ensure safe power distribution for retrofit mobile robots with capable mini PCs. However, we wanted to come up with a solution that can be applied to any power circuit. This led to a little project using ESP32 and some relay boards. ### Key Features: - ESP32-based power monitoring for voltage and consumption. - Integration of 2 relay boards to prevent unforeseen voltage conditions. - Data logging to InfluxDB for comprehensive analysis. - Grafana dashboard for visualizing power conditions. - Embedded webserver on ESP32 for real-time voltage and power readings and relay control. +- ESP32-based power monitoring for voltage and consumption. +- Integration of 2 relay boards to prevent unforeseen voltage conditions. +- Data logging to InfluxDB for comprehensive analysis. +- Grafana dashboard for visualizing power conditions. +- Embedded webserver on ESP32 for real-time voltage and power readings and relay control. -### How to Use: -Hardware needed: +### Quick start +1. Spin up InfluxDb and Grafana via Docker Compose: + + ```shell + docker compose up -d + ``` + +2. Open this folder with Visual Studio Code and install the PlatformIO plugin. +3. Rename `secrets.h.example` to `secrets.h` and fill in your credentials. +4. Flash ESP32 with the code. Connect the INA219 module according to the schematics and power up the ESP32. +5. The ESP32 will connect to your WiFi and start sending data to the InfluxDB. InfluxDB webgui is available at [http://localhost:8087](http://localhost:8087). You can now start the Grafana dashboard and connect it to the InfluxDB. The Grafana dashboard is available at [http://localhost:3002](http://localhost:3002). +6. Control the ESP32 via the webserver at `http://:80`. + You can obtain the ESP32 IP address from the serial console. + +## Tutorial: +### Contents of this repository +- `platformio.ini`: Contains the configuration for the PlatformIO plugin. +- `docker-compose.yml`: Contains the configuration for the Docker Compose setup. +- `src`: Contains the source code for the ESP32. +- `doc`: Here you will find the schematics and the project documentation. + +### Hardware needed: - ESP32 Devkit C (or derivative) - Relay Module board with 2x Relays - INA219 Power Monitoring Module - Computer/Server for hosting the Database and Grafana. +The code was written using the PlatformIO plugin for Visual Studio Code. You are advised to use the same setup. -The code was written using the PlatformIO plugin for Visual Studio Code. Your are advised to use the same setup. +Clone this repository: +```shell +git clone https://github.com/bjoernellens1/ESP32-PowerGuard.git +``` + +### Setup your services +Install the latest version of Docker and Docker Compose: + [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/) +Start the services via: +```shell +docker compose up -d +``` + +Now you can access Grafana and InfluxDB via the webgui. + +The Grafana dashboard is available at [http://localhost:3002](http://localhost:3002). + +InfluxDB webgui is available at [http://localhost:8087](http://localhost:8087). + +Having the services running, it is time to start the setup wizard in InfluxDB. Login with username 'influxUser' and password 'influxUserPW' . +On the welcome page you will see the Ardino setup tutorial. Click on the 'Arduino' button and follow the instructions. Here you will obtain parameters needed in the next step. + +### Setup ESP32 +#### Hardware Setup +Connect the INA219 module according to the schematics. +Connect the relay module to the ESP32. The relay module should be connected to the pins 26 and 27 of the ESP32. The relay module should be powered by an external power supply. The relay module should be connected to the power circuit you want to monitor and control. The INA219 module should be connected to the power circuit you want to monitor. The INA219 module should be powered by the ESP32. +![Schematics - Wiring](resources/wiring.png) -### License: -MIT License +#### Software Setup +Connect the ESP to your PC via USB cable. Install Visual Studio Code and the PlatformIO extension from the extension store. +Open this folder in Visual Studio Code. The PlatformIO welcome page will open automatically and needed packages should be installed. + +Then you need to change some files to include your configuration: + +Rename `secrets.h.example` to `secrets.h` and fill in your credentials. INFLUXDB_TOKEN is the token you obtained in the previous step. INFLUXDB_ORG is the organization name you chose. INFLUXDB_BUCKET is the bucket name you chose. INFLUXDB_URL is the URL of your InfluxDB instance. In our case we are hosting it locally, so we need to fill in the PCs IP Adress followed by the InfluxDB port, for instance: + +``` +INFLUXDB_URL = "http://192.168.1.100:8087" +``` + + WIFI_SSID and WIFI_PASS are your WiFi credentials. + + +Now you can click on the upload button to flash the ESP. + +![Upload Button](resources/upload.png) + +Use the serial monitor to see the output of the ESP. You will see the IP address of the ESP. You can now access the webserver at `http://:80`. +Also, the ESP should now be able to send data to the database. Now the data should appear in the database and you should be greeted be able to configure these views: + +![Grafana Dashboard](resources/dashboard.png) +![InfluxDB Data](resources/influxdb.jpeg) +![ESP32 Webserver](resources/webserver.png) + Explore the code, contribute, and provide feedback. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c04a4cc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,42 @@ +# Docker Compose Stack mit InfluxDB und Grafana für das Projekt "Digitalisierung in der Energietechnik" +version: '3.6' +services: + influxdb: + container_name: influxdb-test + image: influxdb:2.7.1-alpine + ports: + - '8087:8086' # InfluxDB wird am Server unter Port 8087 bereitgestellt. + volumes: + - influxdb-data:/var/lib/influxdb2 # Docker Volume: Hier werden die Daten permanent gespeichert. + environment: + - DOCKER_INFLUXDB_INIT_MODE=setup + - DOCKER_INFLUXDB_INIT_USERNAME=influxUser + - DOCKER_INFLUXDB_INIT_PASSWORD=influxUserPW # Sollte geaendert werden. + - DOCKER_INFLUXDB_INIT_ORG=org-uni + - DOCKER_INFLUXDB_INIT_BUCKET=bucket-digitalisierung + - DOCKER_INFLUXDB_INIT_RETENTION=1w # (optional) data retention: Wann werden Daten geloescht? + - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=8gs8r6ZZp@%EGnR@xRpJ@d4sH2M%5m8# # (optional) admin-token definieren (sollte geaendert werden). + restart: unless-stopped + + grafana: + image: grafana/grafana + container_name: grafana-testserver + restart: always + depends_on: + - influxdb + environment: + - GF_SECURITY_ADMIN_USER=gfUser + - GF_SECURITY_ADMIN_PASSWORD=gfUserPW # Sollte geaendert werden. + - GF_INSTALL_PLUGINS= + - GF_SERVER_ROOT_URL="https://gf.bjoernellens1.com" # Dashboard derzeit unter dieser Subdomain erreichbar. + - GF_SERVER_DOMAIN=gf.bjoernellens1.com + links: + - influxdb + ports: + - '3002:3000' # Grafana wird am Server unter Port 3002 bereitgestellt. + volumes: + - grafana_data:/var/lib/grafana # Docker Volume: Hier werden die Daten permanent gespeichert. + +volumes: # Die Docker Volumes muessen hier definiert werden, werden dann automatisch mit dem Stack erstellt. + grafana_data: {} + influxdb-data: {} diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..f3ceccf --- /dev/null +++ b/platformio.ini @@ -0,0 +1,22 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:az-delivery-devkit-v4] +platform = espressif32 +board = az-delivery-devkit-v4 +framework = arduino +lib_deps = + Wire + Adafruit INA219 + ESP Async WebServer + ArduinoJson + tobiasschuerg/ESP8266 Influxdb@^3.13.1 +upload_port = COM3 +monitor_speed = 115200 diff --git a/resources/dashboard.png b/resources/dashboard.png new file mode 100644 index 0000000..8f07257 Binary files /dev/null and b/resources/dashboard.png differ diff --git a/resources/influxdb.jpeg b/resources/influxdb.jpeg new file mode 100644 index 0000000..10b8980 Binary files /dev/null and b/resources/influxdb.jpeg differ diff --git a/resources/upload.png b/resources/upload.png new file mode 100644 index 0000000..1d3d259 Binary files /dev/null and b/resources/upload.png differ diff --git a/resources/webserver.png b/resources/webserver.png new file mode 100644 index 0000000..6346871 Binary files /dev/null and b/resources/webserver.png differ diff --git a/resources/wiring.png b/resources/wiring.png new file mode 100644 index 0000000..561962d Binary files /dev/null and b/resources/wiring.png differ diff --git a/src/Config.h b/src/Config.h new file mode 100644 index 0000000..988d48f --- /dev/null +++ b/src/Config.h @@ -0,0 +1,16 @@ +// include secrets file. +#include "secrets.h" + +#ifndef CONFIG_H +#define CONFIG_H + +// InfluxDB config - This part needs to be changed when you are doing the Arduino setup wizard in InfluxDB. +const char* INFLUXDB_URL = "https://db.bjoernellens1.com"; +const char* INFLUXDB_ORG = "48cec24009273b5e"; +const char* INFLUXDB_BUCKET = "bucket-digitalisierung"; + +// Other configurations +#define RELAY_PIN 2 +#define SECOND_RELAY_PIN 15 + +#endif // CONFIG_H diff --git a/src/INA219Module.cpp b/src/INA219Module.cpp new file mode 100644 index 0000000..6689cc4 --- /dev/null +++ b/src/INA219Module.cpp @@ -0,0 +1,39 @@ +// INA219Module.cpp +#include "INA219Module.h" + +INA219Module::INA219Module() : _lastEnergyCalculationTime(0), _totalEnergy(0.0), _ina219(INA219_I2C_ADDRESS) { +} + +bool INA219Module::begin() { + return _ina219.begin(); +} + +float INA219Module::getCurrent() { + return _ina219.getCurrent_mA() / 1000.0; +} + +float INA219Module::getBusVoltage() { + return _ina219.getBusVoltage_V(); +} + +float INA219Module::getPower() { + return _ina219.getPower_mW() / 1000.0; +} + +float INA219Module::calculateAveragePower() { + return _ina219.getPower_mW() / 1000.0; +} + +float INA219Module::getTotalEnergy() { + unsigned long currentTime = millis(); + float elapsedTime = (currentTime - _lastEnergyCalculationTime) / 3600000.0; + + float currentPower = getPower(); + + _totalEnergy += currentPower * elapsedTime; + + _lastEnergyCalculationTime = currentTime; + + return _totalEnergy; +} + diff --git a/src/INA219Module.h b/src/INA219Module.h new file mode 100644 index 0000000..8ec7d5b --- /dev/null +++ b/src/INA219Module.h @@ -0,0 +1,23 @@ +// INA219Module.h +#ifndef INA219Module_h +#define INA219Module_h +#define INA219_I2C_ADDRESS 0x40 + +#include + +class INA219Module { +public: + INA219Module(); + bool begin(); + float getCurrent(); + float getBusVoltage(); + float getPower(); + float calculateAveragePower(); + float getTotalEnergy(); +private: + Adafruit_INA219 _ina219; + unsigned long _lastEnergyCalculationTime = 0; // Initialisierung der Zeitvariable + float _totalEnergy = 0.0; // Initialisierung der Gesamtenergie +}; + +#endif diff --git a/src/InfluxDBModule.cpp b/src/InfluxDBModule.cpp new file mode 100644 index 0000000..88cea22 --- /dev/null +++ b/src/InfluxDBModule.cpp @@ -0,0 +1,23 @@ +// InfluxDBModule.cpp +#include "InfluxDBModule.h" + +InfluxDBModule::InfluxDBModule(String url, String org, String bucket, String token) + : client(url, org, bucket, token, InfluxDbCloud2CACert) {} + +bool InfluxDBModule::connectToInfluxDB() { + return client.validateConnection(); +} + +bool InfluxDBModule::sendData(float current, float busVoltage, float power, float avgPower, float totalEnergy, int relay1State, int relay2State) { + Point sensorData("sensor_data"); + sensorData.addTag("device", "ESP32"); + sensorData.addField("current", current); + sensorData.addField("busVoltage", busVoltage); + sensorData.addField("power", power); + sensorData.addField("avgPower", avgPower); + sensorData.addField("totalEnergy", totalEnergy); + sensorData.addField("relay1StateINT", relay1State); + sensorData.addField("relay2StateINT", relay2State); + + return client.writePoint(sensorData); +} \ No newline at end of file diff --git a/src/InfluxDBModule.h b/src/InfluxDBModule.h new file mode 100644 index 0000000..0c028b7 --- /dev/null +++ b/src/InfluxDBModule.h @@ -0,0 +1,17 @@ +// InfluxDBModule.h +#ifndef InfluxDBModule_h +#define InfluxDBModule_h + +#include +#include + +class InfluxDBModule { +public: + InfluxDBModule(String url, String org, String bucket, String token); + bool connectToInfluxDB(); + bool sendData(float current, float busVoltage, float power, float avgPower, float totalEnergy, int relay1State, int relay2State); +private: + InfluxDBClient client; +}; + +#endif \ No newline at end of file diff --git a/src/WebServerModule.h b/src/WebServerModule.h new file mode 100644 index 0000000..3fccf5b --- /dev/null +++ b/src/WebServerModule.h @@ -0,0 +1,35 @@ +// WebServerModule.h +#ifndef WebServerModule_h +#define WebServerModule_h + +#include +#include +#include +#include "INA219Module.h" + +class WebServerModule { +public: + WebServerModule(INA219Module& inaModule, int relayPin, int secondRelayPin); + + void begin(); + bool getRelayState() const; + bool getSecondRelayState() const; + void handleToggleState(bool state); + void handleSecondToggleState(bool state); + +private: + INA219Module& _inaModule; + AsyncWebServer _server; + + bool relayState; + bool secondRelayState; + int _relayPin; + int _secondRelayPin; + + void handleRoot(AsyncWebServerRequest *request); + void handleValues(AsyncWebServerRequest *request); + void handleToggle(AsyncWebServerRequest *request); + void handleSecondToggle(AsyncWebServerRequest *request); +}; + +#endif diff --git a/src/WebserverModule.cpp b/src/WebserverModule.cpp new file mode 100644 index 0000000..8cc7a4d --- /dev/null +++ b/src/WebserverModule.cpp @@ -0,0 +1,175 @@ +// WebServerModule.cpp +#include "WebServerModule.h" + +WebServerModule::WebServerModule(INA219Module& inaModule, int relayPin, int secondRelayPin) + : _inaModule(inaModule), _server(80), _relayPin(relayPin), _secondRelayPin(secondRelayPin), relayState(false), secondRelayState(false) {} + +void WebServerModule::begin() { + // Konfiguriere die Pins für die Relais als Ausgänge + pinMode(_relayPin, OUTPUT); + pinMode(_secondRelayPin, OUTPUT); + + // Konfiguriere die Server-Endpunkte + _server.on("/", HTTP_GET, std::bind(&WebServerModule::handleRoot, this, std::placeholders::_1)); + _server.on("/values", HTTP_GET, std::bind(&WebServerModule::handleValues, this, std::placeholders::_1)); + _server.on("/toggle1", HTTP_GET, std::bind(&WebServerModule::handleToggle, this, std::placeholders::_1)); + _server.on("/toggle2", HTTP_GET, std::bind(&WebServerModule::handleSecondToggle, this, std::placeholders::_1)); + + _server.begin(); +} + +void WebServerModule::handleRoot(AsyncWebServerRequest *request) { + String html = ""; + html += "

Energieverbrauchsmonitor

"; + // Anzeige der Werte + html += "

Strom: A

"; + html += "

Spannung: V

"; + html += "

Leistung: W

"; + html += "

Durchschnittliche Leistung: W

"; + html += "

Gesamtenergie: Wh

"; + // JavaScript-Code für die Werteaktualisierung und Schaltersteuerung + html += ""; + // Schalter 1 (K1) + html += "
"; + html += ""; // Beschriftung für den ersten Schalter + html += ""; + html += "
"; + // Schalter 2 (K2) + html += "
"; + html += ""; // Beschriftung für den zweiten Schalter + html += ""; + html += "
"; + // JavaScript-Code für die Schaltersteuerung + html += ""; + html += ""; + request->send(200, "text/html", html); +} + +void WebServerModule::handleValues(AsyncWebServerRequest *request) { + String values = "{\"current_A\":" + String(_inaModule.getCurrent()) + ","; + values += "\"busVoltage_V\":" + String(_inaModule.getBusVoltage()) + ","; + values += "\"power_W\":" + String(_inaModule.getPower()) + ","; + values += "\"avgPower_W\":" + String(_inaModule.calculateAveragePower()) + ","; + values += "\"totalEnergy\":" + String(_inaModule.getTotalEnergy()) + "}"; + request->send(200, "application/json", values); +} + +void WebServerModule::handleToggle(AsyncWebServerRequest *request) { + if (request->hasParam("state")) { + int state = request->getParam("state")->value().toInt(); + relayState = state; + digitalWrite(_relayPin, relayState ? HIGH : LOW); + + Serial.print("Relay 1 state set to: "); + Serial.println(relayState); + + request->send(200, "text/plain", relayState ? "Relay 1 turned on" : "Relay 1 turned off"); + } else { + request->send(400); // Fehler, keine Zustandsinformation + } +} + +void WebServerModule::handleSecondToggle(AsyncWebServerRequest *request) { + if (request->hasParam("state")) { + int state = request->getParam("state")->value().toInt(); + secondRelayState = state; + digitalWrite(_secondRelayPin, secondRelayState ? HIGH : LOW); + + Serial.print("Relay 2 state set to: "); + Serial.println(secondRelayState); + + request->send(200, "text/plain", secondRelayState ? "Relay 2 turned on" : "Relay 2 turned off"); + } else { + request->send(400); // Fehler, keine Zustandsinformation + } +} + +void WebServerModule::handleToggleState(bool state) { + relayState = state; + digitalWrite(_relayPin, relayState ? HIGH : LOW); +} + +void WebServerModule::handleSecondToggleState(bool state) { + secondRelayState = state; + digitalWrite(_secondRelayPin, secondRelayState ? HIGH : LOW); +} + +bool WebServerModule::getRelayState() const { + return relayState; +} + +bool WebServerModule::getSecondRelayState() const { + return secondRelayState; +} \ No newline at end of file diff --git a/src/WiFiModule.cpp b/src/WiFiModule.cpp new file mode 100644 index 0000000..5aa58ae --- /dev/null +++ b/src/WiFiModule.cpp @@ -0,0 +1,36 @@ +#include "WiFiModule.h" + +WiFiModule::WiFiModule(const char* ssid, const char* password) { + // Kopiere SSID und Passwort in die Member-Variablen + strncpy(_ssid, ssid, sizeof(_ssid) - 1); + _ssid[sizeof(_ssid) - 1] = '\0'; // Stelle sicher, dass der String nullterminiert ist + + strncpy(_password, password, sizeof(_password) - 1); + _password[sizeof(_password) - 1] = '\0'; // Stelle sicher, dass der String nullterminiert ist +} + +void WiFiModule::connect() { + WiFi.begin(_ssid, _password); + while (WiFi.status() != WL_CONNECTED) { + delay(1000); + Serial.println("Connecting to WiFi..."); + } +} + +bool WiFiModule::isConnected() { + return WiFi.status() == WL_CONNECTED; +} + +IPAddress WiFiModule::getLocalIP() { + return WiFi.localIP(); +} + +void WiFiModule::printConnectionInfo() { + if (isConnected()) { + Serial.println("Connected to WiFi"); + Serial.print("Local IP: "); + Serial.println(getLocalIP()); + } else { + Serial.println("Connection to WiFi failed"); + } +} diff --git a/src/WiFiModule.h b/src/WiFiModule.h new file mode 100644 index 0000000..b6731bc --- /dev/null +++ b/src/WiFiModule.h @@ -0,0 +1,19 @@ +#ifndef WiFiModule_h +#define WiFiModule_h + +#include + +class WiFiModule { +public: + WiFiModule(const char* ssid, const char* password); + void connect(); + bool isConnected(); + IPAddress getLocalIP(); + void printConnectionInfo(); + +private: + char _ssid[32]; // Speicher für SSID und Passwort reservieren + char _password[32]; // Angenommene Maximalwerte, entsprechend anpassen falls nötig +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..6b9d6bf --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include "WiFiModule.h" +#include +#include +#include +#include "INA219Module.h" +#include "InfluxDBModule.h" +#include "WebServerModule.h" +#include +#include +#include +#include "Config.h" + +#define DEVICE "ESP32" + +WiFiModule wifiModule(WIFI_SSID, WIFI_PASSWORD); +INA219Module inaModule; +InfluxDBModule influxDB(INFLUXDB_URL, INFLUXDB_ORG, INFLUXDB_BUCKET, INFLUXDB_TOKEN); +WebServerModule webServer(inaModule, RELAY_PIN, SECOND_RELAY_PIN); + +void readAndSendSensorData(); +void controlRelays(); + +void setup() { + Serial.begin(115200); + Serial.println("... init ..."); + Wire.begin(); + Serial.println("Wire initialized"); + + wifiModule.connect(); + Serial.println("WiFi connected"); + wifiModule.printConnectionInfo(); + Serial.println("WiFi info printed"); + + if (!inaModule.begin()) { + Serial.println("INA219 sensor not found"); + while (1) { + delay(10); + } + } + Serial.println("INA219 sensor found"); + + if (!influxDB.connectToInfluxDB()) { + Serial.println("Failed to connect to InfluxDB"); + } + Serial.println("Connected to InfluxDB"); + + webServer.begin(); + Serial.println("Web server started"); + + Serial.println(); + Serial.println("......"); + Serial.println(); +} + +void loop() { + readAndSendSensorData(); + controlRelays(); + delay(1000); +} + +void readAndSendSensorData() { + float current = inaModule.getCurrent(); + float busVoltage = inaModule.getBusVoltage(); + float power = inaModule.getPower(); + float avgPower = inaModule.calculateAveragePower(); + float totalEnergy = inaModule.getTotalEnergy(); + bool relay1State = webServer.getRelayState(); + bool relay2State = webServer.getSecondRelayState(); + // Ändere die bool's zu Float-Werten + int relay1StateInt = relay1State ? 1 : 0; + int relay2StateInt = relay2State ? 1 : 0; + + influxDB.sendData(current, busVoltage, power, avgPower, totalEnergy, relay1StateInt , relay2StateInt ); + + Serial.print("current: "); + Serial.print(current); + Serial.println(" A"); + + Serial.print("busVoltage: "); + Serial.print(busVoltage); + Serial.println(" V"); + + Serial.print("power: "); + Serial.print(power); + Serial.println(" W"); + + Serial.print("avgPower: "); + Serial.print(avgPower); + Serial.println(" W"); + + Serial.print("totalEnergy: "); + Serial.print(totalEnergy); + Serial.println(" Wh"); + + Serial.println(); + Serial.println("... waiting .... "); + Serial.println(); +} + +void controlRelays() { + float power = inaModule.getPower(); + float busVoltage = inaModule.getBusVoltage(); + + // Zentrale Logik für die Relaissteuerung + if (power > 70.0) { + Serial.println("Turning on relays..."); + webServer.handleToggleState(false); // Relay 1 ausschalten + webServer.handleSecondToggleState(false); // Relay 2 ausschalten + } + + // Zusatz: Relais einschalten, wenn die Spannung zwischen 0 und 14V liegt + if (busVoltage > 0.0 && busVoltage < 14.0) { + Serial.println("Turning on relays due to voltage condition..."); + webServer.handleToggleState(true); // Relay 1 einschalten + webServer.handleSecondToggleState(true); // Relay 2 einschalten + } +} diff --git a/src/secrets.h.example b/src/secrets.h.example new file mode 100644 index 0000000..4e9000c --- /dev/null +++ b/src/secrets.h.example @@ -0,0 +1,9 @@ +// need to move all passwords and tokens into this file for safety +// this file is not tracked by git + +// WiFi credentials - change this to your WiFi credentials. +const char* WIFI_SSID = ""; +const char* WIFI_PASSWORD = ""; + +// InfluxDB credentials - change this to your InfluxDB credentials. +const char* INFLUXDB_TOKEN = ""; \ No newline at end of file