Skip to content

Commit

Permalink
compiled javascript now in npm published package & less !!! in logging
Browse files Browse the repository at this point in the history
Also removed some images (and made sure others are not in the npm package)
  • Loading branch information
Kevin Van den Abeele committed May 12, 2020
1 parent 8d638e7 commit 7181907
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.DS_Store
.idea
.travis.yml
*.iml
.git/
.travis.yml

dist/
coverage/
resources/test-config
resources/images/readme/*
src/experimental
*.js
*.js.map
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ Consult the documentation for more details: [FFmpeg configuration](https://githu
- ***Make sure the fields `source` and `stillImageSource` are omitted from the config object as these will be generated by the plugin itself!***
- Make sure that your Unifi camera has anonymous snapshots enabled and that preferably only one RTSP stream is enabled, otherwise it might not work correctly!
- To enable anonymous snapshots: Login on the camera itself (visit the camera's ip address) <br/>
![Anonymous snapshot](resources/images/anonymous_snapshot.jpg?raw=true "CloudKey Gen2 Plus")
![Anonymous snapshot](resources/images/readme/anonymous_snapshot.jpg?raw=true "CloudKey Gen2 Plus")
- To enable an RTSP stream: Login on the Protect web UI and go the settings of the camera and open the manage tab<br/>
Make sure that all your cameras have the same port for the RTSP stream!
For optimal results it is best to assign a static ip to your cameras <br/>
![Enable RTSP stream](resources/images/enable_rtsp.jpg?raw=true "CloudKey Gen2 Plus")
![Enable RTSP stream](resources/images/readme/enable_rtsp.jpg?raw=true "CloudKey Gen2 Plus")

## How to add the cameras to your Homekit setup:

Expand All @@ -148,11 +148,11 @@ The enumerated cameras (and the motion sensors) will not show up automatically,
- Raspberry Pi 4B 4GB with Node 12.14.0 as Homebridge host
- Macbook Pro with Node 12.13.1 as Homebridge host
- Ubiquiti UniFi CloudKey Gen2 Plus - Cloud Key with Unifi Protect functionality
<br/><br/>![CloudKey Gen2 Plus](resources/images/cloudkey-gen2plus.jpg?raw=true "CloudKey Gen2 Plus")
<br/><br/>![CloudKey Gen2 Plus](resources/images/readme/cloudkey-gen2plus.jpg?raw=true "CloudKey Gen2 Plus")
- 2x Ubiquiti UniFi Video UVC-G3-AF - PoE Camera
<br/><br/>![Camera UVC-G3-AF](resources/images/camera.jpeg?raw=true "Camera UVC-G3-AF")
<br/><br/>![Camera UVC-G3-AF](resources/images/readme/camera.jpeg?raw=true "Camera UVC-G3-AF")
- 2x Ubiquiti Unifi Video UVC-G3-Flex - PoE Camera
<br/><br/>![Camera UVC-G3-Flex](resources/images/camera2.jpeg?raw=true "Camera UVC-G3-Flex")
<br/><br/>![Camera UVC-G3-Flex](resources/images/readme/camera2.jpeg?raw=true "Camera UVC-G3-Flex")

## Limitations, known issues & TODOs:

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "homebridge-unifi-protect-camera-motion",
"version": "0.2.3",
"version": "0.2.4",
"description": "Unifi Protect cameras & motion sensors for Homekit with Homebridge",
"main": "src/index.js",
"scripts": {
"postinstall": "npm rebuild @tensorflow/tfjs-node --build-from-source & node --max-old-space-size=1024 ./node_modules/typescript/lib/tsc.js",
"postinstall": "npm rebuild @tensorflow/tfjs-node --build-from-source",
"compile": "node --max-old-space-size=1024 ./node_modules/typescript/lib/tsc.js",
"homebridge": "tsc && homebridge -P . -U ./resources/test-config/",
"test": "jest --config jest.config.js --collect-coverage"
Expand Down
Binary file removed resources/images/city_street.jpg
Binary file not shown.
Binary file removed resources/images/people-to-people.jpg
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
6 changes: 3 additions & 3 deletions src/motion/motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class MotionDetector {
return;
}

this.logInfo('!!!! Motion detected (' + motionEvent.score + '%) by camera ' + motionEvent.camera.name + ' !!!!');
this.logInfo('Motion detected (' + motionEvent.score + '%) by camera ' + motionEvent.camera.name + ' !!!!');
configuredAccessory.getService(this.homebridge.hap.Service.MotionSensor).setCharacteristic(this.homebridge.hap.Characteristic.MotionDetected, 1);

let snapshot: Image;
Expand Down Expand Up @@ -138,12 +138,12 @@ export class MotionDetector {

const score: number = Math.round(detection.score * 100);
if (score >= this.unifiConfig.enhanced_motion_score) {
this.logInfo('!!!! ' + classToDetect + ' detected (' + score + '%) by camera ' + motionEvent.camera.name + ' !!!!');
this.logInfo(classToDetect + ' detected (' + score + '%) by camera ' + motionEvent.camera.name + ' !!!!');
configuredAccessory.getService(this.homebridge.hap.Service.MotionSensor).setCharacteristic(this.homebridge.hap.Characteristic.MotionDetected, 1);
await this.persistSnapshot(snapshot, classToDetect + ' detected (' + score + '%) by camera ' + motionEvent.camera.name, [detection]);
continue outer;
} else {
this.logDebug('!!!! Detected class: ' + detection.class + ' rejected due to score: ' + score + '% (must be ' + this.unifiConfig.enhanced_motion_score + '% or higher) !!!!');
this.logDebug('Detected class: ' + detection.class + ' rejected due to score: ' + score + '% (must be ' + this.unifiConfig.enhanced_motion_score + '% or higher)');
}
} else {
this.logDebug('None of the required classes found by enhanced motion detection, discarding!');
Expand Down
4 changes: 2 additions & 2 deletions src/unifi/unifi-flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export class UnifiFlows {
for (const motionEvent of motionEvents) {
if (camera.id === motionEvent.cameraId) {
if (motionEvent.score >= this.config.motion_score) {
this.log('!!!! Unifi Motion event (' + motionEvent.id + ') accepted for camera: ' + camera.name + ' - Score: ' + motionEvent.score + ' !!!!');
this.log('Unifi Motion event (' + motionEvent.id + ') accepted for camera: ' + camera.name + ' - Score: ' + motionEvent.score);
motionEvent.camera = camera;
filteredMotionEvents.push(motionEvent);
} else {
this.log('!!!! Unifi Motion event (' + motionEvent.id + ') rejected for camera: ' + camera.name + ' - Score: ' + motionEvent.score + ' !!!!');
this.log('Unifi Motion event (' + motionEvent.id + ') rejected for camera: ' + camera.name + ' - Score: ' + motionEvent.score);
}
continue outer;
}
Expand Down

0 comments on commit 7181907

Please sign in to comment.