Skip to content

Commit

Permalink
reolink: save GetAiState to hasObjectDetector so object detector can …
Browse files Browse the repository at this point in the history
…work (#1497)
  • Loading branch information
gtalusan authored Jun 15, 2024
1 parent e779f37 commit 528885d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion plugins/reolink/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion plugins/reolink/src/reolink-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
Expand Down

0 comments on commit 528885d

Please sign in to comment.