iobroker.easee
Advanced tools
Comparing version 0.0.5 to 0.1.1
@@ -18,14 +18,38 @@ /*global systemDictionary:true */ | ||
'username': { | ||
'en': 'Username', | ||
'de': 'Benutzername' | ||
"en": "username", | ||
"de": "Nutzername", | ||
"ru": "имя пользователя", | ||
"pt": "nome de usuário", | ||
"nl": "gebruikersnaam", | ||
"fr": "Nom d'utilisateur", | ||
"it": "nome utente", | ||
"es": "nombre de usuario", | ||
"pl": "Nazwa Użytkownika", | ||
"zh-cn": "用户名" | ||
}, | ||
'password': { | ||
'en': 'Password', | ||
'de': 'Passwort' | ||
"en": "password", | ||
"de": "Passwort", | ||
"ru": "пароль", | ||
"pt": "senha", | ||
"nl": "wachtwoord", | ||
"fr": "le mot de passe", | ||
"it": "parola d'ordine", | ||
"es": "contraseña", | ||
"pl": "hasło", | ||
"zh-cn": "密码" | ||
}, | ||
'polltime': { | ||
'en': 'Poll interval in seconds', | ||
'de': 'Abfrageinterval in Sekunden' | ||
"en": "Poll interval in seconds", | ||
"de": "Abfrageintervall in Sekunden", | ||
"ru": "Интервал опроса в секундах", | ||
"pt": "Intervalo de enquete em segundos", | ||
"nl": "Poll-interval in seconden", | ||
"fr": "Intervalle d'interrogation en secondes", | ||
"it": "Intervallo di polling in secondi", | ||
"es": "Intervalo de encuesta en segundos", | ||
"pl": "Okres odpytywania w sekundach", | ||
"zh-cn": "轮询间隔(秒)" | ||
} | ||
}; |
{ | ||
"common": { | ||
"name": "easee", | ||
"version": "0.0.5", | ||
"version": "0.1.1", | ||
"news": { | ||
"0.1.1": { | ||
"en": "Password encrypt + bugfix for the stable version", | ||
"de": "Password verschlüsselt + Fehlerkorrektur fürstable Version" | ||
}, | ||
"0.1.0": { | ||
"en": "Preparation for the first stable version", | ||
"de": "Vorbereitung für die erste stable Version" | ||
}, | ||
"0.0.5": { | ||
@@ -7,0 +15,0 @@ "en": "add energy used value", |
84
main.js
@@ -9,3 +9,3 @@ 'use strict'; | ||
const apiUrl = "https://api.easee.cloud"; | ||
const adapterIntervals = {}; //Ahlten von allen Intervallen | ||
const adapterIntervals = {}; //halten von allen Intervallen | ||
var accessToken = ""; | ||
@@ -56,32 +56,50 @@ var refreshToken = ""; | ||
} | ||
// Testen ob der Login funktioniert | ||
if (this.config.username == '' || this.config.password == '') { | ||
this.log.error("No Username or Password set"); | ||
if (this.config.username == '' ) { | ||
this.log.error("No username set"); | ||
//Status melden | ||
await this.setStateAsync('online', false); | ||
} else { | ||
var login = await this.login(this.config.username, this.config.password); | ||
if (login) { | ||
//Erstes Objekt erstellen | ||
await this.setObjectNotExistsAsync('lastUpdate', { | ||
type: 'state', | ||
common: { | ||
name: 'lastUpdate', | ||
type: 'string', | ||
role: 'indicator', | ||
read: true, | ||
write: false, | ||
}, | ||
native: {}, | ||
}); | ||
this.config.password = ''; //reset old passwords | ||
this.getForeignObject('system.config', async (err, obj) => { | ||
if ((obj && obj.native && obj.native.secret) || this.config.client_secret == '') { | ||
this.log.info("Secret is: " + this.config.client_secret); | ||
// starten den Statuszyklus der API neu | ||
this.readAllStates(); | ||
this.config.password = decrypt(obj.native.secret, this.config.client_secret); | ||
this.log.info("Password decrypted"); | ||
this.log.debug("Password is:" + this.config.password); | ||
var login = await this.login(this.config.username, this.config.password); | ||
} else { | ||
//Login hat nicht funktionert, Adapter kann nicht gestartet werden | ||
//Errohandling in der Loginfunktion derzeit | ||
} | ||
if (login) { | ||
//Erstes Objekt erstellen | ||
await this.setObjectNotExistsAsync('lastUpdate', { | ||
type: 'state', | ||
common: { | ||
name: 'lastUpdate', | ||
type: 'string', | ||
role: 'indicator', | ||
read: true, | ||
write: false, | ||
}, | ||
native: {}, | ||
}); | ||
// starten den Statuszyklus der API neu | ||
await this.readAllStates(); | ||
} else { | ||
//Login hat nicht funktionert, Adapter kann nicht gestartet werden | ||
//Errohandling in der Loginfunktion derzeit | ||
} | ||
} else { | ||
this.log.error("No password set"); | ||
//Status melden | ||
await this.setStateAsync('online', false); | ||
} | ||
}); | ||
} | ||
@@ -127,6 +145,6 @@ } | ||
//Setzen die Daten der Charger | ||
this.setNewStatusToCharger(charger, tmpChargerState); | ||
await this.setNewStatusToCharger(charger, tmpChargerState); | ||
//Setzen die Config zum Charger | ||
this.setNewConfigToCharger(charger, tmpChargerConfig); | ||
await this.setNewConfigToCharger(charger, tmpChargerConfig); | ||
@@ -395,6 +413,6 @@ //setzen und erechnen der Energiedaten, aber gebremste | ||
/*********************************************************************** | ||
* Funktionen für Staus der Reading um den Code aufgeräumeter zu machen | ||
* Funktionen für Status der Reading um den Code aufgeräumter zu machen | ||
***********************************************************************/ | ||
//Setzen alle Staus für Charger | ||
//Setzen alle Status für Charger | ||
async setNewStatusToCharger(charger, charger_states) { | ||
@@ -779,4 +797,10 @@ //Legen die Steurungsbutton für jeden Charger an | ||
} | ||
} | ||
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; | ||
} | ||
@@ -783,0 +807,0 @@ |
{ | ||
"name": "iobroker.easee", | ||
"version": "0.0.5", | ||
"version": "0.1.1", | ||
"description": "Adapter to connect Easee Wallbox", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -32,3 +32,8 @@ ![Logo](admin/easee.png) | ||
* (Newan) add energy used values | ||
### 0.1.0 | ||
* (Newan) Preparation for the first stable version | ||
### 0.1.1 | ||
* (Newan) Password encrypt + bugfix for the stable version | ||
## Donation | ||
@@ -40,3 +45,3 @@ [![](https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=L55UBQJKJEUJL) | ||
Copyright (c) 2021 Newan <info@newan.de> | ||
Copyright (c) 2021 Newan <iobroker@newan.de> | ||
@@ -43,0 +48,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
113220
1019
62