Batterie load wird nun mit 2 Stellen hinter dem Komma angezeigt,

Temperatur ist nun das Reading mit Durchschnittstemp der beiden
Aussensensoren
This commit is contained in:
Harald Küller 2023-12-08 16:07:55 +01:00
parent 275bde7dde
commit 4a1aae2961
6 changed files with 35 additions and 18 deletions

View File

@ -22,7 +22,7 @@ display::display() {
lasttime = millis() - ( UPDATE_MINUTE * 1000 * 60 );
}
display::display(long leistung, long verbrauch, int batterie, float temp, float feuchte, float druck, float gewicht) {
display::display(long leistung, long verbrauch, float batterie, float temp, float feuchte, float druck, float gewicht) {
//Used to get Memory from System
void *pd;
@ -126,8 +126,8 @@ void display::LoadFrame() {
PrintValueLine(3,7,0,String("Feuchte:"),String("%"),String(WT_Feuchte,2));
PrintValueLine(3,8,1,String("Luftdruck:"),String("hP"),String(WT_Druck,1));
PrintHeadLine(9,String("Pellets Heizung"));
PrintValueLine(3,10,0,String("Gew. Bestand:"),String("T"),String(PL_Gewicht,3));
//PrintValueLine(3,10,0,String("Bestand:"),String("T"),String(HZ_Lager,3));
//PrintValueLine(3,10,0,String("Gew. Bestand:"),String("T"),String(PL_Gewicht,3));
PrintValueLine(3,10,0,String("Bestand:"),String("T"),String(HZ_Lager,3));
PrintValueLine(3,11,0,String("Hzg Status:"),String(HZ_Fehler),String(""));
//Send the Buffer to the Display, and do a refresh with the contents
//of this buffer (attention this will switch internal (display) the buffers
@ -145,7 +145,7 @@ void display::PrintValueLine(int x, int linenum, int left, String name, String t
paint->DrawStringAt((TYPEPOS*CHARSIZE)-(2*CHARSIZE)-(value.length()*CHARSIZE)-(left*CHARSIZE), FIRSTLINE + (linenum * LINESPACE), value.c_str(), &INFOFONT, COLORED);
}
void display::LoadFrame(long leistung, long verbrauch, int batterie, float temp, float feuchte, float druck, float gewicht) {
void display::LoadFrame(long leistung, long verbrauch, float batterie, float temp, float feuchte, float druck, float gewicht) {
//Just assign the given Values
PV_Leistung=leistung;
PV_Verbrauch=verbrauch;
@ -181,7 +181,7 @@ void display::UpdatePVVerbrauch(long verbrauch) {
//Just assign new value
PV_Verbrauch=verbrauch;
}
void display::UpdatePVBatterie(int batterie) {
void display::UpdatePVBatterie(float batterie) {
//Just assign new value
PV_Batterie=batterie;
}
@ -231,7 +231,7 @@ long display::GetPVLeistung_grid() {
long display::GetPVVerbrauch() {
return(PV_Verbrauch);
}
int display::GetPVBatterie() {
float display::GetPVBatterie() {
return(PV_Batterie);
}
long display::GetPVWallboxWatt() {

View File

@ -71,12 +71,12 @@
class display {
public:
display();
display(long leistung, long verbrauch, int batterie, float temp, float feuchte, float druck, float gewicht);
display(long leistung, long verbrauch, float batterie, float temp, float feuchte, float druck, float gewicht);
void begin();
void NetDone();
void NetOffline();
void LoadFrame();
void LoadFrame(long leistung, long verbrauch, int batterie, float temp, float feuchte, float druck, float gewicht);
void LoadFrame(long leistung, long verbrauch, float batterie, float temp, float feuchte, float druck, float gewicht);
void PrintHeadLine(int linenum, String head);
void PrintValueLine(int x, int linenum, int left, String name, String type, String value);
void UpdatePVLeistung(long leistung);
@ -85,7 +85,7 @@ public:
void UpdatePVLeistung_batt(long verbrauch);
void UpdatePVLeistung_grid(long verbrauch);
void UpdatePVVerbrauch(long verbrauch);
void UpdatePVBatterie(int batterie);
void UpdatePVBatterie(float batterie);
void UpdatePVWallboxWatt(long WallboxWatt);
void UpdatePVHeizstab(long leistung);
void UpdateWTTemperatur(float temperatur);
@ -101,7 +101,7 @@ public:
long GetPVLeistung_grid();
long GetPVWallboxWatt();
long GetPVVerbrauch();
int GetPVBatterie();
float GetPVBatterie();
long GetPVHeizstab();
float GetWTTemperatur();
float GetWTFeuchte();
@ -124,7 +124,7 @@ private:
long PV_Leistung_grid;
long PV_Verbrauch;
long PV_Heizstab;
int PV_Batterie;
float PV_Batterie;
long PV_WallboxWatt;
float WT_Temperatur;
float WT_Feuchte;

View File

@ -42,7 +42,11 @@ void setup() {
void loop() {
// put your main code here, to run repeatedly:
net.testNet(&disp);
if ( net.testNet(&disp) == 1 ) {
disp.NetDone();
net.UpdateData(&disp);
disp.updatelast();
}
net.handleOTA();
net.handleWeb(&disp);
if ( millis() - disp.getLastTime() > UPDATE_MINUTE * 1000 * 60) {

View File

@ -11,7 +11,7 @@ network::network() {
void network::begin() {
//wifimanager.resetSettings();
wifimanager.setConfigPortalTimeout(300);
if( ! wifimanager.autoConnect("IOT_Display_AP") ) {
if( ! wifimanager.autoConnect("IOTAnzeiger") ) {
ESP.restart();
}
ArduinoOTA.onStart([]() {
@ -32,7 +32,8 @@ void network::begin() {
yield();
}
void network::testNet(display *disp) {
int network::testNet(display *disp) {
int rc=0;
int wifi_retry = 0;
while(WiFi.status() != WL_CONNECTED && wifi_retry < 5 ) {
disp->NetOffline();
@ -41,10 +42,22 @@ void network::testNet(display *disp) {
wifimanager.autoConnect("AutoConnectAP");
delay(100);
wifi_retry++;
rc=1;
}
if(wifi_retry >= 5) {
ESP.restart();
}
if(wifi_retry > 0) {
ArduinoOTA.begin();
configTime(MY_TZ, MY_NTP_SERVER);
server->begin();
netvalues->begin();
server->setNoDelay(true);
netvalues->setNoDelay(true);
client=network::FhemConnect();
yield();
}
return(rc);
}
//the minimalistic webserver
@ -221,7 +234,7 @@ void network::UpdateData(display *disp) {
disp->UpdatePVVerbrauch((long) Result.toDouble());
}
if (FhemGetData(&Result, String("E3DC"), String("batterie_fuellstand"), &lasttime) == 1 ) {
disp->UpdatePVBatterie(Result.toInt());
disp->UpdatePVBatterie(Result.toDouble());
}
if (FhemGetData(&Result, String("E3DC"), String("Wallboxwatt"), &lasttime) == 1 ) {
disp->UpdatePVWallboxWatt((long) Result.toDouble());
@ -229,7 +242,7 @@ void network::UpdateData(display *disp) {
if (FhemGetData(&Result, String("kg_hzg_pvheat"), String("Leistung"), &lasttime) == 1 ) {
disp->UpdatePVHeizstab((long) Result.toDouble());
}
if (FhemGetData(&Result, String("gt_carport_wetter"), String("temperature"), &lasttime) == 1 ) {
if (FhemGetData(&Result, String("gt_carport_wetter"), String("av_temp"), &lasttime) == 1 ) {
disp->UpdateWTTemperatur(Result.toFloat());
}
if (FhemGetData(&Result, String("gt_carport_wetter"), String("humidity"), &lasttime) == 1 ) {

View File

@ -21,7 +21,7 @@ private:
public:
network();
void begin();
void testNet(display *disp);
int testNet(display *disp);
void handleWeb(display *disp);
void UpdateData(display *disp);
int FhemGetData(String *result,const String device, const String reading, long unsigned int *lasttime);

View File

@ -19,4 +19,4 @@
//#define FONTSIZE_8
#define WAITFHEMAW 1000
#endif
#define APSID IOTAnzeiger