plugins: IntrusionSensor changed to TamperSensor

This commit is contained in:
Koushik Dutta
2022-06-28 21:53:18 -07:00
parent 8579a9f561
commit e7d2b86be1
3 changed files with 9 additions and 9 deletions

View File

@@ -153,8 +153,8 @@ export abstract class RtspSmartCamera extends RtspCamera {
this.motionDetected = false;
if (this.interfaces.includes(ScryptedInterface.AudioSensor))
this.audioDetected = false;
if (this.interfaces.includes(ScryptedInterface.IntrusionSensor))
this.intrusionDetected = false;
if (this.interfaces.includes(ScryptedInterface.TamperSensor))
this.tampered = false;
if (this.interfaces.includes(ScryptedInterface.BinarySensor))
this.binaryState = false;
}

View File

@@ -1,15 +1,14 @@
import { IntrusionSensor } from "@scrypted/sdk";
import { ValueID } from "@zwave-js/core";
import { TamperSensor } from "@scrypted/sdk";
import { ZWaveNodeValueUpdatedArgs } from "zwave-js";
import { Notification } from "./Notification";
import { containsAny, ZwaveDeviceBase } from "./ZwaveDeviceBase";
import { ZwaveDeviceBase } from "./ZwaveDeviceBase";
export class IntrusionSensorToHomeSecurity extends Notification implements IntrusionSensor {
export class TamperSensorToHomeSecurity extends Notification implements TamperSensor {
static updateState(zwaveDevice: ZwaveDeviceBase, valueId: ZWaveNodeValueUpdatedArgs) {
const notification = Notification.lookupNotification(zwaveDevice, 'Home Security');
const value = notification.lookupValue(valueId.newValue as number);
// unset with any noninstrusion value
zwaveDevice.intrusionDetected = !!value;
zwaveDevice.tampered = !!value;
}
}

View File

@@ -16,10 +16,11 @@ import { NotificationType } from './Notification';
import { EntrySensorToAccessControl } from './EntrySensorToAccessControl';
import { FloodSensorToWaterAlarm } from './FloodSensorToWaterAlarm';
import { PasswordStoreToUserCode } from './PasswordStoreToUserCode';
import { IntrusionSensorToHomeSecurity } from './IntrusionSensorToHomeSecurity';
import { TamperSensorToHomeSecurity } from './TamperSensorToHomeSecurity';
import { PowerSensorToPowerManagement } from './PowerSensorToPowerManagement';
import { ZWaveNode } from 'zwave-js';
import {CommandClasses, ValueID} from '@zwave-js/core'
import { ScryptedInterface } from '@scrypted/sdk';
var CommandClassMap: {[ccId: string]: CommandClassInfo} = {};
@@ -85,7 +86,7 @@ addCommandClassIndex(CommandClasses['Multilevel Sensor'], 'Ultraviolet', Ultravi
addCommandClassIndex(CommandClasses['Notification'], 'Access Control', EntrySensorToAccessControl, 'EntrySensor');
addCommandClassIndex(CommandClasses['Notification'], 'Water Alarm', FloodSensorToWaterAlarm, 'FloodSensor');
addCommandClassIndex(CommandClasses['Notification'], 'Home Security', IntrusionSensorToHomeSecurity, 'IntrusionSensor');
addCommandClassIndex(CommandClasses['Notification'], 'Home Security', TamperSensorToHomeSecurity, ScryptedInterface.TamperSensor);
addCommandClassIndex(CommandClasses['Notification'], 'Power Management', PowerSensorToPowerManagement, 'PowerSensor');
addCommandClassIndex(CommandClasses['Barrier Operator'], 'currentState', EntryToBarrierOperator, 'Entry');