mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 18:27:05 +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',
|
||||
ONE_G = '1G',
|
||||
WH = 'WH',
|
||||
DS = 'DS',
|
||||
}
|
||||
|
@ -826,7 +826,19 @@ export class DeviceService {
|
||||
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 parentDevice = spaceDevice?.parent;
|
||||
return {
|
||||
|
Reference in New Issue
Block a user