UNPKG

dirigera

Version:

A TypeScript client for IKEA's DIRIGERA smart home hub

18 lines (17 loc) 590 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = (got) => { return { async list() { const devices = await got.get(`devices`).json(); return devices.filter((d) => d.deviceType === 'openCloseSensor'); }, async get({ id }) { const device = await got.get(`devices/${id}`).json(); if (device.deviceType !== 'openCloseSensor') { throw new Error('The requested device is not an openCloseSensor'); } return device; }, }; };