Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf5c1eb7

Browse files
author
Stefan Kuper
committed
Trigger motion sensor on person events
1 parent7a30488 commitf5c1eb7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

‎accessory/camera-accessory.js‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ module.exports = function(pHomebridge) {
6161
varevents=accessoryData.events;
6262

6363
varnewLastEventTimeStamp=this.lastEventTimeStamp;
64-
64+
6565
result.motionDetected=false;
6666

6767
if(events){
68-
events.forEach(function(event){
68+
events.forEach(function(event){
6969
if(event.time>newLastEventTimeStamp){
7070
newLastEventTimeStamp=event.time;
7171
}
7272
if(event.time>this.lastEventTimeStamp){
73-
result.motionDetected=result.motionDetected||event.type=='movement'
73+
result.motionDetected=result.motionDetected||this.eventIsMotion(event)
7474
}
7575
}.bind(this));
7676
this.lastEventTimeStamp=newLastEventTimeStamp;
@@ -79,6 +79,16 @@ module.exports = function(pHomebridge) {
7979
returnresult;
8080
}
8181

82+
eventIsMotion(event){
83+
if(event.type=='movement'){
84+
returntrue;
85+
}
86+
if(event.type=='person'){
87+
returntrue;
88+
}
89+
returnfalse;
90+
}
91+
8292
applyHomeData(homeData){
8393
vardataChanged=false
8494

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp