mirror of
https://github.com/koush/scrypted.git
synced 2026-09-20 10:40:39 +01:00
plugins: IntrusionSensor changed to TamperSensor
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user