mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
finished add battery value for the door sensor device
This commit is contained in:
@ -8,4 +8,5 @@ export enum ProductType {
|
|||||||
TWO_G = '2G',
|
TWO_G = '2G',
|
||||||
ONE_G = '1G',
|
ONE_G = '1G',
|
||||||
WH = 'WH',
|
WH = 'WH',
|
||||||
|
DS = 'DS',
|
||||||
}
|
}
|
||||||
|
@ -826,7 +826,19 @@ export class DeviceService {
|
|||||||
battery = batteryStatus.value;
|
battery = batteryStatus.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Check if the device is a door sensor (DS)
|
||||||
|
if (device.productDevice.prodType === ProductType.DS) {
|
||||||
|
const doorSensorInstructionsStatus =
|
||||||
|
await this.getDevicesInstructionStatus(device.uuid);
|
||||||
|
|
||||||
|
const batteryStatus: any = doorSensorInstructionsStatus.status.find(
|
||||||
|
(status: any) => status.code === 'battery_percentage',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (batteryStatus) {
|
||||||
|
battery = batteryStatus.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
const spaceDevice = device?.spaceDevice;
|
const spaceDevice = device?.spaceDevice;
|
||||||
const parentDevice = spaceDevice?.parent;
|
const parentDevice = spaceDevice?.parent;
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user