Update Accessories

This commit is contained in:
2025-03-03 14:27:52 +01:00
parent 90c728a2be
commit e9459044a0
8 changed files with 102 additions and 124 deletions
+13 -10
View File
@@ -87,16 +87,19 @@ export class motionSensorAccessory extends accessory {
.then((response) => {
const devices = JSON.parse(response.body)
for (const device of devices.motion) {
if (device.id == this.accessory.context.device.typeId) {
if (device.state == 'absent') {
this.state.Motion = false
} else { // present
this.state.Motion = true
if (devices.hasOwnProperty('motion')) {
for (const device of devices.motion) {
if (device.id == this.accessory.context.device.typeId) {
if (device.state == 'absent') {
this.state.Motion = false
} else { // present
this.state.Motion = true
}
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
}
}
})
@@ -108,4 +111,4 @@ export class motionSensorAccessory extends accessory {
getState(): CharacteristicValue {
return this.state.Motion
}
}
}