New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

thing-it-device-wtec

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thing-it-device-wtec - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

59

default-units/fixture.js

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

type: {
id: "string"
id: "string"
}
},{
}, {
id: "power",

@@ -34,4 +34,4 @@ label: "Power",

}, {
id: "ceilingTemperature",
label: "Ceiling Temperature",
id: "temperature",
label: "Temperature",
type: {

@@ -97,4 +97,4 @@ id: "decimal"

}, {
label: "Display Ceiling Temperature",
id: "displayCeilingTemperature",
label: "Display Temperature",
id: "displayTemperature",
type: {

@@ -211,2 +211,7 @@ id: "boolean"

this.logInfo('Not subscribing to individual location update, expecting updates from device.');
this.interval = setInterval(function () {
this.logDebug('Invoking scheduled periodic update.');
this.update();
}.bind(this), (60*10*1000) * Math.random(60*10*1000));
}

@@ -223,5 +228,5 @@

setTimeout(function(){
setTimeout(function () {
deferred.resolve();
},100);
}, 100);

@@ -310,3 +315,3 @@ return deferred.promise;

power: Math.random() * 3,
ceilingTemperature: 15 + Math.random() * 20,
temperature: 15 + Math.random() * 20,
illuminance: Math.random() * 10,

@@ -342,6 +347,6 @@ brightness: Math.random() * 10,

this.logDebug('Fixture initialized, updating.');
/*
this.logDebug(responseTime);
this.logDebug(response);
*/
/*
this.logDebug(responseTime);
this.logDebug(response);
*/

@@ -353,3 +358,3 @@ if (response.name) this.state.name = response.name;

if (response.sensorStats.power) this.state.power = response.sensorStats.power.instant;
if (response.sensorStats.ceilingTemperature) this.state.ceilingTemperature = response.sensorStats.temperature.instant;
if (response.sensorStats.temperature) this.state.temperature = response.sensorStats.temperature.instant;
if (response.sensorStats.illuminance) this.state.illuminance = response.sensorStats.illuminance.instant;

@@ -382,13 +387,13 @@ if (response.sensorStats.brightness) this.state.brightness = response.sensorStats.brightness.instant;

/*
// at initialization this should not be an event as
try {
this.publishEvent('tic', {
motion: this.state.motion,
occupancy: this.state.occupancy
});
} catch (e) {
this.logError('Error publishing Event', e);
}
*/
/*
// at initialization this should not be an event as
try {
this.publishEvent('tic', {
motion: this.state.motion,
occupancy: this.state.occupancy
});
} catch (e) {
this.logError('Error publishing Event', e);
}
*/
}

@@ -411,3 +416,3 @@ } else {

// only log if it is a change in state
if (0 === this.state.occupancy){
if (0 === this.state.occupancy) {
this.logInfo('Fixture occupied.');

@@ -430,3 +435,3 @@ this.state.occupancy = 1;

this.publishStateChange();
this.publishStateChange();
} else {

@@ -433,0 +438,0 @@ this.logDebug('Fixture received update prior to being initialized.')

@@ -39,2 +39,8 @@ "use strict";

}, {
id: "roomTemperature",
label: "Room Temperature",
type: {
id: "decimal"
}
}, {
id: "illuminance",

@@ -123,2 +129,9 @@ label: "Illuminance",

}, {
label: "Display Room Temperature",
id: "displayRoomTemperature",
type: {
id: "boolean"
},
defaultValue: true
}, {
label: "Display Illuminance",

@@ -237,2 +250,7 @@ id: "displayIlluminance",

this.logInfo('Not subscribing to individual location update, expecting updates from device.');
this.interval = setInterval(function () {
this.logDebug('Invoking scheduled periodic update.');
this.update();
}.bind(this), (60*10*1000) * Math.random(60*10*1000));
}

@@ -350,2 +368,3 @@

ceilingTemperature: 15 + Math.random() * 20,
roomTemperature: 15 + Math.random() * 20,
illuminance: Math.random() * 10,

@@ -487,2 +506,3 @@ brightness: Math.random() * 10,

if (response.sensorStats.ceilingTemperature) this.state.ceilingTemperature = response.sensorStats.ceilingTemperature.instant;
if (response.sensorStats.roomTemperature) this.state.roomTemperature = response.sensorStats.roomTemperature.instant;
if (response.sensorStats.illuminance) this.state.illuminance = response.sensorStats.illuminance.instant;

@@ -489,0 +509,0 @@ if (response.sensorStats.brightness) this.state.brightness = response.sensorStats.brightness.instant;

@@ -33,2 +33,8 @@ "use strict";

}, {
id: "roomTemperature",
label: "Room Temperature",
type: {
id: "decimal"
}
}, {
id: "illuminance",

@@ -97,2 +103,9 @@ label: "Illuminance",

}, {
label: "Display Room Temperature",
id: "displayRoomTemperature",
type: {
id: "boolean"
},
defaultValue: true
}, {
label: "Display Illuminance",

@@ -138,3 +151,3 @@ id: "displayIlluminance",

this.logDebug("start()");
var promise;
var deferred = q.defer();
this.state = {};

@@ -145,3 +158,3 @@

this.logDebug('Starting wtec location information in simulated mode');
promise = q();
deferred.resolve();
this.state.name = 'Simulated Location Name ' + Math.round(Math.random() * 1000);

@@ -160,41 +173,60 @@

promise = this.update()
.then(function () {
var payload = '{ \
"protocolVersion" : "1", \
"schemaVersion" : "1.4.0", \
"requestType" : "subscribe", \
"requestData" : { \
"location": [{ \
"id":' + this.configuration.locationId + ',\
"name":"",\
"sensorStats":{}\
}],\
} \
}\n\r\n\r\n\r\n';
var initializationUpdate = setInterval(
function () {
this.update()
.then(function () {
this.initialized = true;
clearInterval(initializationUpdate);
this.device.continuousPost('/uApi', payload, function (error, result) {
if (error) {
if (this.configuration.subscribeIndividualLocation) {
this.logInfo('Subscribing to individual location update, not expecting updates from device.');
var payload = '{ \
"protocolVersion" : "1", \
"schemaVersion" : "1.4.0", \
"requestType" : "subscribe", \
"requestData" : { \
"location": [{ \
"id":' + this.configuration.locationId + ',\
"name":"",\
"sensorStats":{}\
}],\
} \
}\n\r\n\r\n\r\n';
this.device.continuousPost('/uApi', payload, function (error, result) {
if (error) {
this.logError(error);
} else {
this.logDebug('Received change of value notification.');
this.readResponse(result.responseData.location[0], result.time);
}
}.bind(this));
} else {
this.logInfo('Not subscribing to individual location update, expecting updates from device.');
this.interval = setInterval(function () {
this.logDebug('Invoking scheduled periodic update.');
this.update();
}.bind(this), (60*10*1000) * Math.random(60*10*1000));
}
this.logInfo('Location started.');
}.bind(this))
.fail(function (error) {
this.logInfo('Location started with error.');
this.logError(error);
} else {
this.logDebug('Received change of value notification.');
this.readResponse(result.responseData.location[0], result.time);
}
}.bind(this));
}.bind(this))
.fail(function (error) {
this.logError(error);
});
/*this.interval = setInterval(function () {
this.update();
}.bind(this), 5000);*/
})
.done();
}.bind(this), 1000);
}
} catch (e) {
this.logError('Error during start.', e);
promise = q.fcall(function () {
throw new Error(e);
});
this.logInfo('Location started with error.');
}
setTimeout(function () {
deferred.resolve();
}, 100);
return promise;

