Skip to content

04. Initialize historic data

pesor edited this page Feb 14, 2021 · 1 revision

Initialize historic data

When initialising the program, it is important to set the current months data (lastMonth = current month), confusing, but that is the case and important.

After initialisation, all initialisation variables have to be commented out.

writeFile(SPIFFS, "/lastMonth.txt", "10");

The lastDay variable, has like the LastMonth to be set as current

writeFile(SPIFFS, "/lastDay.txt", "27");

These two variables comes from the Kamstrup meter. These figures are ALWAYS current, so in order to set the Last Month, you either have to get it from the electricity company's APP, e.g. like in Denmark, the SEAS NVE app, or take it from the FTP'ed JSON file end of month.

writeFile(SPIFFS, "/MeterToLastMonthEnergyExp.txt", "7037.65");
writeFile(SPIFFS, "/MeterToLastMonthEnergyImp.txt", "7815,72");

Here you set the netto consumption in kWh over the last 12 months. This is only valid when having Sun Cells and running on the Danish Old "Ordning". If you have sun cells, and not on this "Ordning", you should raise an issue, and we find a solution on how to calculate your net.consumption. If you do not have sun cells, fill in zero for each month, as you will not use this data.

char Netto12Months[] = R"raw({"netto12":{"Jan":"712.35","Feb":"0","Mar":"107.84","Apr":"-242.80","Maj":"-311.25","Jun":"-309.09","Jul":"-154.08","Aug":"-11.45","Sep":"30.95","Okt":"236.10","Nov":"452","Dec":"647"}})raw";

writeFile(SPIFFS, "/last12.txt", Netto12Months);

The next is only valid if you have sun cells, otherwise fill in with zeros. These 12 variables are in kWh, and comes from e.g. in my case, the Fronius WEB site, or any other WEB site where your sun cell manufacturer stores your data. If you cannot get the data, you will have to start from scratch

char up12Months[] = R"raw({"up12":{"Jan":"0","Feb":"0","Mar":"334.40","Apr":"548.00","Maj":"631.40","Jun":"581.30","Jul":"427.40","Aug":"384.10","Sep":"304.20","Okt":"169.60","Nov":"46.52","Dec":"3.07"}})raw";

writeFile(SPIFFS, "/up12.txt", up12Months);

This is your actual electricity consumption in kWh, and comes from the electricity company's APP, e.g. like in Denmark, the SEAS NVE app. If you cannot get the data, you will have to start from scratch

char down12Months[] = R"raw({"down12":{"Jan":"0","Feb":"0","Mar":"442.26","Apr":"305.20","Maj":"320.15","Jun":"272.21","Jul":"273.36","Aug":"372.65","Sep":"335.15","Okt":"405.70","Nov":"498.25","Dec":"647.23"}})raw";

writeFile(SPIFFS, "/down12.txt", down12Months);

Do not comment out, or delete this last line, as it is a good warning if your initialization is true, and should be false.

Serial.println("DID YOU REMEMBER TO UNCOMMENT / COMMENT THE VARIABLES YOU WANT TO USE / NOT USE ---- IMPORTANT!!!!!!!!!!!");