homebridge-http-motion-sensor
Version:
Homebridge plugin for a remote motion sensor based on http
24 lines (23 loc) • 1.2 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.platformConfigSchema = exports.sensorConfigSchema = exports.repeaterEntrySchema = void 0;
const zod_1 = require("zod");
exports.repeaterEntrySchema = zod_1.z.object({
host: zod_1.z.string().min(1, 'Host is required'),
port: zod_1.z.coerce.number().int().min(1).max(65535, 'Port must be between 1 and 65535'),
path: zod_1.z.string().min(1, 'Path is required'),
auth: zod_1.z.string().optional(),
});
exports.sensorConfigSchema = zod_1.z.object({
name: zod_1.z.string().min(1, 'Sensor name is required'),
port: zod_1.z.coerce.number().int().min(1024, 'Port must be at least 1024').max(65535, 'Port must be at most 65535'),
model: zod_1.z.string().optional(),
serial: zod_1.z.string().optional(),
bind_ip: zod_1.z.string().ip().optional().or(zod_1.z.literal('0.0.0.0')),
repeater: zod_1.z.array(exports.repeaterEntrySchema).optional(),
});
exports.platformConfigSchema = zod_1.z.object({
name: zod_1.z.string().min(1, 'Platform name is required'),
platform: zod_1.z.literal('HttpMotionSensorPlatform'),
sensors: zod_1.z.array(exports.sensorConfigSchema).optional(),
});
;