Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eduardoramirez/homebridge-dwelo

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eduardoramirez/homebridge-dwelo - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

4

dist/DweloAPI.d.ts

@@ -30,3 +30,5 @@ import { AxiosResponse } from 'axios';

sensor(deviceId: number): Promise<Sensor | undefined>;
toggleSwitch(on: boolean, id: number): Promise<AxiosResponse<unknown, any>>;
toggleSwitch(on: boolean, id: number): Promise<AxiosResponse<{
command: string;
}, any>>;
private request;

@@ -33,0 +35,0 @@ }

@@ -14,7 +14,17 @@ "use strict";

async devices() {
const response = await this.request(`/v3/device?gatewayId=${this.gatewayID}&limit=5000&offset=0`);
const response = await this.request('/v3/device', {
params: {
gatewayId: this.gatewayID,
limit: 5000,
offset: 0,
},
});
return response.data.results;
}
async sensor(deviceId) {
const response = await this.request(`/v3/sensor/gatewayId/${this.gatewayID}/?deviceId=${deviceId}`);
const response = await this.request(`v3/sensor/gateway/${this.gatewayID}/`, {
params: {
deviceId,
},
});
return response.data.results[0];

@@ -25,10 +35,11 @@ }

method: 'POST',
body: { 'command': on ? 'on' : 'off' },
data: { 'command': on ? 'on' : 'off' },
});
}
async request(path, { headers, method, body } = {}) {
async request(path, { headers, method, data, params } = {}) {
const response = await (0, axios_1.default)({
url: 'https://api.dwelo.com' + path,
method: method !== null && method !== void 0 ? method : 'GET',
data: body,
params,
data,
headers: {

@@ -35,0 +46,0 @@ ...headers,

@@ -10,20 +10,14 @@ "use strict";

this.switchService.getCharacteristic(hap.Characteristic.On)
.on("get" /* GET */, (callback) => {
dweloAPI.sensor(lightID)
.then(sensor => {
const isOn = (sensor === null || sensor === void 0 ? void 0 : sensor.value) === 'on';
log.debug(`Current state of the switch was returned: ${isOn ? 'ON' : 'OFF'}`);
callback(undefined, isOn);
})
.catch(callback);
.onGet(async () => {
const sensor = await dweloAPI.sensor(lightID);
log.debug('sensor returned: %s. ', sensor);
const isOn = (sensor === null || sensor === void 0 ? void 0 : sensor.value) === 'on';
log.debug(`Current state of the switch was returned: ${isOn ? 'ON' : 'OFF'}`);
return isOn;
})
.on("set" /* SET */, (value, callback) => {
dweloAPI.toggleSwitch(value, lightID)
.then(() => {
log.debug(`Switch state was set to: ${value ? 'ON' : 'OFF'}`);
callback();
})
.catch(callback);
.onSet(async (value) => {
await dweloAPI.toggleSwitch(value, lightID);
log.debug(`Switch state was set to: ${value ? 'ON' : 'OFF'}`);
});
log.info(`Dwelo LightBulb '${name}' created!`);
log.info(`Dwelo LightBulb '${name} ' created!`);
}

@@ -30,0 +24,0 @@ /*

@@ -24,3 +24,3 @@ "use strict";

this.log.warn(`Support for Dwelo accessory type: ${d.deviceType} is not implemented`);
this.log.warn(`${d}`);
this.log.warn('%s', d);
return null;

@@ -27,0 +27,0 @@ }

{
"displayName": "Homebridge Dwelo Plugin",
"name": "@eduardoramirez/homebridge-dwelo",
"version": "1.0.2",
"version": "1.0.3",
"description": "Adds support for Dwelo accessories to Homebridge.",

@@ -6,0 +6,0 @@ "license": "Apache-2.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc