UNPKG

@homebridge-plugins/homebridge-smarthq

Version:

The SmartHQ plugin allows you to interact with SmartHQ Devices in HomeKit and with Siri.

75 lines 3.23 kB
import { deviceBase } from './device.js'; export class SmartHQAdvantium extends deviceBase { platform; device; constructor(platform, accessory, device) { super(platform, accessory, device); this.platform = platform; this.device = device; this.debugLog(`Advantium Features: ${JSON.stringify(accessory.context.device.features)}`); // Advantium Light const light = this.accessory.getService('Advantium Light') ?? this.accessory.addService(this.platform.Service.Lightbulb, 'Advantium Light', 'AdvantiumLight'); light.setCharacteristic(this.platform.Characteristic.Name, 'Advantium Light'); light .getCharacteristic(this.platform.Characteristic.On) .onGet(async () => { try { // TODO: Implement light state ERD return false; } catch (error) { this.warnLog?.(`Advantium Light error: ${error?.message ?? error}`); return false; } }) .onSet(async (value) => { try { // TODO: Implement light control ERD this.debugLog(`Advantium Light set to: ${value}`); } catch (error) { this.warnLog?.(`Advantium Light set error: ${error?.message ?? error}`); } }); // Advantium Temperature Sensor const tempSensor = this.accessory.getService('Advantium Temperature') ?? this.accessory.addService(this.platform.Service.TemperatureSensor, 'Advantium Temperature', 'AdvantiumTemp'); tempSensor.setCharacteristic(this.platform.Characteristic.Name, 'Advantium Temperature'); tempSensor .getCharacteristic(this.platform.Characteristic.CurrentTemperature) .onGet(async () => { try { // TODO: Implement current temperature ERD return 0; } catch (error) { this.warnLog?.(`Advantium Temperature error: ${error?.message ?? error}`); return 0; } }); // Advantium Running State (Switch) const runningSwitch = this.accessory.getService('Advantium Running') ?? this.accessory.addService(this.platform.Service.Switch, 'Advantium Running', 'AdvantiumRunning'); runningSwitch.setCharacteristic(this.platform.Characteristic.Name, 'Advantium Running'); runningSwitch .getCharacteristic(this.platform.Characteristic.On) .onGet(async () => { try { // TODO: Implement running state ERD return false; } catch (error) { this.warnLog?.(`Advantium Running error: ${error?.message ?? error}`); return false; } }) .onSet(async (value) => { try { // TODO: Implement running control ERD this.debugLog(`Advantium Running set to: ${value}`); } catch (error) { this.warnLog?.(`Advantium Running set error: ${error?.message ?? error}`); } }); } } //# sourceMappingURL=advantium.js.map