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.8 to 1.0.9

2

dist/DweloAPI.d.ts

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

}
interface Sensor {
export interface Sensor {
deviceId: number;

@@ -19,0 +19,0 @@ gatewayId: number;

@@ -10,2 +10,3 @@ import { AccessoryPlugin, API, Logging, Service } from 'homebridge';

private readonly lockService;
private targetState;
constructor(log: Logging, api: API, dweloAPI: DweloAPI, name: string, lockID: number);

@@ -15,5 +16,6 @@ identify(): void;

private getLockState;
private setLockState;
private getBatteryStatus;
private getTargetLockState;
private setTargetLockState;
private setBatteryLevel;
}
//# sourceMappingURL=DweloLockAccessory.d.ts.map

@@ -15,7 +15,6 @@ "use strict";

this.lockService.getCharacteristic(api.hap.Characteristic.LockTargetState)
.onGet(this.getLockState.bind(this))
.onSet(this.setLockState.bind(this));
.onGet(this.getTargetLockState.bind(this))
.onSet(this.setTargetLockState.bind(this));
this.lockService.addOptionalCharacteristic(api.hap.Characteristic.BatteryLevel);
this.lockService.addOptionalCharacteristic(api.hap.Characteristic.StatusLowBattery);
this.lockService.getCharacteristic(api.hap.Characteristic.StatusLowBattery)
.onGet(this.getBatteryStatus.bind(this));
log.info(`Dwelo Lock '${name} ' created!`);

@@ -35,19 +34,26 @@ }

: this.api.hap.Characteristic.LockCurrentState.UNSECURED;
this.log.debug(`Current state of the lock was returned: ${state}`);
this.setBatteryLevel(sensors);
this.log.info(`Current state of the lock was returned: ${state}`);
return state;
}
async setLockState(value) {
async getTargetLockState() {
return this.targetState;
}
async setTargetLockState(value) {
this.targetState = value;
await this.dweloAPI.toggleLock(!!value, this.lockID);
this.log.debug(`Lock state was set to: ${value}`);
this.log.info(`Lock state was set to: ${value}`);
}
async getBatteryStatus() {
const sensors = await this.dweloAPI.sensors(this.lockID);
setBatteryLevel(sensors) {
const batterySensor = sensors.find(s => s.sensorType === 'battery');
this.log.debug('Lock battery percentage: ', batterySensor === null || batterySensor === void 0 ? void 0 : batterySensor.value);
this.log.info('Lock battery percentage: ', batterySensor === null || batterySensor === void 0 ? void 0 : batterySensor.value);
if (!batterySensor) {
return null;
return;
}
return parseInt(batterySensor.value, 10) > 20
const batteryLevel = parseInt(batterySensor.value, 10);
const batteryStatus = batteryLevel > 20
? this.api.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
: this.api.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
this.lockService.setCharacteristic(this.api.hap.Characteristic.BatteryLevel, batteryLevel);
this.lockService.setCharacteristic(this.api.hap.Characteristic.StatusLowBattery, batteryStatus);
}

@@ -54,0 +60,0 @@ }

{
"displayName": "Homebridge Dwelo Plugin",
"name": "@eduardoramirez/homebridge-dwelo",
"version": "1.0.8",
"version": "1.0.9",
"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

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