Skip to content

Commit

Permalink
feat: enable or disable frigate mqtt topic snapshot processing (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakowenko committed Sep 2, 2021
1 parent 5892077 commit 3bf2bea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ detectors:
| frigate.url | | Base URL for Frigate |
| frigate.attempts.latest | `10` | Amount of times API will request a Frigate `latest.jpg` for facial recognition |
| frigate.attempts.snapshot | `0` | Amount of times API will request a Frigate `snapshot.jpg` for facial recognition |
| frigate.attempts.mqtt | `true` | Process Frigate images from `frigate/+/person/snapshot` topics |
| frigate.image.height | `500` | Height of Frigate image passed for facial recognition |
| frigate.cameras | | Only process images from specific cameras |
| frigate.zones | | Only process images from specific zones |
Expand Down
2 changes: 1 addition & 1 deletion api/src/constants/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
},
time: { timezone: 'UTC' },
frigate: {
attempts: { latest: 10, snapshot: 0 },
attempts: { latest: 10, snapshot: 0, mqtt: true },
image: { height: 500 },
},
purge: {
Expand Down
11 changes: 6 additions & 5 deletions api/src/util/mqtt.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ module.exports.subscribe = () => {
topics.push(...frigateTopics);
frigateTopics.forEach((topic) => {
const [prefix] = topic.split('/');
topics.push(
...(FRIGATE.CAMERAS
? FRIGATE.CAMERAS.map((camera) => `${prefix}/${camera}/person/snapshot`)
: [`${prefix}/+/person/snapshot`])
);
if (FRIGATE.ATTEMPTS.MQTT === true)
topics.push(
...(FRIGATE.CAMERAS
? FRIGATE.CAMERAS.map((camera) => `${prefix}/${camera}/person/snapshot`)
: [`${prefix}/+/person/snapshot`])
);
});
}

Expand Down

0 comments on commit 3bf2bea

Please sign in to comment.