corrected MQTT comm_disabled #529

fix Prometheus and JSON endpoints (`config_override.h`) #561
publish MQTT with fixed interval even if inverter is not available #542
added JSON settings upload. NOTE: settings JSON download changed, so only settings should be uploaded starting from version `0.5.70` #551
MQTT topic and inverter name have more allowed characters: `[A-Za-z0-9./#$%&=+_-]+`, thx: @Mo Demman
improved potential issue with `checkTicker`, thx @cbscpe
MQTT option for reset values on midnight / not avail / communication stop #539
small fix in `tickIVCommunication` #534
add `YieldTotal` correction, eg. to have the option to zero at year start #512
This commit is contained in:
lumapu 2023-01-08 22:16:14 +01:00
parent 4265856814
commit d8e255ddc2
16 changed files with 346 additions and 218 deletions

View file

@ -62,6 +62,9 @@ void app::setup() {
if (mConfig->mqtt.broker[0] > 0) {
everySec(std::bind(&PubMqttType::tickerSecond, &mMqtt));
everyMin(std::bind(&PubMqttType::tickerMinute, &mMqtt));
uint32_t nxtTrig = mTimestamp - ((mTimestamp - 1) % 86400) + 86400; // next midnight
if(mConfig->mqtt.rstYieldMidNight)
onceAt(std::bind(&app::tickMidnight, this), nxtTrig);
mMqtt.setSubscriptionCb(std::bind(&app::mqttSubRxCb, this, std::placeholders::_1));
}
#endif
@ -161,7 +164,7 @@ void app::tickIVCommunication(void) {
if (mTimestamp < (mSunrise - mConfig->sun.offsetSec)) { // current time is before communication start, set next trigger to communication start
nxtTrig = mSunrise - mConfig->sun.offsetSec;
} else {
if (mTimestamp > (mSunset + mConfig->sun.offsetSec)) { // current time is past communication stop, nothing to do. Next update will be done at midnight by tickCalcSunrise
if (mTimestamp >= (mSunset + mConfig->sun.offsetSec)) { // current time is past communication stop, nothing to do. Next update will be done at midnight by tickCalcSunrise
nxtTrig = 0;
} else { // current time lies within communication start/stop time, set next trigger to communication stop
mIVCommunicationOn = true;
@ -207,6 +210,15 @@ void app::tickSend(void) {
updateLed();
}
//-----------------------------------------------------------------------------
void app::tickMidnight(void) {
// only used and enabled by MQTT (see setup())
uint32_t nxtTrig = mTimestamp - ((mTimestamp - 1) % 86400) + 86400; // next midnight
onceAt(std::bind(&app::tickMidnight, this), nxtTrig);
mMqtt.tickerMidnight();
}
//-----------------------------------------------------------------------------
void app::handleIntr(void) {
DPRINTLN(DBG_VERBOSE, F("app::handleIntr"));