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

node-red-contrib-tplink-smarthome

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-tplink-smarthome - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

2

package.json
{
"name": "node-red-contrib-tplink-smarthome",
"version": "0.0.5",
"version": "0.0.6",
"description": "A collection of node-red nodes for tp-link smart home devices",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/Felixls/node-red-contrib-tplink-smarthome",

@@ -27,27 +27,29 @@ module.exports = function(RED) {

const client = new Client();
client.getDevice({
host: deviceIP
})
.then((device) => {
deviceInstance = device;
device.startPolling(parseInt(node.config.interval));
node.status({fill: 'green', shape: 'dot', text: 'connected'});
device.on('lightstate-on', () => {
node.sendPowerUpdateEvent(true);
node.connectClient = function () {
const client = new Client();
client.getDevice({
host: deviceIP
})
.then((device) => {
deviceInstance = device;
device.startPolling(parseInt(node.config.interval));
node.status({fill: 'green', shape: 'dot', text: 'connected'});
device.on('lightstate-on', () => {
node.sendPowerUpdateEvent(true);
});
device.on('lightstate-off', () => {
node.sendPowerUpdateEvent(false);
});
device.on('device-online', () => {
node.sendDeviceOnlineEvent(true);
});
device.on('device-offline', () => {
node.sendDeviceOnlineEvent(false);
});
})
.catch(error => {
node.error(error);
node.status({fill: 'red', shape: 'ring', text: 'not reachable'});
});
device.on('lightstate-off', () => {
node.sendPowerUpdateEvent(false);
});
device.on('device-online', () => {
node.sendDeviceOnlineEvent(true);
});
device.on('device-offline', () => {
node.sendDeviceOnlineEvent(false);
});
})
.catch(error => {
node.error(error);
node.status({fill: 'red', shape: 'ring', text: 'not reachable'});
});
};

@@ -68,2 +70,3 @@ node.recheck = setInterval(function() {

node.status({fill: 'red', shape: 'ring', text: 'not reachable'});
node.connectClient();
return false;

@@ -148,3 +151,5 @@ }

clearInterval(node.recheck);
});
});
node.connectClient();
}

@@ -151,0 +156,0 @@ RED.nodes.registerType('smart-bulb', SmartBulbNode);

@@ -28,33 +28,35 @@ module.exports = function(RED) {

const client = new Client();
client.getDevice({
host: deviceIP
})
.then((device) => {
deviceInstance = device;
device.startPolling(parseInt(node.config.interval));
node.status({fill: 'green', shape: 'dot', text: 'connected'});
device.on('power-on', () => {
node.sendPowerUpdateEvent(true);
node.connectClient = function () {
const client = new Client();
client.getDevice({
host: deviceIP
})
.then((device) => {
deviceInstance = device;
device.startPolling(parseInt(node.config.interval));
node.status({fill: 'green', shape: 'dot', text: 'connected'});
device.on('power-on', () => {
node.sendPowerUpdateEvent(true);
});
device.on('power-off', () => {
node.sendPowerUpdateEvent(false);
});
device.on('in-use', () => {
node.sendInUseEvent(true);
});
device.on('not-in-use', () => {
node.sendInUseEvent(false);
});
device.on('device-online', () => {
node.sendDeviceOnlineEvent(true);
});
device.on('device-offline', () => {
node.sendDeviceOnlineEvent(false);
});
})
.catch(error => {
node.error(error);
node.status({fill: 'red', shape: 'ring', text: 'not reachable'});
});
device.on('power-off', () => {
node.sendPowerUpdateEvent(false);
});
device.on('in-use', () => {
node.sendInUseEvent(true);
});
device.on('not-in-use', () => {
node.sendInUseEvent(false);
});
device.on('device-online', () => {
node.sendDeviceOnlineEvent(true);
});
device.on('device-offline', () => {
node.sendDeviceOnlineEvent(false);
});
})
.catch(error => {
node.error(error);
node.status({fill: 'red', shape: 'ring', text: 'not reachable'});
});
};

@@ -78,2 +80,3 @@ node.recheck = setInterval(function() {

node.status({fill: 'red', shape: 'ring', text: 'not reachable'});
node.connectClient();
return false;

@@ -194,3 +197,5 @@ }

clearInterval(node.recheck);
});
});
node.connectClient();
}

@@ -197,0 +202,0 @@ RED.nodes.registerType('smart-plug', SmartPlugNode);

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