diff --git a/plugins/reolink/src/main.ts b/plugins/reolink/src/main.ts index 8e30e43533..392450de12 100644 --- a/plugins/reolink/src/main.ts +++ b/plugins/reolink/src/main.ts @@ -91,7 +91,7 @@ class ReolinkCamera extends RtspSmartCamera implements Camera, Reboot, Intercom, } try { - const ai: AIState = this.storageSettings.values.hasObjectDetector[0]?.value; + const ai: AIState = this.storageSettings.values.hasObjectDetector?.value; const classes: string[] = []; for (const key of Object.keys(ai)) { @@ -204,6 +204,8 @@ class ReolinkCamera extends RtspSmartCamera implements Camera, Reboot, Intercom, if (!classes.length) return; + this.storageSettings.values.hasObjectDetector = ai; + hasSucceeded = true; const od: ObjectsDetected = { timestamp: Date.now(), diff --git a/plugins/reolink/src/reolink-api.ts b/plugins/reolink/src/reolink-api.ts index 2047260855..9ddc9434ab 100644 --- a/plugins/reolink/src/reolink-api.ts +++ b/plugins/reolink/src/reolink-api.ts @@ -122,7 +122,7 @@ export class ReolinkCameraClient { responseType: 'json', }); return { - value: response.body?.[0]?.value as AIState, + value: (response.body?.[0]?.value || response.body?.value) as AIState, data: response.body, }; }