iobroker.shelly
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -49,2 +49,46 @@ /*global systemDictionary:true */ | ||
}, | ||
"User": { | ||
"en": "User", | ||
"de": "Benutzer", | ||
"ru": "пользователь", | ||
"pt": "Do utilizador", | ||
"nl": "Gebruiker", | ||
"fr": "Utilisateur", | ||
"it": "Utente", | ||
"es": "Usuario", | ||
"pl": "Użytkownik" | ||
}, | ||
"Password": { | ||
"en": "Password", | ||
"de": "Passwort", | ||
"ru": "пароль", | ||
"pt": "Senha", | ||
"nl": "Wachtwoord", | ||
"fr": "Mot de passe", | ||
"it": "Parola d'ordine", | ||
"es": "Contraseña", | ||
"pl": "Hasło" | ||
}, | ||
"Confirm Password": { | ||
"en": "Confim Password", | ||
"de": "Bestätige das Passwort", | ||
"ru": "Подтвердите Пароль", | ||
"pt": "Confirme a Senha", | ||
"nl": "bevestig wachtwoord", | ||
"fr": "Confirmez le mot de passe", | ||
"it": "conferma password", | ||
"es": "Confirmar contraseña", | ||
"pl": "Potwierdź hasło" | ||
}, | ||
"Password Enable": { | ||
"en": "Login with password", | ||
"de": "Einloggen mit Passwort", | ||
"ru": "Вход с паролем", | ||
"pt": "Login com senha", | ||
"nl": "Inloggen met wachtwoord", | ||
"fr": "Se connecter avec mot de passe", | ||
"it": "Accedi con password", | ||
"es": "Iniciar sesión con contraseña", | ||
"pl": "Zaloguj się za pomocą hasła" | ||
} | ||
}; |
{ | ||
"common": { | ||
"name": "shelly", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"news": { | ||
"0.2.1": { | ||
"en": "Username/Password support", | ||
"de": "Username/Password support" | ||
}, | ||
"0.2.0": { | ||
@@ -67,2 +71,5 @@ "en": "Roller/shutter modus supported", | ||
"native": { | ||
"pwd": false, | ||
"user": "admin", | ||
"password": "", | ||
"keys": [{ | ||
@@ -69,0 +76,0 @@ "hosts": "", |
{ | ||
"name": "iobroker.shelly", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Shelly", | ||
@@ -34,3 +34,3 @@ "author": { | ||
"request": "^2.79.0", | ||
"shelly-iot": "^0.1.1" | ||
"shelly-iot": "^0.2.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "devDependencies": { |
@@ -40,2 +40,5 @@ ![Logo](admin/shelly.png) | ||
### 0.2.1 (28.09.2018) | ||
* Username/Password supported | ||
### 0.2.0 (28.09.2018) | ||
@@ -42,0 +45,0 @@ * Roller / Shutter for Shelly2 supported |
@@ -23,3 +23,11 @@ /* jshint -W097 */ | ||
function decrypt(key, value) { | ||
let result = ''; | ||
for (let i = 0; i < value.length; ++i) { | ||
result += String.fromCharCode(key[i % key.length].charCodeAt(0) ^ value.charCodeAt(i)); | ||
} | ||
return result; | ||
} | ||
// is called when adapter shuts down - callback has to be called under any circumstances! | ||
@@ -84,3 +92,16 @@ adapter.on('unload', function(callback) { | ||
adapter.on('ready', function() { | ||
main(); | ||
// main(); | ||
adapter.getForeignObject('system.config', (err, obj) => { | ||
if (adapter.config.password) { | ||
if (obj && obj.native && obj.native.secret) { | ||
//noinspection JSUnresolvedVariable | ||
adapter.config.password = decrypt(obj.native.secret, adapter.config.password); | ||
} else { | ||
//noinspection JSUnresolvedVariable | ||
adapter.config.password = decrypt('Zgfr56gFe87jJOM', adapter.config.password); | ||
} | ||
} | ||
main(); | ||
}); | ||
}); | ||
@@ -404,3 +425,3 @@ | ||
shelly.callDevice(deviceId, '/roller/0', (error,data) => { | ||
shelly.callDevice(deviceId, '/roller/0', (error, data) => { | ||
// let str = error && Buffer.isBuffer(error) ? error.toString('utf8') : error; | ||
@@ -582,6 +603,16 @@ if (!error && data) { | ||
const options = { | ||
logger: adapter.log.debug | ||
}; | ||
let options = {}; | ||
if (adapter.config.user && adapter.config.password) { | ||
options = { | ||
logger: adapter.log.debug, | ||
user: adapter.config.user, | ||
password: adapter.config.password | ||
}; | ||
} else { | ||
options = { | ||
logger: adapter.log.debug, | ||
}; | ||
} | ||
shelly = new Shelly(options); | ||
@@ -588,0 +619,0 @@ |
Sorry, the diff of this file is not supported yet
225058
1237
75
+ Addedshelly-iot@0.2.0(transitive)
- Removedshelly-iot@0.1.1(transitive)
Updatedshelly-iot@^0.2.0