Update Accessories
This commit is contained in:
+11
-9
@@ -89,16 +89,18 @@ export class cameraAccessory extends accessory {
|
||||
.then((response) => {
|
||||
const devices = JSON.parse(response.body)
|
||||
|
||||
for (const device of devices.camera) {
|
||||
if (device.id == this.accessory.context.device.typeId) {
|
||||
if (device.motionstate == 'absent') {
|
||||
this.state.Motion = false
|
||||
} else { // present
|
||||
this.state.Motion = true
|
||||
if (devices.hasOwnProperty('camera')) {
|
||||
for (const device of devices.camera) {
|
||||
if (device.id == this.accessory.context.device.typeId) {
|
||||
if (device.motionstate == 'absent') {
|
||||
this.state.Motion = false
|
||||
} else { // present
|
||||
this.state.Motion = true
|
||||
}
|
||||
return this.state.Motion
|
||||
this.service.updateCharacteristic(this.platform.Characteristic.MotionDetected, this.state.Motion)
|
||||
break
|
||||
}
|
||||
return this.state.Motion
|
||||
this.service.updateCharacteristic(this.platform.Characteristic.MotionDetected, this.state.Motion)
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user