mirror of https://github.com/arendst/Tasmota.git
Merge pull request #11961 from s-hadinger/zigbee_avoid_erase_zbdata
Zigbee avoid erasing ZbData if zigbee is not started
This commit is contained in:
commit
ec2ea83582
|
@ -220,6 +220,7 @@ bool hydrateDevicesData(void) {
|
|||
\*********************************************************************************************/
|
||||
void hibernateAllData(void) {
|
||||
if (Rtc.utc_time < START_VALID_TIME) { return; }
|
||||
if (zigbee_devices.devicesSize() == 0) { return; } // safe-guard, if data is empty, don't save anything
|
||||
Univ_Write_File f;
|
||||
const char * storage_class = PSTR("");
|
||||
|
||||
|
@ -242,9 +243,6 @@ void hibernateAllData(void) {
|
|||
#endif
|
||||
|
||||
if (f.valid()) {
|
||||
// first prefix is number of devices
|
||||
uint8_t device_num = zigbee_devices.devicesSize();
|
||||
|
||||
for (const auto & device : zigbee_devices.getDevices()) {
|
||||
// allocte a buffer for a single device
|
||||
SBuffer buf = hibernateDeviceData(device);
|
||||
|
|
|
@ -2177,8 +2177,10 @@ bool Xdrv23(uint8_t function)
|
|||
result = DecodeCommand(kZbCommands, ZigbeeCommand, kZbSynonyms);
|
||||
break;
|
||||
case FUNC_SAVE_BEFORE_RESTART:
|
||||
hibernateAllData();
|
||||
restoreDumpAllDevices();
|
||||
if (!zigbee.init_phase) {
|
||||
hibernateAllData();
|
||||
restoreDumpAllDevices();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue