Skip to content

Commit 8608a13

Browse files
All setup now happens in 'setup.h'.
1 parent 2bf81a0 commit 8608a13

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

setup.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* system setup file for smartMeterLogger-esp32 */
2+
3+
const char* WIFI_NETWORK = "xxx";
4+
const char* WIFI_PASSWORD = "xxx";
5+
6+
/* settings for smartMeter */
7+
#define RXD_PIN (36)
8+
#define BAUDRATE (115200)
9+
#define UART_NR (UART_NUM_2)
10+
11+
#define USE_WS_BRIDGE false /* true = connect to a dsmr websocket bridge - false = connect to a dsmr smartmeter */
12+
13+
const char* WS_BRIDGE_HOST = "192.168.0.106"; /* bridge name or ip*/
14+
const uint16_t WS_BRIDGE_PORT = 80; /* bridge port */
15+
const char* WS_BRIDGE_URL = "/raw"; /* bridge url */
16+
17+
#define SET_STATIC_IP false /* If SET_STATIC_IP is set to true then STATIC_IP, GATEWAY, SUBNET and PRIMARY_DNS have to be set to some sane values */
18+
19+
const IPAddress STATIC_IP (192, 168, 0, 90); /* This should be outside your router dhcp range! */
20+
const IPAddress GATEWAY (192, 168, 0, 1); /* Set to your gateway ip address */
21+
const IPAddress SUBNET (255, 255, 255, 0); /* Usually 255,255,255,0 check in your router or pc connected to the same network */
22+
const IPAddress PRIMARY_DNS (192, 168, 0, 30); /* Check in your router */
23+
const IPAddress SECONDARY_DNS (0, 0, 0, 0); /* Check in your router */
24+
25+
/* settings for ntp time sync */
26+
const char* NTP_POOL = "nl.pool.ntp.org";
27+
const char* TIMEZONE = "CET-1CEST,M3.5.0/2,M10.5.0/3"; /* Central European Time - see http://www.remotemonitoringsystems.ca/time-zone-abbreviations.php */
28+
29+
/* settings for a ssd1306/sh1106 oled screen */
30+
//#define SH1106_OLED /* uncomment to compile for SH1106 instead of SSD1306 */
31+
32+
#define OLED_ADDRESS (0x3C)
33+
#define I2C_SDA_PIN (21)
34+
#define I2C_SCL_PIN (22)

smartMeterLogger-esp32.ino

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <WebSocketsClient.h> /* https://github.com/Links2004/arduinoWebSockets */
77
#include <dsmr.h> /* https://github.com/matthijskooijman/arduino-dsmr */
88

9-
#include "wifisetup.h"
9+
#include "setup.h"
1010
#include "index_htm_gz.h"
1111
#include "dagelijks_htm_gz.h"
1212

@@ -18,11 +18,6 @@
1818

1919
#define SAVE_TIME_MIN (1) /* data save interval in minutes */
2020

21-
/* settings for smartMeter */
22-
#define RXD_PIN (36)
23-
#define BAUDRATE (115200)
24-
#define UART_NR (UART_NUM_2)
25-
2621
const char* WS_RAW_URL = "/raw";
2722
const char* WS_EVENTS_URL = "/events";
2823

@@ -211,12 +206,10 @@ void setup() {
211206
});
212207

213208
http_server.on("/dagen", HTTP_GET, [](AsyncWebServerRequest * request) {
214-
// TODO: check that the file is at least plausibly named for a /year/month/day thing
215-
const char* month {
216-
"maand"
217-
};
209+
const char* month{"maand"};
218210
if (!request->hasArg(month)) return request->send(400);
219211
if (!SD.exists(request->arg(month))) return request->send(404);
212+
// TODO: check that the file is at least plausibly named for a /year/month/day thing
220213
File path = SD.open(request->arg(month));
221214
if (!path || !path.isDirectory()) return request->send(503);
222215
File item = path.openNextFile();

wifisetup.h

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)