mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
Merge pull request #108 from SyncrowIOT/add-battery-percentage-to-water-leak-device
finished added battery to water leak
This commit is contained in:
@ -12,4 +12,5 @@ export enum ProductType {
|
||||
THREE_3TG = '3GT',
|
||||
TWO_2TG = '2GT',
|
||||
ONE_1TG = '1GT',
|
||||
WL = 'WL',
|
||||
}
|
||||
|
@ -839,6 +839,19 @@ export class DeviceService {
|
||||
battery = batteryStatus.value;
|
||||
}
|
||||
}
|
||||
// Check if the device is a water leak sensor (WL)
|
||||
if (device.productDevice.prodType === ProductType.WL) {
|
||||
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