MCPcopy
hub / github.com/Koenkk/zigbee2mqtt / save

Method save

lib/state.ts:93–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 }
92
93 private save(): void {
94 if (settings.get().advanced.cache_state_persistent) {
95 logger.debug(`Saving state to file ${this.file}`);
96
97 const json = JSON.stringify(Object.fromEntries(this.state), null, 4);
98
99 try {
100 writeFileSync(this.file, json, "utf8");
101 } catch (error) {
102 logger.error(`Failed to write state to '${this.file}' (${error})`);
103 }
104 } else {
105 logger.debug("Not saving state");
106 }
107 }
108
109 exists(entity: Device | Group): boolean {
110 return this.state.has(entity.ID);

Callers 8

startMethod · 0.95
stopMethod · 0.95
#updateMethod · 0.80
onReconfigureMethod · 0.80
startMethod · 0.80
configureMethod · 0.80
onMQTTMessageFunction · 0.80
controller.test.tsFile · 0.80

Calls 3

getMethod · 0.80
debugMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected