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

iobroker.shelly

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobroker.shelly - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

6

io-package.json
{
"common": {
"name": "shelly",
"version": "0.2.1",
"version": "0.2.2",
"news": {
"0.2.1": {
"en": "Bugfixing, devault value for switch timer will be 0 sec",
"de": "Feherbehebung, beim Start ist switch timer 0 sec"
},
"0.2.1": {
"en": "Username/Password support",

@@ -8,0 +12,0 @@ "de": "Username/Password support"

2

package.json
{
"name": "iobroker.shelly",
"version": "0.2.1",
"version": "0.2.2",
"description": "Shelly",

@@ -5,0 +5,0 @@ "author": {

@@ -40,2 +40,5 @@ ![Logo](admin/shelly.png)

### 0.2.2 (30.09.2018)
* Bugfixing, on start default value of timer and duration of relay and shutter will be 0 sec
### 0.2.1 (28.09.2018)

@@ -42,0 +45,0 @@ * Username/Password supported

@@ -108,2 +108,61 @@ /* jshint -W097 */

// get values from array SensorIoBrokerIDs
function getSensorIoBrokerIDsByDSId(id) {
return sensorIoBrokerIDs[id] || null;
}
// set values for sensorIoBrokerIDs array
function setSensorIoBrokerIDsByDSId(id, value) {
let val = getSensorIoBrokerIDsByDSId(id);
if (val) {
// merge objects
sensorIoBrokerIDs[id] = Object.assign(val, value);
} else if (value) {
// new object
sensorIoBrokerIDs[id] = value;
} else {
// empty object
sensorIoBrokerIDs[id] = {};
}
}
// get values from array SensorIoBrokerIDs
function getSensorIoBrokerIDs(deviceId, sensorId) {
let id = getIoBrokerIdfromDeviceIdSenId(deviceId, sensorId);
return getSensorIoBrokerIDsByDSId(id);
}
// set values for sensorIoBrokerIDs array
function setSensorIoBrokerIDs(deviceId, sensorId, value) {
let id = getIoBrokerIdfromDeviceIdSenId(deviceId, sensorId);
setSensorIoBrokerIDsByDSId(id, value);
}
function delOldObjects(deviceId) {
if (deviceId.startsWith('SHSW-2')) {
shelly.callDevice(deviceId, '/roller/0', (error, data) => {
let channel;
//roller Modus
if (!error && data) {
// Shutter Modus, we delete Relay
channel = adapter.namespace + '.' + deviceId + '.' + 'Relay';
} else {
// relay modus, we delete Shutter
channel = adapter.namespace + '.' + deviceId + '.' + 'Shutter';
}
adapter.getAdapterObjects(function(obj) {
for (let id in obj) {
let o = obj[id];
if (id.startsWith(channel)) {
adapter.delObject(id, function() {
adapter.log.debug("Delete old object " + id);
});
}
}
});
});
}
}
// get Value by Sensor ID

@@ -222,9 +281,10 @@ function getStateBySenId(sid, data) {

let value = getStateBySenId(s.I, data); // Status for Sensor ID
if (!sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, s.I)]) {
sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, s.I)] = {
if (!getSensorIoBrokerIDs(deviceId, s.I)) {
setSensorIoBrokerIDs(deviceId, s.I, {
id: tmpId,
param: {},
value: value
}; // remember the link Shelly ID -> ioBroker ID
});
}
// SHSW-44#06231A#1.Relay0.W -> State

@@ -238,5 +298,5 @@ let controlFunction;

let timer = 0;
if (sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, 'switchtimer' + s.I)] &&
sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, 'switchtimer' + s.I)].param) {
timer = sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, 'switchtimer' + s.I)].param.timer;
let sensorIoBrokerID = getSensorIoBrokerIDs(deviceId, 'switchtimer' + s.I);
if (sensorIoBrokerID) {
timer = sensorIoBrokerID.value;
}

@@ -260,4 +320,15 @@ // if timer > 0 sec. call rest with timer paramater

controlFunction = function(value) {
sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, s.I)].param.timer = value || 0;
};
setSensorIoBrokerIDs(deviceId, s.I, {
value: value || 0
});
let sen = getSensorIoBrokerIDs(deviceId, s.I);
if (sen && sen.id) {
adapter.setState(sen.id, {
val: value || 0,
ack: true
});
}
}
// call once at start
controlFunction(value || 0);
}

@@ -268,5 +339,5 @@ if (b && b.D.startsWith('Shutter') && s.T === 'ShutterUp') {

let duration = 0;
if (sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, 'rollerduration')] &&
sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, 'rollerduration')].param) {
duration = sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, 'rollerduration')].param.duration;
let sensorIoBrokerID = getSensorIoBrokerIDs(deviceId, 'rollerduration');
if (sensorIoBrokerID) {
duration = sensorIoBrokerID.value;
}

@@ -291,5 +362,5 @@ if (duration > 0) {

let duration = 0;
if (sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, 'rollerduration')] &&
sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, 'rollerduration')].param) {
duration = sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, 'rollerduration')].param.duration;
let sensorIoBrokerID = getSensorIoBrokerIDs(deviceId, 'rollerduration');
if (sensorIoBrokerID) {
duration = sensorIoBrokerID.value;
}

@@ -321,6 +392,16 @@ if (duration > 0) {

controlFunction = function(value) {
sensorIoBrokerIDs[getIoBrokerIdfromDeviceIdSenId(deviceId, s.I)].param.duration = value || 0;
};
setSensorIoBrokerIDs(deviceId, s.I, {
value: value || 0
});
let sen = getSensorIoBrokerIDs(deviceId, s.I);
if (sen && sen.id) {
adapter.setState(sen.id, {
val: value || 0,
ack: true
});
}
}
// call at start once
controlFunction(value || 0);
}
}

@@ -406,2 +487,7 @@ if (dp.type === 'boolean') {

if (b && b.D.startsWith('Relay') && s.T === 'Switch') {
/*
setSensorIoBrokerIDs(deviceId, s.I, {
sidTimer: 'switchtimer' + s.I
});
*/
s = {

@@ -636,3 +722,2 @@ 'I': 'switchtimer' + s.I,

}
updateDeviceStates(deviceId, status);

@@ -639,0 +724,0 @@ });

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