mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 13:46:37 +00:00
Zigbee save data to EEPROM every hour
This commit is contained in:
parent
6c41a4158a
commit
25fd163e54
@ -227,4 +227,22 @@ void hibernateAllData(void) {
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Timer to save every 60 minutes
|
||||
\*********************************************************************************************/
|
||||
const uint32_t Z_SAVE_DATA_TIMER = 60 * 60 * 1000; // save data every 60 minutes (in ms)
|
||||
|
||||
//
|
||||
// Callback for setting the timer to save Zigbee Data in x seconds
|
||||
//
|
||||
int32_t Z_Set_Save_Data_Timer(uint8_t value) {
|
||||
zigbee_devices.setTimer(0x0000, 0, Z_SAVE_DATA_TIMER, 0, 0, Z_CAT_ALWAYS, 0 /* value */, &Z_SaveDataTimer);
|
||||
return 0; // continue
|
||||
}
|
||||
|
||||
void Z_SaveDataTimer(uint16_t shortaddr, uint16_t groupaddr, uint16_t cluster, uint8_t endpoint, uint32_t value) {
|
||||
hibernateAllData();
|
||||
Z_Set_Save_Data_Timer(0); // set a new timer
|
||||
}
|
||||
|
||||
#endif // USE_ZIGBEE
|
||||
|
@ -870,6 +870,7 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = {
|
||||
ZI_CALL(&Z_Prepare_EEPROM, 0)
|
||||
ZI_CALL(&Z_Load_Devices, 0)
|
||||
ZI_CALL(&Z_Load_Data, 0)
|
||||
ZI_CALL(&Z_Set_Save_Data_Timer, 0)
|
||||
ZI_CALL(&Z_Query_Bulbs, 0)
|
||||
|
||||
ZI_LABEL(ZIGBEE_LABEL_MAIN_LOOP)
|
||||
|
Loading…
x
Reference in New Issue
Block a user