@switchbot/homebridge-switchbot-ble
Advanced tools
Comparing version 1.2.4 to 1.2.6
@@ -14,3 +14,3 @@ "use strict"; | ||
.on("get" /* GET */, (callback) => { | ||
log.info("Current state of Bot was returned: " + (this.switchOn ? "ON" : "OFF")); | ||
log.info('Current state of Bot was returned: ' + (this.switchOn ? 'ON' : 'OFF')); | ||
callback(undefined, this.switchOn); | ||
@@ -23,3 +23,3 @@ }) | ||
if (targetState === this.switchOn) { | ||
log.info("Target state of Bot has not changed: " + (this.switchOn ? "ON" : "OFF")); | ||
log.info('Target state of Bot has not changed: ' + (this.switchOn ? 'ON' : 'OFF')); | ||
(_a = this.botService) === null || _a === void 0 ? void 0 : _a.getCharacteristic(hap.Characteristic.On).updateValue(this.switchOn); | ||
@@ -29,3 +29,3 @@ callback(); | ||
// Target state has been changed. | ||
log.info("Target state of Bot setting: " + (targetState ? "ON" : "OFF")); | ||
log.info('Target state of Bot setting: ' + (targetState ? 'ON' : 'OFF')); | ||
const SwitchBot = require('node-switchbot'); | ||
@@ -36,5 +36,5 @@ const switchbot = new SwitchBot(); | ||
let targetDevice = null; | ||
for (let device of device_list) { | ||
for (const device of device_list) { | ||
// log.info(device.modelName, device.address); | ||
if (device.address == this.bleMac) { | ||
if (device.address === this.bleMac) { | ||
targetDevice = device; | ||
@@ -74,3 +74,3 @@ break; | ||
}, 500); | ||
log.info("Bot state has been set to: " + (this.switchOn ? "ON" : "OFF")); | ||
log.info('Bot state has been set to: ' + (this.switchOn ? 'ON' : 'OFF')); | ||
callback(); | ||
@@ -83,3 +83,3 @@ }).catch((error) => { | ||
}, 500); | ||
log.info("Bot state failed to be set to: " + (targetState ? "ON" : "OFF")); | ||
log.info('Bot state failed to be set to: ' + (targetState ? 'ON' : 'OFF')); | ||
callback(); | ||
@@ -89,6 +89,6 @@ }); | ||
this.informationService = new hap.Service.AccessoryInformation() | ||
.setCharacteristic(hap.Characteristic.Manufacturer, "SwitchBot") | ||
.setCharacteristic(hap.Characteristic.Model, "SWITCHBOT-S1") | ||
.setCharacteristic(hap.Characteristic.Manufacturer, 'SwitchBot') | ||
.setCharacteristic(hap.Characteristic.Model, 'SWITCHBOT-S1') | ||
.setCharacteristic(hap.Characteristic.SerialNumber, this.bleMac); | ||
log.info("Bot '%s' created!", name); | ||
log.info('Bot \'%s\' created!', name); | ||
} | ||
@@ -100,3 +100,3 @@ /* | ||
identify() { | ||
this.log.info("Identify!"); | ||
this.log.info('Identify!'); | ||
} | ||
@@ -103,0 +103,0 @@ /* |
@@ -19,3 +19,3 @@ "use strict"; | ||
.on("get" /* GET */, (callback) => { | ||
log.info("Current position of Curtain was returned: " + this.currentPosition + "%"); | ||
log.info('Current position of Curtain was returned: ' + this.currentPosition + '%'); | ||
callback(undefined, this.currentPosition); | ||
@@ -25,3 +25,3 @@ }); | ||
.on("get" /* GET */, (callback) => { | ||
log.info("Target position of Curtain was returned: " + this.targetPosition + "%"); | ||
log.info('Target position of Curtain was returned: ' + this.targetPosition + '%'); | ||
callback(undefined, this.targetPosition); | ||
@@ -32,3 +32,3 @@ }) | ||
this.targetPosition = value; | ||
log.info("Target position of Curtain setting: " + this.targetPosition + "%"); | ||
log.info('Target position of Curtain setting: ' + this.targetPosition + '%'); | ||
clearTimeout(this.moveTimer); | ||
@@ -56,5 +56,5 @@ if (this.targetPosition > this.currentPosition) { | ||
let targetDevice = null; | ||
for (let device of device_list) { | ||
for (const device of device_list) { | ||
log.info(device.modelName, device.address); | ||
if (device.address == this.bleMac) { | ||
if (device.address === this.bleMac) { | ||
targetDevice = device; | ||
@@ -96,3 +96,3 @@ break; | ||
log.info('Done.'); | ||
log.info("Target position of Curtain has been set to: " + this.targetPosition + "%"); | ||
log.info('Target position of Curtain has been set to: ' + this.targetPosition + '%'); | ||
this.moveTimer = setTimeout(() => { | ||
@@ -118,3 +118,3 @@ var _a, _b; | ||
}, 1000); | ||
log.info("Target position of Curtain failed to be set to: " + this.targetPosition + "%"); | ||
log.info('Target position of Curtain failed to be set to: ' + this.targetPosition + '%'); | ||
callback(); | ||
@@ -126,10 +126,10 @@ }); | ||
.on("get" /* GET */, (callback) => { | ||
log.info("The position state of Curtain was returned: " + this.positionState); | ||
log.info('The position state of Curtain was returned: ' + this.positionState); | ||
callback(undefined, this.positionState); | ||
}); | ||
this.informationService = new hap.Service.AccessoryInformation() | ||
.setCharacteristic(hap.Characteristic.Manufacturer, "SwitchBot") | ||
.setCharacteristic(hap.Characteristic.Model, "SWITCHBOT-CURTAIN-W0701600") | ||
.setCharacteristic(hap.Characteristic.Manufacturer, 'SwitchBot') | ||
.setCharacteristic(hap.Characteristic.Model, 'SWITCHBOT-CURTAIN-W0701600') | ||
.setCharacteristic(hap.Characteristic.SerialNumber, this.bleMac); | ||
log.info("Curtain '%s' created!", name); | ||
log.info('Curtain \'%s\' created!', name); | ||
} | ||
@@ -141,3 +141,3 @@ /* | ||
identify() { | ||
this.log.info("Identify!"); | ||
this.log.info('Identify!'); | ||
} | ||
@@ -144,0 +144,0 @@ /* |
@@ -16,7 +16,7 @@ "use strict"; | ||
.on("get" /* GET */, (callback) => { | ||
log.info(name + " current temperature: " + this.temperature + "\u2103"); | ||
log.info(name + ' current temperature: ' + this.temperature + '\u2103'); | ||
callback(undefined, (this.temperature < 0) ? 0 : (this.temperature > 100 ? 100 : this.temperature)); | ||
}) | ||
.on("set" /* SET */, (value, callback) => { | ||
log.info("The temperature of the Meter can't be set!"); | ||
log.info('The temperature of the Meter can\'t be set!'); | ||
callback(); | ||
@@ -27,14 +27,14 @@ }); | ||
.on("get" /* GET */, (callback) => { | ||
log.info(name + " current humidity: " + this.humidity + "%"); | ||
log.info(name + ' current humidity: ' + this.humidity + '%'); | ||
callback(undefined, this.humidity); | ||
}) | ||
.on("set" /* SET */, (value, callback) => { | ||
log.info("The humidity of the Meter can't be set!"); | ||
log.info('The humidity of the Meter can\'t be set!'); | ||
callback(); | ||
}); | ||
this.informationService = new hap.Service.AccessoryInformation() | ||
.setCharacteristic(hap.Characteristic.Manufacturer, "SwitchBot") | ||
.setCharacteristic(hap.Characteristic.Model, "SWITCHBOT-METERTH-S1") | ||
.setCharacteristic(hap.Characteristic.Manufacturer, 'SwitchBot') | ||
.setCharacteristic(hap.Characteristic.Model, 'SWITCHBOT-METERTH-S1') | ||
.setCharacteristic(hap.Characteristic.SerialNumber, this.bleMac); | ||
log.info(name, "scanDuration:" + this.scanDuration.toString() + "ms", "scanInterval:" + this.scanInterval.toString() + "ms"); | ||
log.info(name, 'scanDuration:' + this.scanDuration.toString() + 'ms', 'scanInterval:' + this.scanInterval.toString() + 'ms'); | ||
const Switchbot = require('node-switchbot'); | ||
@@ -78,3 +78,3 @@ const switchbot = new Switchbot(); | ||
identify() { | ||
this.log.info("Identify!"); | ||
this.log.info('Identify!'); | ||
} | ||
@@ -81,0 +81,0 @@ /* |
@@ -5,3 +5,3 @@ "use strict"; | ||
const meter_accessory_1 = require("./meter-accessory"); | ||
const PLATFORM_NAME = "SwitchBotPlatform"; | ||
const PLATFORM_NAME = 'SwitchBotPlatform'; | ||
/* | ||
@@ -31,7 +31,7 @@ * IMPORTANT NOTICE | ||
class SwitchBotPlatform { | ||
constructor(log, config, api) { | ||
constructor(log, config, _api) { | ||
this.log = log; | ||
// probably parse config or something here | ||
this.config = config; | ||
log.info("SwitchBot platform finished initializing!"); | ||
log.info('SwitchBot platform finished initializing!'); | ||
} | ||
@@ -45,5 +45,5 @@ /* | ||
accessories(callback) { | ||
let deviceList = []; | ||
const deviceList = []; | ||
if (this.config.devices) { | ||
for (var device of this.config.devices) { | ||
for (const device of this.config.devices) { | ||
// this.log.info(device.type); | ||
@@ -53,3 +53,3 @@ // this.log.info(device.name); | ||
// this.log.info(device.scanDuration, typeof device.scanDuration); | ||
let scanDuration = device.scanDuration || 1000; | ||
const scanDuration = device.scanDuration || 1000; | ||
switch (device.type) { | ||
@@ -79,3 +79,3 @@ case 'bot': | ||
} | ||
this.log("Device amount:", deviceList.length.toString()); | ||
this.log('Device amount:', deviceList.length.toString()); | ||
callback(deviceList); | ||
@@ -82,0 +82,0 @@ } |
{ | ||
"name": "@switchbot/homebridge-switchbot-ble", | ||
"version": "1.2.4", | ||
"version": "1.2.6", | ||
"description": "Homebridge integration for SwitchBot BLE series products", | ||
"license": "ISC", | ||
"files": [ | ||
"LICENSE", | ||
"dist" | ||
], | ||
"repository": { | ||
@@ -23,7 +19,6 @@ "type": "git", | ||
"scripts": { | ||
"clean": "rimraf ./dist", | ||
"lint": "eslint src/**.ts", | ||
"watch": "npm run build && npm link && nodemon", | ||
"build": "rimraf ./dist && tsc", | ||
"prepublishOnly": "npm run build", | ||
"postpublish": "npm run clean", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"prepublishOnly": "npm run lint && npm run build" | ||
}, | ||
@@ -37,14 +32,14 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/node": "^14.14.10", | ||
"@typescript-eslint/eslint-plugin": "^4.8.2", | ||
"@typescript-eslint/parser": "^4.8.2", | ||
"eslint": "^7.14.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"homebridge": "^1.1.6", | ||
"homebridge-config-ui-x": "^4.34.0", | ||
"@types/node": "^14.14.14", | ||
"@typescript-eslint/eslint-plugin": "^4.10.0", | ||
"@typescript-eslint/parser": "^4.10.0", | ||
"eslint": "^7.16.0", | ||
"eslint-plugin-prettier": "^3.3.0", | ||
"homebridge": "^1.1.7", | ||
"homebridge-config-ui-x": "^4.36.0", | ||
"nodemon": "^2.0.6", | ||
"prettier": "^2.2.0", | ||
"prettier": "^2.2.1", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.1.2" | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.1.3" | ||
}, | ||
@@ -51,0 +46,0 @@ "dependencies": { |
@@ -0,0 +0,0 @@ <span align="center"> |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
102015
34
1015
1
1
2