Pair device right away to prevent errors on prd update operations

This commit is contained in:
Sosthene 2025-09-03 15:11:07 +02:00
parent 80dc42bbe6
commit e320cfa193

View File

@ -366,15 +366,14 @@ export class Server {
if (!processId || !stateId) {
throw new Error('Failed to get process id or state id');
}
// now pair the device before continuing
service.pairDevice(processId, [service.getDeviceAddress()]);
await service.handleApiReturn(pairingResult);
const udpateResult = await service.createPrdUpdate(processId, stateId);
await service.handleApiReturn(udpateResult);
const approveResult = await service.approveChange(processId, stateId);
await service.handleApiReturn(approveResult);
// now pair the device
service.pairDevice(processId, [service.getDeviceAddress()]);
// Update the device in the database
const device = service.dumpDeviceFromMemory();
if (device) {