Every 10 seconds the values are updated
+diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index 0b6db0a0..b080df25 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -1,11 +1,13 @@ #include "app.h" #include "html/h/index_html.h" +#include "html/h/hoymiles_html.h" extern String setup_html; //----------------------------------------------------------------------------- app::app() : Main() { mHoymiles = new hoymiles(); + mDecoder = new hm1200Decode(); mBufCtrl = new CircularBuffer(mBuffer, PACKET_BUFFER_SIZE); @@ -32,6 +34,8 @@ void app::setup(const char *ssid, const char *pwd, uint32_t timeout) { mWeb->on("/setup", std::bind(&app::showSetup, this)); mWeb->on("/save", std::bind(&app::showSave, this)); mWeb->on("/cmdstat", std::bind(&app::showCmdStatistics, this)); + mWeb->on("/hoymiles", std::bind(&app::showHoymiles, this)); + mWeb->on("/livedata", std::bind(&app::showLiveData, this)); if(mSettingsValid) mEep->read(ADDR_HOY_ADDR, mHoymiles->mAddrBytes, HOY_ADDR_LEN); @@ -56,14 +60,16 @@ void app::loop(void) { uint8_t len, rptCnt; NRF24_packet_t *p = mBufCtrl->getBack(); - //mHoymiles->dumpBuf("RAW ", p->packet, PACKET_BUFFER_SIZE); + //mHoymiles->dumpBuf("RAW ", p->packet, MAX_RF_PAYLOAD_SIZE); if(mHoymiles->checkCrc(p->packet, &len, &rptCnt)) { // process buffer only on first occurrence if((0 != len) && (0 == rptCnt)) { Serial.println("CMD " + String(p->packet[11], HEX)); mHoymiles->dumpBuf("Payload ", p->packet, len); - // @TODO: do analysis here + + mDecoder->convert(&p->packet[11], len); + if(p->packet[11] == 0x01) mCmds[0]++; else if(p->packet[11] == 0x02) mCmds[1]++; else if(p->packet[11] == 0x03) mCmds[2]++; @@ -268,6 +274,43 @@ void app::showCmdStatistics(void) { } +//----------------------------------------------------------------------------- +void app::showHoymiles(void) { + String html = hoymiles_html; + html.replace("{DEVICE}", mDeviceName); + html.replace("{VERSION}", mVersion); + mWeb->send(200, "text/html", html); +} + + +//----------------------------------------------------------------------------- +void app::showLiveData(void) { + String modHtml = ""; + + String unit[5] = {"V", "A", "W", "Wh", "kWh"}; + String info[5] = {"VOLTAGE", "CURRENT", "POWER", "YIELD DAY", "YIELD"}; + + for(uint8_t i = 0; i < 4; i++) { + modHtml += "
Every 10 seconds the values are updated
Every 10 seconds the values are updated
+
+ Hoymiles
Update
Setup
diff --git a/tools/esp8266/html/style.css b/tools/esp8266/html/style.css
index 7d6daaa7..cfa6dad0 100644
--- a/tools/esp8266/html/style.css
+++ b/tools/esp8266/html/style.css
@@ -134,18 +134,55 @@ label {
}
.inputWrp .floating_label {
- position: absolute;
- pointer-events: none;
- top: 20px;
- left: 10px;
- transition: 0.2s ease all;
+ position: absolute;
+ pointer-events: none;
+ top: 20px;
+ left: 10px;
+ transition: 0.2s ease all;
}
.inputWrp input:focus ~ .floating_label,
.inputWrp input:not(:focus):valid ~ .floating_label {
- top: 0px;
- left: 20px;
- font-size: 10px;
- color: blue;
- opacity: 1;
+ top: 0px;
+ left: 20px;
+ font-size: 10px;
+ color: blue;
+ opacity: 1;
+}
+
+div.module {
+ display: block;
+ width: 250px;
+ height: 410px;
+ background-color: #006ec0;
+ display: inline-block;
+ position: relative;
+ margin-right: 20px;
+ margin-bottom: 20px;
+}
+div.module .value, div.module .info, div.module .header {
+ color: #fff;
+ display: block;
+ width: 100%;
+ text-align: center;
+}
+
+div.module .unit {
+ font-size: 19px;
+ margin-left: 10px;
+}
+
+div.module .value {
+ margin-top: 20px;
+ font-size: 30px;
+}
+
+div.module .info {
+ margin-top: 3px;
+ font-size: 10px;
+}
+
+div.module .header {
+ background-color: #003c80;
+ padding: 10px 0 10px 0;
}