UNPKG

homebridge-gsh

Version:
50 lines 2.4 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TemperatureSensor = void 0; const hap_types_1 = require("../hap-types"); const ghToHapTypes_1 = require("./ghToHapTypes"); class TemperatureSensor extends ghToHapTypes_1.ghToHap { constructor(hap) { super(); this.hap = hap; } sync(service) { return this.createSyncData(service, { type: 'action.devices.types.SENSOR', traits: [ 'action.devices.traits.TemperatureControl', ], attributes: { queryOnlyTemperatureControl: true, temperatureUnitForUX: this.hap.config.forceFahrenheit ? 'F' : 'C', }, }); } query(service) { var _a, _b; return { online: true, temperatureSetpointCelsius: (_a = service.serviceCharacteristics.find(x => x.uuid === hap_types_1.Characteristic.CurrentTemperature)) === null || _a === void 0 ? void 0 : _a.value, temperatureAmbientCelsius: (_b = service.serviceCharacteristics.find(x => x.uuid === hap_types_1.Characteristic.CurrentTemperature)) === null || _b === void 0 ? void 0 : _b.value, }; } execute(service, command) { return __awaiter(this, void 0, void 0, function* () { if (!command.execution.length) { return { ids: [service.uniqueId], status: 'ERROR', debugString: 'missing command' }; } return { ids: [service.uniqueId], status: 'ERROR', debugString: `unknown command ${command.execution[0].command}` }; }); } } exports.TemperatureSensor = TemperatureSensor; //# sourceMappingURL=temperature-sensor.js.map