Subversion Repositories ESP32_P1_Meter

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 raymond 1
// **********************************
2
// * Settings                       *
3
// **********************************
4
 
5
// Update treshold in milliseconds, messages will only be sent on this interval
6
#define UPDATE_INTERVAL 60000  // 1 minute
7
//#define UPDATE_INTERVAL 300000 // 5 minutes
8
 
9
// * Baud rate for both hardware and software 
10
#define BAUD_RATE 115200
11
 
12
// The used serial pins, note that this can only be UART0, as other serial port doesn't support inversion
13
// By default the UART0 serial will be used. These settings displayed here just as a reference. 
14
// #define SERIAL_RX RX
15
// #define SERIAL_TX TX
16
 
17
// * Max telegram length
18
#define P1_MAXLINELENGTH 1050
19
 
20
// * The hostname of our little creature
21
#define HOSTNAME "p1meter"
22
 
23
// * The password used for OTA
24
#define OTA_PASSWORD "admin"
25
 
26
// * Wifi timeout in milliseconds
27
#define WIFI_TIMEOUT 30000
28
 
29
// * MQTT network settings
30
#define MQTT_MAX_RECONNECT_TRIES 10
31
 
32
// * MQTT root topic
33
#define MQTT_ROOT_TOPIC "sensors/power/p1meter"
34
 
35
// * MQTT Last reconnection counter
36
long LAST_RECONNECT_ATTEMPT = 0;
37
 
38
long LAST_UPDATE_SENT = 0;
39
 
40
// * To be filled with EEPROM data
41
char MQTT_HOST[64] = "";
42
char MQTT_PORT[6]  = "";
43
char MQTT_USER[32] = "";
44
char MQTT_PASS[32] = "";
45
 
46
// * Set to store received telegram
47
char telegram[P1_MAXLINELENGTH];
48
 
49
// * Set to store the data values read
50
long CONSUMPTION_LOW_TARIF;
51
long CONSUMPTION_HIGH_TARIF;
52
 
53
long RETURNDELIVERY_LOW_TARIF;
54
long RETURNDELIVERY_HIGH_TARIF;
55
 
56
long ACTUAL_CONSUMPTION;
57
long ACTUAL_RETURNDELIVERY;
58
long GAS_METER_M3;
59
 
60
long L1_INSTANT_POWER_USAGE;
61
long L2_INSTANT_POWER_USAGE;
62
long L3_INSTANT_POWER_USAGE;
63
long L1_INSTANT_POWER_CURRENT;
64
long L2_INSTANT_POWER_CURRENT;
65
long L3_INSTANT_POWER_CURRENT;
66
long L1_VOLTAGE;
67
long L2_VOLTAGE;
68
long L3_VOLTAGE;
69
 
70
// Set to store data counters read
71
long ACTUAL_TARIF;
72
long SHORT_POWER_OUTAGES;
73
long LONG_POWER_OUTAGES;
74
long SHORT_POWER_DROPS;
75
long SHORT_POWER_PEAKS;
76
 
77
// * Set during CRC checking
78
unsigned int currentCRC = 0;