UNPKG

homebridge-deconz-converter

Version:

Homebridge plugin for converting Deconz roller shutters interpreted as light into Homekit Window Covering type.

31 lines 1.12 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const axios_1 = __importDefault(require("axios")); class HttpClient { constructor(host, useHTTPS, apiKey) { const protocol = useHTTPS ? 'https://' : 'http://'; this.httpClient = axios_1.default.create({ baseURL: `${protocol}${host}/api/${apiKey}`, headers: { 'accept': 'application/json', }, }); } async getLightByUniqueId(uniqueId) { return this.httpClient.get(`/lights/${uniqueId}`); } async updateLightBrightness(bri, uniqueId) { return this.httpClient.put(`/lights/${uniqueId}/state`, { bri }); } async setLightOn(uniqueId) { return this.httpClient.put(`/lights/${uniqueId}/state`, { on: true }); } async getSensorState(uniqueId) { return this.httpClient.get(`/sensors/${uniqueId}`); } } exports.default = HttpClient; //# sourceMappingURL=httpClient.js.map