Add BootCount Reset Time to Status

Add BootCount Reset Time as BCResetTime to ``Status 1``
This commit is contained in:
Theo Arends 2020-02-07 12:38:10 +01:00
parent 945a9e0100
commit 1a074da0b5
6 changed files with 17 additions and 5 deletions

View File

@ -94,3 +94,4 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
- Add rule trigger on one level deeper using syntax with two ``#`` like ``on zigbeereceived#vibration_sensor#aqaracubeside=0 do ...``
- Add support for sensors DS18x20 and DHT family on Shelly 1 and Shelly 1PM using Shelly Add-On adapter (#7469)
- Add support for MI-BLE sensors using HM-10 Bluetooth 4.0 module by Christian Staars (#7683)
- Add BootCount Reset Time as BCResetTime to ``Status 1``

View File

@ -7,6 +7,7 @@
- Add commands ``SwitchMode 11`` PushHoldMulti and ``SwitchMode 12`` PushHoldInverted (#7603)
- Add command ``Buzzer -1`` for infinite mode and command ``Buzzer -2`` for following led mode (#7623)
- Add support for MI-BLE sensors using HM-10 Bluetooth 4.0 module by Christian Staars (#7683)
- Add BootCount Reset Time as BCResetTime to ``Status 1``
### 8.1.0.5 20200126

View File

@ -467,8 +467,9 @@ struct SYSCFG {
uint8_t hotplug_scan; // F03
uint8_t reserved1; // F04 - reserved for s-hadinger
uint8_t free_f05[211]; // F05
uint8_t free_f05[207]; // F05
uint32_t bootcount_reset_time; // FD4
int adc_param4; // FD8
uint32_t shutter_button[MAX_KEYS]; // FDC
uint32_t i2c_drivers[3]; // FEC I2cDriver

View File

@ -378,10 +378,10 @@ void CmndStatus(void)
if ((0 == payload) || (1 == payload)) {
Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS1_PARAMETER "\":{\"" D_JSON_BAUDRATE "\":%d,\"" D_CMND_SERIALCONFIG "\":\"%s\",\"" D_CMND_GROUPTOPIC "\":\"%s\",\"" D_CMND_OTAURL "\":\"%s\",\""
D_JSON_RESTARTREASON "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\",\"" D_JSON_STARTUPUTC "\":\"%s\",\"" D_CMND_SLEEP "\":%d,\""
D_JSON_CONFIG_HOLDER "\":%d,\"" D_JSON_BOOTCOUNT "\":%d,\"" D_JSON_SAVECOUNT "\":%d,\"" D_JSON_SAVEADDRESS "\":\"%X\"}}"),
D_JSON_CONFIG_HOLDER "\":%d,\"" D_JSON_BOOTCOUNT "\":%d,\"BCResetTime\":\"%s\",\"" D_JSON_SAVECOUNT "\":%d,\"" D_JSON_SAVEADDRESS "\":\"%X\"}}"),
Settings.baudrate * 300, GetSerialConfig().c_str(), SettingsText(SET_MQTT_GRP_TOPIC), SettingsText(SET_OTAURL),
GetResetReason().c_str(), GetUptime().c_str(), GetDateAndTime(DT_RESTART).c_str(), Settings.sleep,
Settings.cfg_holder, Settings.bootcount, Settings.save_flag, GetSettingsAddress());
Settings.cfg_holder, Settings.bootcount, GetDateAndTime(DT_BOOTCOUNT).c_str(), Settings.save_flag, GetSettingsAddress());
MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "1"));
}
@ -1453,6 +1453,7 @@ void CmndReset(void)
break;
case 99:
Settings.bootcount = 0;
Settings.bootcount_reset_time = 0;
ResponseCmndDone();
break;
default:

View File

@ -184,6 +184,9 @@ String GetDateAndTime(uint8_t time_type)
uint32_t time = Rtc.local_time;
switch (time_type) {
case DT_BOOTCOUNT:
time = Settings.bootcount_reset_time;
break;
case DT_ENERGY:
time = Settings.energy_kWhtotal_time;
break;
@ -438,7 +441,12 @@ void RtcSecond(void)
}
Rtc.local_time += Rtc.time_timezone;
Rtc.time_timezone /= 60;
if (!Settings.energy_kWhtotal_time) { Settings.energy_kWhtotal_time = Rtc.local_time; }
if (!Settings.energy_kWhtotal_time) {
Settings.energy_kWhtotal_time = Rtc.local_time;
}
if (Settings.bootcount_reset_time < START_VALID_TIME) {
Settings.bootcount_reset_time = Rtc.local_time;
}
}
BreakTime(Rtc.local_time, RtcTime);

View File

@ -226,7 +226,7 @@ enum WeekInMonthOptions {Last, First, Second, Third, Fourth};
enum DayOfTheWeekOptions {Sun=1, Mon, Tue, Wed, Thu, Fri, Sat};
enum MonthNamesOptions {Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec};
enum HemisphereOptions {North, South};
enum GetDateAndTimeOptions { DT_LOCAL, DT_UTC, DT_RESTART, DT_ENERGY };
enum GetDateAndTimeOptions { DT_LOCAL, DT_UTC, DT_RESTART, DT_ENERGY, DT_BOOTCOUNT };
enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE};