diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 48c9abc90..f632ea78d 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -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`` diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index fd14db3d5..3609e1310 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -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 diff --git a/tasmota/settings.h b/tasmota/settings.h index cef401a94..b1afca3ea 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -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 diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 24ef2051c..28e725930 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -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: diff --git a/tasmota/support_rtc.ino b/tasmota/support_rtc.ino index fe8f12454..f8fb25779 100644 --- a/tasmota/support_rtc.ino +++ b/tasmota/support_rtc.ino @@ -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); diff --git a/tasmota/tasmota.h b/tasmota/tasmota.h index 8da6354d9..11a530f32 100644 --- a/tasmota/tasmota.h +++ b/tasmota/tasmota.h @@ -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};