homebridge-virtual-accessories
Version:
Virtual HomeKit accessories for Homebridge.
29 lines • 935 B
JavaScript
/* eslint-disable curly */
import { SensorType, TriggerType } from './schema.js';
import { Utils } from '../utils/utils.js';
/**
*
*/
export class SensorConfiguration {
type;
trigger;
errorFields = [];
fieldNames = Utils.proxiedPropertiesOf(this);
isValid(prefix) {
const isValidType = (Utils.required(this.type) &&
SensorType.Types.includes(this.type));
const isValidTrigger = (Utils.required(this.trigger) &&
TriggerType.Types.includes(this.trigger));
// Store fields failing validation
if (!isValidType)
this.errorFields.push(prefix + '.' + this.fieldNames.type);
if (!isValidTrigger)
this.errorFields.push(prefix + '.' + this.fieldNames.trigger);
return [
(isValidType &&
isValidTrigger),
this.errorFields,
];
}
}
//# sourceMappingURL=configurationSensor.js.map