@@ -272,2 +304,3 @@ };

ceilingTemperature: 15 + Math.random() * 20,
roomTemperature: 15 + Math.random() * 20,
illuminance: Math.random() * 10,

@@ -309,2 +342,3 @@ brightness: Math.random() * 10,

if (response.sensorStats.ceilingTemperature) this.state.ceilingTemperature = response.sensorStats.ceilingTemperature.instant;
if (response.sensorStats.roomTemperature) this.state.roomTemperature = response.sensorStats.roomTemperature.instant;
if (response.sensorStats.illuminance) this.state.illuminance = response.sensorStats.illuminance.instant;

@@ -323,10 +357,3 @@ if (response.sensorStats.brightness) this.state.brightness = response.sensorStats.brightness.instant;

}
try {
this.publishEvent(this.events.tic, {
motion: this.state.motion,
occupancy: this.state.occupancy
});
} catch (e) {
this.logError('Error publishing Event', e);
}
}

@@ -347,4 +374,5 @@ } else {

this.state.occupancy = 1;
try {
this.publishEvent(this.events.tic, {
this.publishEvent('tic', {
motion: this.state.motion,

@@ -354,3 +382,4 @@ occupancy: this.state.occupancy

} catch (e) {
this.logError('Error publishing Event', e);
// this.logError('Error publishing Event', e);
this.logError('Error publishing Event.');
}

@@ -357,0 +386,0 @@ }

{
"name": "thing-it-device-wtec",
"version": "1.0.5",
"version": "1.0.6",
"description": "[thing-it-node] Device Plugin for wtec devices.",

@@ -5,0 +5,0 @@ "authors": "Klaus Berberich",

@@ -340,5 +340,6 @@ module.exports = {

deferred.resolve(responseData);
this.logDebug('Response received.', responseData);
}
else {
console.log(statusCode)
this.logDebug('Received status code.', statusCode);
}

@@ -345,0 +346,0 @@ }.bind(this));

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