homebridge-calypshome
Version:
Homebridge plugin for Calyps'Home
26 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RollingShutter = void 0;
class RollingShutter {
id;
actions;
name;
angle;
level;
manufacturerName;
serialNumber;
constructor(data) {
this.id = data.id;
this.name = data.name;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.actions = data.actions.filter((a) => a !== 'SCAN');
const angle = data.status.find((s) => s.name === 'angle')?.value;
this.angle = typeof angle === 'string' ? Number(angle) : undefined;
const level = data.status.find((s) => s.name === 'level')?.value;
this.level = typeof level === 'string' ? Number(level) : undefined;
this.manufacturerName = data.status?.find((c) => c.name === 'manufacturer_name')?.value ?? 'n/a';
this.serialNumber = this.id.replace(/^.*IEEEAddr-(.*):.*$/, '$1');
}
}
exports.RollingShutter = RollingShutter;
//# sourceMappingURL=rollingShutter.js.map