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

@switchbot/homebridge-switchbot

Package Overview
Dependencies
Maintainers
2
Versions
924
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@switchbot/homebridge-switchbot - npm Package Compare versions

Comparing version 0.0.2-beta.15 to 0.0.2-beta.16

66

dist/devices/meters.js

@@ -170,40 +170,32 @@ "use strict";

if (this.platform.config.options?.ble?.includes(this.device.deviceId)) {
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Switchbot = require('node-switchbot');
const switchbot = new Switchbot();
const colon = this.device.deviceId.match(/.{1,2}/g);
const bleMac = colon.join(':'); //returns 1A:23:B4:56:78:9A;
this.device.bleMac = bleMac.toLowerCase();
if (this.platform.debugMode) {
this.platform.log.warn(this.device.bleMac);
}
switchbot.onadvertisement = (ad) => {
this.platform.log.info(JSON.stringify(ad, null, ' '));
this.platform.log.warn('ad:', JSON.stringify(ad));
this.platform.log.info('Temperature:', ad.serviceData.temperature.c);
this.platform.log.info('Humidity:', ad.serviceData.humidity);
this.BLEtemperature = ad.serviceData.temperature.c;
this.BLEHumidity = ad.serviceData.humidity;
};
switchbot
.startScan({
id: this.device.bleMac,
})
.then(() => {
return switchbot.wait(this.platform.config.options.refreshRate * 1000);
})
.then(() => {
switchbot.stopScan();
})
.catch((error) => {
this.platform.log.error(error);
});
this.parseStatus();
this.updateHomeKitCharacteristics();
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Switchbot = require('node-switchbot');
const switchbot = new Switchbot();
const colon = this.device.deviceId.match(/.{1,2}/g);
const bleMac = colon.join(':'); //returns 1A:23:B4:56:78:9A;
this.device.bleMac = bleMac.toLowerCase();
if (this.platform.debugMode) {
this.platform.log.warn(this.device.bleMac);
}
catch (e) {
this.platform.log.error('Meter - Failed to update status of', this.device.deviceName, JSON.stringify(e.message), this.platform.log.debug('Meter %s -', this.accessory.displayName, JSON.stringify(e)));
this.apiError(e);
}
switchbot.onadvertisement = (ad) => {
this.platform.log.info(JSON.stringify(ad, null, ' '));
this.platform.log.warn('ad:', JSON.stringify(ad));
this.platform.log.info('Temperature:', ad.serviceData.temperature.c);
this.platform.log.info('Humidity:', ad.serviceData.humidity);
this.BLEtemperature = ad.serviceData.temperature.c;
this.BLEHumidity = ad.serviceData.humidity;
};
switchbot
.startScan({
id: this.device.bleMac,
})
.then(() => {
return switchbot.wait(this.platform.config.options.refreshRate * 1000);
})
.then(() => {
switchbot.stopScan();
})
.catch((error) => {
this.platform.log.error(error);
});
}

@@ -210,0 +202,0 @@ try {

{
"displayName": "Homebridge SwitchBot",
"name": "@switchbot/homebridge-switchbot",
"version": "0.0.2-beta.15",
"version": "0.0.2-beta.16",
"description": "The [Homebridge](https://homebridge.io) SwitchBot plugin allows you to access your [SwitchBot](https://www.switch-bot.com) device(s) from HomeKit.",

@@ -6,0 +6,0 @@ "author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",

@@ -197,44 +197,32 @@ import { Service, PlatformAccessory, Units, CharacteristicValue, HAPStatus } from 'homebridge';

if (this.platform.config.options?.ble?.includes(this.device.deviceId!)) {
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Switchbot = require('node-switchbot');
const switchbot = new Switchbot();
const colon = this.device.deviceId!.match(/.{1,2}/g);
const bleMac = colon!.join(':'); //returns 1A:23:B4:56:78:9A;
this.device.bleMac = bleMac.toLowerCase();
if (this.platform.debugMode) {
this.platform.log.warn(this.device.bleMac!);
}
switchbot.onadvertisement = (ad: any) => {
this.platform.log.info(JSON.stringify(ad, null, ' '));
this.platform.log.warn('ad:', JSON.stringify(ad));
this.platform.log.info('Temperature:', ad.serviceData.temperature.c);
this.platform.log.info('Humidity:', ad.serviceData.humidity);
this.BLEtemperature = ad.serviceData.temperature.c;
this.BLEHumidity = ad.serviceData.humidity;
};
switchbot
.startScan({
id: this.device.bleMac,
})
.then(() => {
return switchbot.wait(this.platform.config.options!.refreshRate! * 1000);
})
.then(() => {
switchbot.stopScan();
})
.catch((error: any) => {
this.platform.log.error(error);
});
this.parseStatus();
this.updateHomeKitCharacteristics();
} catch (e) {
this.platform.log.error(
'Meter - Failed to update status of',
this.device.deviceName,
JSON.stringify(e.message),
this.platform.log.debug('Meter %s -', this.accessory.displayName, JSON.stringify(e)),
);
this.apiError(e);
const Switchbot = require('node-switchbot');
const switchbot = new Switchbot();
const colon = this.device.deviceId!.match(/.{1,2}/g);
const bleMac = colon!.join(':'); //returns 1A:23:B4:56:78:9A;
this.device.bleMac = bleMac.toLowerCase();
if (this.platform.debugMode) {
this.platform.log.warn(this.device.bleMac!);
}
switchbot.onadvertisement = (ad: any) => {
this.platform.log.info(JSON.stringify(ad, null, ' '));
this.platform.log.warn('ad:', JSON.stringify(ad));
this.platform.log.info('Temperature:', ad.serviceData.temperature.c);
this.platform.log.info('Humidity:', ad.serviceData.humidity);
this.BLEtemperature = ad.serviceData.temperature.c;
this.BLEHumidity = ad.serviceData.humidity;
};
switchbot
.startScan({
id: this.device.bleMac,
})
.then(() => {
return switchbot.wait(this.platform.config.options!.refreshRate! * 1000);
})
.then(() => {
switchbot.stopScan();
})
.catch((error: any) => {
this.platform.log.error(error);
});
}

@@ -241,0 +229,0 @@ try {

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