-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
availability=offline after 5 minutes #4261
Comments
Can you provide your |
|
|
Yes, all devices come available after first message. In database.db all lastSeen is from old (several days) to very old (more than 2 monthes - looks like timestamp of joining). https://files.melda.ru/hidden/z2m/database_2020-09-05_23-49.db |
When a message is received from a device and you stop Zigbee2MQTT, is the |
Current database.db is binary equal to 1 hour old database.db (from link in my previous comment). With all old lastSeen - up to several monthes old for all perfectly wokring devices. |
1:12 - stop z2m and make database.db dump (lastSeen in this dump, as earlier, is very old) You can view diff between database.db dumps.
Full z2m log of this experiment. |
In updateLastSeen() {
this._lastSeen = Date.now();
} to updateLastSeen() {
this._lastSeen = Date.now();
console.log("Change lastSeen of " + this.ieeeAddr + " to " + this._lastSeen);
} Do the logged lastSeen matched the one in |
It's look like everything is ok in herdsman, but z2m addon do not update database.db at all, when stopping addon from HA. Experiment: z2m stopped, "last modified" timestamp of database.db - 0:05, and there is many very old lastSeen in it. 0:16 - run z2m by HA supervisor web-interface. 0:16-0:44 - near all devices send message and become online 0:47 - go into addon_7ad98f9c_zigbee2mqtt container and kill "node index.js" process 0:47-1:12 - near all devices send message (and zigbee2mqtt/bridge/config/devices/get reports actual lastSeen) 1:13 - stop z2m by HA supervisor web-interface |
Could you provide the log from the hassio page when stopping the zigbee2mqtt addon. Based on your report I conclude that the database is not updated when Zigbee2MQTT stops (which should be the case) |
That's all :( |
With #4261 (comment) , do you see the |
Yes, I see My way to do it it HA OS: root, go into z2m docker container, change file, and restart z2m by killing If your know better way to modify z2m addon on HA OS - please, tell me :) |
Good, in stop() {
return __awaiter(this, void 0, void 0, function* () {
console.log("START STOP");
for (const device of model_1.Device.all()) {
device.save();
}
for (const group of group_1.default.all()) {
group.save();
}
// Unregister adapter events
this.adapter.removeAllListeners(adapter_1.Events.Events.deviceJoined);
this.adapter.removeAllListeners(adapter_1.Events.Events.zclData);
this.adapter.removeAllListeners(adapter_1.Events.Events.rawData);
this.adapter.removeAllListeners(adapter_1.Events.Events.disconnected);
this.adapter.removeAllListeners(adapter_1.Events.Events.deviceAnnounce);
this.adapter.removeAllListeners(adapter_1.Events.Events.deviceLeave);
yield this.permitJoin(false);
clearInterval(this.backupTimer);
yield this.backup();
yield this.adapter.stop();
console.log("FINSIHED STOP");
});
} |
Docker log, when stopping addon:
Docker log, when killing node index.js:
|
So it seems we found our issue, when stopping the addon zigbee2mqtt is immediately terminated. Can you add some logging to function handleQuit() {
console.log('HANDLE QUIT!!');
if (!stopping) {
stopping = true;
controller.stop();
}
} |
Docker log, when stopping addon:
Docker log, when killing node index.js:
|
@danielwelch it seems that with |
@Koenkk, but what about any unexpected z2m stop? (any RPi crash: by power or any other) |
Good point! Will now save every hour which should solve your problem. Changes will be available in the latest dev branch in a few hours (https://www.zigbee2mqtt.io/how_tos/how-to-switch-to-dev-branch.html) |
I can confirm: edge addon now saves database.db every hour with actual lastSeen. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
Bug Report
What happened
When z2m start, it publish availability=online for all devices:
But exactly after 5 minutes, it publish offline for near all barrety powered devices:
I know about Availability - Non-pingable devices. But why dows this happen in 5 minutes after every z2m restart? How I can prevent this?
What did you expect to happen
Battery devices become unavailable, when no message has been received from them for 25 hours. But not every z2m restart.
How to reproduce it (minimal and precise)
Set availability_timeout and restart z2m, I think.
Debug Info
Zigbee2MQTT version: 1.14.4 (HA addon)
Adapter hardware: cc2530 (gban)
Adapter firmware version: CC2530_SOURCE_ROUTING_20190619
The text was updated successfully, but these errors were encountered: