@koush/ring-client-api
Version:
Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting
27 lines (26 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnknownZWaveSwitchSwitch = void 0;
const base_device_accessory_1 = require("./base-device-accessory");
const hap_1 = require("./hap");
class UnknownZWaveSwitchSwitch extends base_device_accessory_1.BaseDeviceAccessory {
constructor(device, accessory, logger, config) {
super();
this.device = device;
this.accessory = accessory;
this.logger = logger;
this.config = config;
const { Characteristic, Service } = hap_1.hap;
this.registerCharacteristic({
characteristicType: Characteristic.On,
serviceType: Service.Switch,
getValue: (data) => Boolean(data.basicValue),
setValue: (value) => this.setOnState(value),
});
}
setOnState(on) {
this.logger.info(`Turning ${this.device.name} ${on ? 'On' : 'Off'}`);
return this.device.setInfo({ device: { v1: { basicValue: on ? 255 : 0 } } });
}
}
exports.UnknownZWaveSwitchSwitch = UnknownZWaveSwitchSwitch;