@k-roon/homebridge-hejhome-ir
Version:
Homebridge plugin for Hejhome IR devices.
18 lines • 803 B
JavaScript
import { IrBaseAccessory } from './IrBaseAccessory.js';
export class IrLampAccessory extends IrBaseAccessory {
constructor(platform, accessory, device) {
super(platform, accessory, device, 'Lightbulb');
const { Characteristic } = this.platform.api.hap;
this.service.getCharacteristic(Characteristic.On)
.onSet(this.setPowerState.bind(this))
.onGet(() => false);
this.service.getCharacteristic(Characteristic.Brightness)
.setProps({ minValue: 0, maxValue: 100, minStep: 100 }) // 0 또는 100
.onSet((v) => this.setPowerState(v > 0))
.onGet(() => 0);
}
async setPowerState(power) {
await this.sendCommand("power", power ? 'true' : 'false');
}
}
//# sourceMappingURL=IrLampAccessory.js.map