Skip to content

03. user defined variables.h

pesor edited this page Feb 14, 2021 · 2 revisions

user-defined-variables.h

The user-defined-variables.h is found in the include folder, and is the hearth of setting up the module.

Here you set all the user defines variables, in order to make the program run correctly.

// Initiate FLAG, Set to true, when you want to initiate all the history variables, See howto under **Initialize**
bool initiate = false;

define your SSID's, and remember to fill out variable ssidArrNo with the number of your SSID's

String ssidArr[] = {"Enterprise-pro", "Enterprise_EXT", "Enterprise_EXTN", "Enterprise" };
int ssidArrNo = 4;

const char* ssid = ""; // no need to fill in
const char* password = "password";
const char* ntpServer = "pool.ntp.org";

Remember to count your number of access points (AP), and fill the ssidArrNo with the number

Offset for GMT time

Remember to set your Off-sets for GMT time, each hour is 3.600 seconds.

const long  gmtOffset_sec = 3600;

Define time to sleep in case of errors

#define uS_TO_S_FACTOR 1000000ULL //Conversion factor for micro seconds to seconds.  **DO NOT CHANGE**
#define TIME_TO_SLEEP  3000       //Time ESP32 will go to sleep (in seconds)

Give the FTP credentials to your FTP_Server

char ftp_server[] = "192.168.1.64"; //Can also be a name.
char ftp_user[]   = "user";
char ftp_pass[]   = "password";

Give the parameters for your MQTT broker/server

const char broker[] = "192.168.1.64"; // Can also be a name
int        port     = 1883;
const char mqttuser[] = ""; //add eventual mqtt username
const char mqttpass[] = ""; //add eventual mqtt password

Kamstrup Omnipower keys, you will have to get these from your electricity provider

const char conf_key[33] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";     //Meter Key
const char conf_authkey[33] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; //Meter Key

Upload your sketch to the module, and

YOU ARE DONE with first part