@k-roon/homebridge-hejhome-ir
Version:
Homebridge plugin for Hejhome IR devices.
31 lines • 1.01 kB
JavaScript
import { postIrCommand } from '../api/control.js';
import { Base } from './base.js';
export class IrBaseAccessory extends Base {
platform;
accessory;
device;
log;
service;
constructor(platform, accessory, device, serviceType) {
super();
this.platform = platform;
this.accessory = accessory;
this.device = device;
this.log = platform.log;
const { Service } = platform.api.hap;
this.service =
accessory.getService(serviceType) ??
accessory.addService(Service[serviceType], device.name);
}
/** commandName·value를 받아 API 호출 */
async sendCommand(commandName, value) {
try {
await postIrCommand(this.platform, this.device.id, commandName, value);
this.log.info(`${this.device.name} → ${commandName}:${value}`);
}
catch (e) {
this.log.error('IR 전송 실패:', e);
}
}
}
//# sourceMappingURL=IrBaseAccessory.js.map