mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-27 15:56:11 +02:00
0.7.20
* merge PR #1048 version and hash in API, fixes #1045 * fix: no yield day update if yield day reads `0` after inverter reboot (mostly on evening) #848 * try to fix Wifi override #1047 * added information after NTP sync to WebUI #1040
This commit is contained in:
parent
a893ae17ef
commit
53ff04b689
6 changed files with 49 additions and 14 deletions
|
@ -1,5 +1,11 @@
|
||||||
# Development Changes
|
# Development Changes
|
||||||
|
|
||||||
|
## 0.7.20 - 2023-07-28
|
||||||
|
* merge PR #1048 version and hash in API, fixes #1045
|
||||||
|
* fix: no yield day update if yield day reads `0` after inverter reboot (mostly on evening) #848
|
||||||
|
* try to fix Wifi override #1047
|
||||||
|
* added information after NTP sync to WebUI #1040
|
||||||
|
|
||||||
## 0.7.19 - 2023-07-27
|
## 0.7.19 - 2023-07-27
|
||||||
* next attempt to fix yield day for multiple inverters #1016
|
* next attempt to fix yield day for multiple inverters #1016
|
||||||
* reduced threshold for inverter state machine from 60min to 15min to go from state `WAS_ON` to `OFF`
|
* reduced threshold for inverter state machine from 60min to 15min to go from state `WAS_ON` to `OFF`
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 7
|
#define VERSION_MINOR 7
|
||||||
#define VERSION_PATCH 19
|
#define VERSION_PATCH 20
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -68,6 +68,7 @@ class PubMqttIvData {
|
||||||
void stateStart() {
|
void stateStart() {
|
||||||
mLastIvId = 0;
|
mLastIvId = 0;
|
||||||
mTotalFound = false;
|
mTotalFound = false;
|
||||||
|
mSendTotalYd = true;
|
||||||
mAllTotalFound = true;
|
mAllTotalFound = true;
|
||||||
if(!mSendList->empty()) {
|
if(!mSendList->empty()) {
|
||||||
mCmd = mSendList->front().cmd;
|
mCmd = mSendList->front().cmd;
|
||||||
|
@ -136,9 +137,14 @@ class PubMqttIvData {
|
||||||
case FLD_YT:
|
case FLD_YT:
|
||||||
mTotal[1] += mIv->getValue(mPos, rec);
|
mTotal[1] += mIv->getValue(mPos, rec);
|
||||||
break;
|
break;
|
||||||
case FLD_YD:
|
case FLD_YD: {
|
||||||
mTotal[2] += mIv->getValue(mPos, rec);
|
uint8_t val = mIv->getValue(mPos, rec);
|
||||||
|
if(0 == val) // inverter restarted during day
|
||||||
|
mSendTotalYd = false;
|
||||||
|
else
|
||||||
|
mTotal[2] += val;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case FLD_PDC:
|
case FLD_PDC:
|
||||||
mTotal[3] += mIv->getValue(mPos, rec);
|
mTotal[3] += mIv->getValue(mPos, rec);
|
||||||
break;
|
break;
|
||||||
|
@ -180,7 +186,7 @@ class PubMqttIvData {
|
||||||
fieldId = FLD_YT;
|
fieldId = FLD_YT;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if(!mAllTotalFound) {
|
if((!mAllTotalFound) || (!mSendTotalYd)) {
|
||||||
mPos++;
|
mPos++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +216,7 @@ class PubMqttIvData {
|
||||||
|
|
||||||
uint8_t mCmd;
|
uint8_t mCmd;
|
||||||
uint8_t mLastIvId;
|
uint8_t mLastIvId;
|
||||||
bool mSendTotals, mTotalFound, mAllTotalFound;
|
bool mSendTotals, mTotalFound, mAllTotalFound, mSendTotalYd;
|
||||||
float mTotal[4];
|
float mTotal[4];
|
||||||
|
|
||||||
Inverter<> *mIv, *mIvSend;
|
Inverter<> *mIv, *mIvSend;
|
||||||
|
|
|
@ -197,6 +197,7 @@ class RestApi {
|
||||||
void getGeneric(AsyncWebServerRequest *request, JsonObject obj) {
|
void getGeneric(AsyncWebServerRequest *request, JsonObject obj) {
|
||||||
obj[F("wifi_rssi")] = (WiFi.status() != WL_CONNECTED) ? 0 : WiFi.RSSI();
|
obj[F("wifi_rssi")] = (WiFi.status() != WL_CONNECTED) ? 0 : WiFi.RSSI();
|
||||||
obj[F("ts_uptime")] = mApp->getUptime();
|
obj[F("ts_uptime")] = mApp->getUptime();
|
||||||
|
obj[F("ts_now")] = mApp->getTimestamp();
|
||||||
obj[F("version")] = String(mApp->getVersion());
|
obj[F("version")] = String(mApp->getVersion());
|
||||||
obj[F("build")] = String(AUTO_GIT_HASH);
|
obj[F("build")] = String(AUTO_GIT_HASH);
|
||||||
obj[F("menu_prot")] = mApp->getProtection(request);
|
obj[F("menu_prot")] = mApp->getProtection(request);
|
||||||
|
|
|
@ -200,13 +200,17 @@
|
||||||
<div class="col-12 col-sm-9"><input type="number" name="ntpIntvl"/></div>
|
<div class="col-12 col-sm-9"><input type="number" name="ntpIntvl"/></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-12 col-sm-3 my-2">set system time</div>
|
<div class="col-12 col-sm-3 my-2">set System time</div>
|
||||||
<div class="col-12 col-sm-9">
|
<div class="col-12 col-sm-9">
|
||||||
<input type="button" name="ntpBtn" id="ntpBtn" class="btn" value="from browser" onclick="setTime()"/>
|
<input type="button" name="ntpBtn" id="ntpBtn" class="btn" value="from browser" onclick="setTime()"/>
|
||||||
<input type="button" name="ntpSync" id="ntpSync" class="btn" value="sync NTP" onclick="syncTime()"/>
|
<input type="button" name="ntpSync" id="ntpSync" class="btn" value="sync NTP" onclick="syncTime()"/><br/>
|
||||||
<span id="apiResultNtp"></span>
|
<span id="apiResultNtp"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-12 col-sm-3 my-2">System Time</div>
|
||||||
|
<div class="col-12 col-sm-9 my-2"><span id="date"></span></div>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -333,6 +337,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var highestId = 0;
|
var highestId = 0;
|
||||||
var maxInv = 0;
|
var maxInv = 0;
|
||||||
|
var ts = 0;
|
||||||
|
|
||||||
var esp8266pins = [
|
var esp8266pins = [
|
||||||
[255, "off / default"],
|
[255, "off / default"],
|
||||||
|
@ -474,11 +479,17 @@
|
||||||
function apiCbNtp(obj) {
|
function apiCbNtp(obj) {
|
||||||
var e = document.getElementById("apiResultNtp");
|
var e = document.getElementById("apiResultNtp");
|
||||||
if(obj["success"])
|
if(obj["success"])
|
||||||
e.innerHTML = "command excuted";
|
e.innerHTML = "command excuted, set new time ...";
|
||||||
else
|
else
|
||||||
e.innerHTML = "Error: " + obj["error"];
|
e.innerHTML = "Error: " + obj["error"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function apiCbNtp2(obj) {
|
||||||
|
var e = document.getElementById("apiResultNtp");
|
||||||
|
var date = new Date(obj["ts_now"] * 1000);
|
||||||
|
e.innerHTML = "synced at: " + toIsoDateStr(date) + ", difference: " + (ts - obj["ts_now"]) + "ms";
|
||||||
|
}
|
||||||
|
|
||||||
function apiCbMqtt(obj) {
|
function apiCbMqtt(obj) {
|
||||||
var e = document.getElementById("apiResultMqtt");
|
var e = document.getElementById("apiResultMqtt");
|
||||||
if(obj["success"])
|
if(obj["success"])
|
||||||
|
@ -493,6 +504,7 @@
|
||||||
obj.cmd = "set_time";
|
obj.cmd = "set_time";
|
||||||
obj.val = parseInt(date.getTime() / 1000);
|
obj.val = parseInt(date.getTime() / 1000);
|
||||||
getAjax("/api/setup", apiCbNtp, "POST", JSON.stringify(obj));
|
getAjax("/api/setup", apiCbNtp, "POST", JSON.stringify(obj));
|
||||||
|
setTimeout(function() {getAjax('/api/index', apiCbNtp2)}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function scan() {
|
function scan() {
|
||||||
|
@ -506,6 +518,7 @@
|
||||||
var obj = new Object();
|
var obj = new Object();
|
||||||
obj.cmd = "sync_ntp";
|
obj.cmd = "sync_ntp";
|
||||||
getAjax("/api/setup", apiCbNtp, "POST", JSON.stringify(obj));
|
getAjax("/api/setup", apiCbNtp, "POST", JSON.stringify(obj));
|
||||||
|
setTimeout(function() {getAjax('/api/index', apiCbNtp2)}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendDiscoveryConfig() {
|
function sendDiscoveryConfig() {
|
||||||
|
@ -664,6 +677,9 @@
|
||||||
parseNav(obj);
|
parseNav(obj);
|
||||||
parseESP(obj);
|
parseESP(obj);
|
||||||
parseRssi(obj);
|
parseRssi(obj);
|
||||||
|
|
||||||
|
ts = obj["ts_now"];
|
||||||
|
window.setInterval("tick()", 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseStaticIp(obj) {
|
function parseStaticIp(obj) {
|
||||||
|
@ -869,6 +885,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tick() {
|
||||||
|
document.getElementById("date").innerHTML = toIsoDateStr((new Date((++ts) * 1000)));
|
||||||
|
}
|
||||||
|
|
||||||
function parse(root) {
|
function parse(root) {
|
||||||
if(null != root) {
|
if(null != root) {
|
||||||
parseSys(root["system"]);
|
parseSys(root["system"]);
|
||||||
|
|
|
@ -54,15 +54,17 @@ void ahoywifi::setupWifi(bool startAP = false) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !defined(AP_ONLY)
|
#if !defined(AP_ONLY)
|
||||||
if(mConfig->valid) {
|
#if defined(FB_WIFI_OVERRIDDEN)
|
||||||
#if !defined(FB_WIFI_OVERRIDDEN)
|
snprintf(mConfig->sys.stationSsid, SSID_LEN, "%s", FB_WIFI_SSID);
|
||||||
if(strncmp(mConfig->sys.stationSsid, FB_WIFI_SSID, 14) != 0)
|
snprintf(mConfig->sys.stationPwd, PWD_LEN, "%s", FB_WIFI_PWD);
|
||||||
setupStation();
|
setupStation();
|
||||||
#else
|
#else
|
||||||
|
if(mConfig->valid) {
|
||||||
|
if(strncmp(mConfig->sys.stationSsid, FB_WIFI_SSID, 14) != 0)
|
||||||
setupStation();
|
setupStation();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue