dirigera
Version:
A TypeScript client for IKEA's DIRIGERA smart home hub
56 lines (55 loc) • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (got) => {
return {
async list() {
return await got.get(`devices`).json();
},
async get({ id }) {
return await got.get(`devices/${id}`).json();
},
async setCustomName({ id, customName, }) {
await got
.patch(`devices/${id}`, {
json: [
{
attributes: {
customName,
},
},
],
})
.json();
},
async setAttributes({ id, attributes, transitionTime, }) {
await got
.patch(`devices/${id}`, {
json: [
{
attributes,
transitionTime,
},
],
})
.json();
},
async startIdentifying({ id }) {
await got
.put(`devices/${id}/identify`, {
json: {
period: 30,
},
})
.json();
},
async stopIdentifying({ id }) {
await got
.put(`devices/${id}/identify`, {
json: {
period: 0,
},
})
.json();
},
};
};