Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ This feature only works when map creation is enabled in the adapter options. Ope
### **WORK IN PROGRESS**

* (copystring) Fixed missing auto-empty command for Roborock Qrevo MaxV (#1272).
* (copystring) Fixed local endpoint refresh after temporary MQTT outages so stale local IP recovery retries immediately again.
* (copystring) Require bug reports to upload a `.txt` debug log file.

### 0.7.1 (2026-05-19)
Expand Down
31 changes: 31 additions & 0 deletions src/lib/localApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,35 @@ describe("local_api transport sequence", () => {
expect(requests).to.deep.equal([{ method: "service.get_net_info", params: {} }]);
expect(api.localDevices[duid].ip).to.equal("10.1.1.90");
});

it("does not throttle the next endpoint refresh after MQTT was temporarily unavailable", async () => {
const duid = "duid";
const adapter = new MockAdapter() as any;
const api = new local_api(adapter);
const requests: string[] = [];
let mqttConnected = false;

adapter.mqtt_api = { isConnected: () => mqttConnected };
adapter.requestsHandler = {
sendRequest: async (_duid: string, method: string) => {
requests.push(method);
return [{ ip: "10.1.1.91" }];
},
rejectPendingTcpRequests: () => 0,
};
adapter.getDeviceProtocolVersion = async () => "1.0";
api.initiateClient = async () => {};
api.localDevices[duid] = {
ip: "10.1.1.81",
version: "1.0",
staleSince: 100,
};

await expect(api.refreshEndpoint(duid, "mqtt down", false)).resolves.to.equal(false);
mqttConnected = true;
await expect(api.refreshEndpoint(duid, "mqtt back", false)).resolves.to.equal(true);

expect(requests).to.deep.equal(["get_network_info"]);
expect(api.localDevices[duid].ip).to.equal("10.1.1.91");
});
});
6 changes: 6 additions & 0 deletions src/lib/localApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,12 @@ export class local_api {
}

const promise = this.refreshEndpointInternal(duid, reason)
.then((refreshed) => {
if (!refreshed && (!this.adapter.requestsHandler?.sendRequest || !this.adapter.mqtt_api?.isConnected?.())) {
this.endpointRefreshLastStartedAt.delete(duid);
}
return refreshed;
})
.finally(() => {
this.endpointRefreshPromises.delete(duid);
});
Expand Down
Loading