iobroker.evcc
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -73,2 +73,4 @@ "use strict"; | ||
} | ||
//legen - pürfen controls | ||
this.createEvccControl(); | ||
//holen für den Start einmal alle Daten | ||
@@ -139,2 +141,10 @@ this.getEvccData(); | ||
break; | ||
case 'limitSoc': | ||
this.log.info('Set limitSoc on loadpointindex: ' + idProperty[3]); | ||
this.setEvccLimitSoc(idProperty[3], Number(state.val)); | ||
break; | ||
case 'vehicleName': | ||
this.log.info('Set vehicleName on loadpointindex: ' + idProperty[3]); | ||
this.setEvccVehicle(idProperty[3], state.val); | ||
break; | ||
default: | ||
@@ -151,4 +161,19 @@ switch (idProperty[4]) { | ||
default: | ||
this.log.debug(JSON.stringify(idProperty)); | ||
this.log.warn(`Event with state ${id} changed: ${state.val} (ack = ${state.ack}) not found`); | ||
switch (idProperty[3]) { | ||
case 'bufferSoc': | ||
this.log.info('Set bufferSoc on evcc'); | ||
this.setEvccBufferSoc(Number(state.val)); | ||
break; | ||
case 'bufferStartSoc': | ||
this.log.info('Set bufferStartSoc on evcc'); | ||
this.setEvccBufferStartSoc(Number(state.val)); | ||
break; | ||
case 'prioritySoc': | ||
this.log.info('Set prioritySoc on evcc'); | ||
this.setEvccPrioritySoc(Number(state.val)); | ||
break; | ||
default: | ||
this.log.debug(JSON.stringify(idProperty)); | ||
this.log.warn(`Event with state ${id} changed: ${state.val} (ack = ${state.ack}) not found`); | ||
} | ||
} | ||
@@ -178,13 +203,14 @@ } | ||
}); | ||
let tmpListVehicles = []; | ||
if (typeof (response.data.result.vehicles) == 'object') { | ||
/*let tmpListVehicles: Vehicle[] = []; | ||
if (typeof(response.data.result.vehicles) == 'object') { | ||
// haben nur ein Fahrzeug daher etwas umbauen | ||
tmpListVehicles.push(response.data.result.vehicles); | ||
} | ||
else { | ||
} else { | ||
tmpListVehicles = response.data.result.vehicles; | ||
}*/ | ||
for (const vehicleKey in response.data.result.vehicles) { | ||
const vehicle = response.data.result.vehicles[vehicleKey]; | ||
await this.setVehicleData(vehicleKey, vehicle); | ||
} | ||
tmpListVehicles.forEach(async (vehicle) => { | ||
await this.setVehicleData(vehicle); | ||
}); | ||
//statistik einzeln ausführen | ||
@@ -211,3 +237,48 @@ /*const tmpListVehicle: Vehicle[] = response.data.result.vehicles; | ||
} | ||
async createEvccControl() { | ||
//Control Objects und Buttons: | ||
await this.setObjectNotExistsAsync('control.bufferSoc', { | ||
type: 'state', | ||
common: { | ||
name: 'bufferSoc', | ||
type: 'number', | ||
role: 'value', | ||
read: true, | ||
write: true, | ||
unit: '%' | ||
}, | ||
native: {}, | ||
}); | ||
this.subscribeStates('control.bufferSoc'); | ||
//http://192.168.178.10:7070/api/prioritysoc/50 | ||
await this.setObjectNotExistsAsync('control.prioritySoc', { | ||
type: 'state', | ||
common: { | ||
name: 'prioritySoc', | ||
type: 'number', | ||
role: 'value', | ||
read: true, | ||
write: true, | ||
unit: '%' | ||
}, | ||
native: {}, | ||
}); | ||
this.subscribeStates('control.prioritySoc'); | ||
//bufferStartSoc | ||
await this.setObjectNotExistsAsync('control.bufferStartSoc', { | ||
type: 'state', | ||
common: { | ||
name: 'bufferStartSoc', | ||
type: 'number', | ||
role: 'value', | ||
read: true, | ||
write: true, | ||
unit: '%' | ||
}, | ||
native: {}, | ||
}); | ||
this.subscribeStates('control.bufferStartSoc'); | ||
} | ||
async setStatusEvcc(daten) { | ||
//Dynamisch erstellen | ||
for (const lpEntry in daten) { | ||
@@ -220,2 +291,6 @@ const lpType = typeof daten[lpEntry]; // get Type of Variable as String, like string/number/boolean | ||
} | ||
//Update der Control Werte | ||
lpEntry == 'bufferStartSoc' && await this.setStateAsync('control.bufferStartSoc', { val: lpData, ack: true }); | ||
lpEntry == 'prioritySoc' && await this.setStateAsync('control.prioritySoc', { val: lpData, ack: true }); | ||
lpEntry == 'bufferSoc' && await this.setStateAsync('control.bufferSoc', { val: lpData, ack: true }); | ||
if (lpType == 'object') { | ||
@@ -241,13 +316,5 @@ lpData = JSON.stringify(daten[lpEntry]); | ||
*/ | ||
async setVehicleData(vehicle) { | ||
//Vehicle kann es X fach geben | ||
const vehicleID = Object.keys(vehicle)[0]; | ||
this.log.debug('Vehicle mit index ' + vehicleID + ' gefunden...'); | ||
this.getObject('verhicle.' + vehicleID, (err, obj) => { | ||
if (!obj) { | ||
// Das Objekt existiert nicht | ||
this.log.info(`Das Objekt ${vehicleID} braucht noch controls!`); | ||
} | ||
}); | ||
await this.extendObjectAsync(`vehicle.${vehicleID}.title`, { | ||
async setVehicleData(vehicleIndex, vehicleData) { | ||
this.log.debug('Vehicle mit index ' + vehicleIndex + ' gefunden...'); | ||
await this.extendObjectAsync(`vehicle.${vehicleIndex}.title`, { | ||
type: 'state', | ||
@@ -263,4 +330,4 @@ common: { | ||
}); | ||
await this.setState(`vehicle.${vehicleID}.title`, vehicle[vehicleID].title, true); | ||
await this.extendObjectAsync(`vehicle.${vehicleID}.minSoc`, { | ||
await this.setState(`vehicle.${vehicleIndex}.title`, vehicleData.title, true); | ||
await this.extendObjectAsync(`vehicle.${vehicleIndex}.minSoc`, { | ||
type: 'state', | ||
@@ -273,8 +340,9 @@ common: { | ||
role: 'value', | ||
unit: '%' | ||
}, | ||
native: {}, | ||
}); | ||
this.subscribeStates(`vehicle.${vehicleID}.minSoc`); | ||
await this.setStateAsync(`vehicle.${vehicleID}.minSoc`, { val: vehicle[vehicleID].minSoc !== undefined ? vehicle[vehicleID].minSoc : 0, ack: true }); | ||
await this.extendObjectAsync(`vehicle.${vehicleID}.limitSoc`, { | ||
this.subscribeStates(`vehicle.${vehicleIndex}.minSoc`); | ||
await this.setStateAsync(`vehicle.${vehicleIndex}.minSoc`, { val: vehicleData.minSoc !== undefined ? vehicleData.minSoc : 0, ack: true }); | ||
await this.extendObjectAsync(`vehicle.${vehicleIndex}.limitSoc`, { | ||
type: 'state', | ||
@@ -287,7 +355,8 @@ common: { | ||
role: 'value', | ||
unit: '%' | ||
}, | ||
native: {}, | ||
}); | ||
this.subscribeStates(`vehicle.${vehicleID}.limitSoc`); | ||
await this.setStateAsync(`vehicle.${vehicleID}.limitSoc`, { val: vehicle[vehicleID].limitSoc !== undefined ? vehicle[vehicleID].limitSoc : 100, ack: true }); | ||
this.subscribeStates(`vehicle.${vehicleIndex}.limitSoc`); | ||
await this.setStateAsync(`vehicle.${vehicleIndex}.limitSoc`, { val: vehicleData.limitSoc !== undefined ? vehicleData.limitSoc : 100, ack: true }); | ||
} | ||
@@ -313,2 +382,4 @@ /** | ||
await this.setStateAsync('loadpoint.' + index + '.control.phasesConfigured', { val: loadpoint.phasesConfigured, ack: true }); | ||
await this.setStateAsync('loadpoint.' + index + '.control.limitSoc', { val: loadpoint.limitSoc, ack: true }); | ||
await this.setStateAsync('loadpoint.' + index + '.control.vehicleName', { val: loadpoint.vehicleName, ack: true }); | ||
//Alle Werte unter Status veröffentlichen | ||
@@ -379,3 +450,3 @@ this.setStatusLoadPoint(loadpoint, index); | ||
role: 'button', | ||
read: true, | ||
read: false, | ||
write: true, | ||
@@ -392,3 +463,3 @@ }, | ||
role: 'button', | ||
read: true, | ||
read: false, | ||
write: true, | ||
@@ -405,3 +476,3 @@ }, | ||
role: 'button', | ||
read: true, | ||
read: false, | ||
write: true, | ||
@@ -418,3 +489,3 @@ }, | ||
role: 'button', | ||
read: true, | ||
read: false, | ||
write: true, | ||
@@ -467,3 +538,3 @@ }, | ||
role: 'value', | ||
read: false, | ||
read: true, | ||
write: true, | ||
@@ -480,3 +551,3 @@ }, | ||
role: 'value', | ||
read: false, | ||
read: true, | ||
write: true, | ||
@@ -487,2 +558,27 @@ }, | ||
this.subscribeStates('loadpoint.' + index + '.control.disableThreshold'); | ||
await this.setObjectNotExistsAsync('loadpoint.' + index + '.control.limitSoc', { | ||
type: 'state', | ||
common: { | ||
name: 'limitSoc', | ||
type: 'number', | ||
role: 'value', | ||
read: true, | ||
write: true, | ||
unit: '%' | ||
}, | ||
native: {}, | ||
}); | ||
this.subscribeStates('loadpoint.' + index + '.control.limitSoc'); | ||
await this.setObjectNotExistsAsync('loadpoint.' + index + '.control.vehicleName', { | ||
type: 'state', | ||
common: { | ||
name: 'vehicleName', | ||
type: 'string', | ||
role: 'value', | ||
read: true, | ||
write: true, | ||
}, | ||
native: {}, | ||
}); | ||
this.subscribeStates('loadpoint.' + index + '.control.vehicleName'); | ||
} | ||
@@ -586,2 +682,29 @@ //Funktionen zum sterun von evcc | ||
} | ||
setEvccLimitSoc(index, value) { | ||
this.log.debug('call: ' + 'http://' + this.ip + '/api/loadpoints/' + index + '/limitsoc/' + value); | ||
axios_1.default.post('http://' + this.ip + '/api/loadpoints/' + index + '/limitsoc/' + value, { timeout: this.timeout }).then(() => { | ||
this.log.info('Evcc update successful'); | ||
}).catch(error => { | ||
this.log.error('12 ' + error.message); | ||
}); | ||
} | ||
setEvccVehicle(index, value) { | ||
//Wenn der String leer ist, wird es das GAstauto und wir müssen löschen | ||
if (value == '') { | ||
this.log.debug('call: ' + 'http://' + this.ip + '/api/loadpoints/' + index + '/vehicle'); | ||
axios_1.default.delete('http://' + this.ip + '/api/loadpoints/' + index + '/vehicle', { timeout: this.timeout }).then(() => { | ||
this.log.info('Evcc update successful'); | ||
}).catch(error => { | ||
this.log.error('setEvccVehicle: ' + error.message); | ||
}); | ||
} | ||
else { | ||
this.log.debug('call: ' + 'http://' + this.ip + '/api/loadpoints/' + index + '/vehicle/' + value); | ||
axios_1.default.post('http://' + this.ip + '/api/loadpoints/' + index + '/vehicle/' + value, { timeout: this.timeout }).then(() => { | ||
this.log.info('Evcc update successful'); | ||
}).catch(error => { | ||
this.log.error('setEvccVehicle: ' + error.message); | ||
}); | ||
} | ||
} | ||
setEvccDeleteTargetTime(index) { | ||
@@ -611,2 +734,26 @@ this.log.debug('call: ' + 'http://' + this.ip + '/api/loadpoints/' + index + '/target/time'); | ||
} | ||
setEvccBufferSoc(bufferSoc) { | ||
this.log.debug('call: ' + 'http://' + this.ip + '/api/buffersoc/' + bufferSoc); | ||
axios_1.default.post('http://' + this.ip + '/api/buffersoc/' + bufferSoc, { timeout: this.timeout }).then(() => { | ||
this.log.info('Evcc update successful'); | ||
}).catch(error => { | ||
this.log.error('setEvccBufferSoc ' + error.message); | ||
}); | ||
} | ||
setEvccBufferStartSoc(bufferStartSoc) { | ||
this.log.debug('call: ' + 'http://' + this.ip + '/api/bufferstartsoc/' + bufferStartSoc); | ||
axios_1.default.post('http://' + this.ip + '/api/bufferstartsoc/' + bufferStartSoc, { timeout: this.timeout }).then(() => { | ||
this.log.info('Evcc update successful'); | ||
}).catch(error => { | ||
this.log.error('setEvccBufferStartSoc ' + error.message); | ||
}); | ||
} | ||
setEvccPrioritySoc(prioritySoc) { | ||
this.log.debug('call: ' + 'http://' + this.ip + '/api/prioritysoc/' + prioritySoc); | ||
axios_1.default.post('http://' + this.ip + '/api/prioritysoc/' + prioritySoc, { timeout: this.timeout }).then(() => { | ||
this.log.info('Evcc update successful'); | ||
}).catch(error => { | ||
this.log.error('setEvccBufferStartSoc ' + error.message); | ||
}); | ||
} | ||
} | ||
@@ -613,0 +760,0 @@ if (require.main !== module) { |
{ | ||
"common": { | ||
"name": "evcc", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"news": { | ||
"0.1.1": { | ||
"en": "add batteriemangement\nadd Soc limit to loadpoint\nchange vehicle on loadpoint", | ||
"de": "batteriemangement hinzufügen\nhinzufügen Soc-Begrenzung an Ladepunkt\nfahrzeugwechsel bei lastpunkt", | ||
"ru": "добавить batteriemangement\nдобавить Предел Soc для точки нагрузки\nпеременное транспортное средство на точке нагрузки", | ||
"pt": "adicionar batteriemangement\nadicionar Limite de soc para ponto de carga\nveículo de mudança no ponto de carga", | ||
"nl": "batteriebeheer toevoegen\ntoevoegen Soc-limiet tot belastingspunt\nhet voertuig op het laadpunt wijzigen", | ||
"fr": "ajouter batteriemangiment\najouter Limite de Soc au point de charge\nchangement de véhicule au point de charge", | ||
"it": "aggiungere batteriemangement\naggiungere Limite di soc per punto di carico\ncambiare veicolo sul punto di carico", | ||
"es": "añadir batteriemangement\nañadir Límite de soc a punto de carga\nvehículo de cambio en el punto de carga", | ||
"pl": "dodaj batteriemangement\ndodaj Granica SOC do punktu ładowania\nzmiana pojazdu w punkcie załadunku", | ||
"uk": "додати batteriemangement\nдодати Обмеження Soc до Loadpoint\nзміна транспортного засобу на loadpoint", | ||
"zh-cn": "添加击鼓\n添加 装入点的索克限制\n在负载点更换车辆" | ||
}, | ||
"0.1.0": { | ||
@@ -81,14 +94,2 @@ "en": "rewrite for evcc api changes\nadd multiple vehicle", | ||
"zh-cn": "首次释放" | ||
}, | ||
"0.0.3": { | ||
"en": "(Newan) support evcc 0.9X - change to jsonConfig GUI", | ||
"de": "(Newan) Unterstützung von evcc 0.9X - Wechsel zu jsonConfig GUI", | ||
"ru": "(Newan) поддержка evcc 0.9X - изменение графического интерфейса jsonConfig", | ||
"pt": "(Newan) suporte evcc 0.9X - mude para jsonConfig GUI", | ||
"nl": "(Newan) ondersteuning voor evcc 0.9X - verander naar jsonConfig GUI", | ||
"fr": "(Newan) prend en charge evcc 0.9X - passe à l'interface graphique jsonConfig", | ||
"it": "(Newan) supporta evcc 0.9X - cambia in jsonConfig GUI", | ||
"es": "(Newan) soporte evcc 0.9X - cambio a jsonConfig GUI", | ||
"pl": "(Newan) obsługuje evcc 0.9X - zmiana na GUI jsonConfig", | ||
"zh-cn": "(Newan) 支持 evcc 0.9X - 更改为 jsonConfig GUI" | ||
} | ||
@@ -184,147 +185,4 @@ }, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.batteryConfigured", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "batteryConfigured", | ||
"type": "boolean", | ||
"read": true, | ||
"write": false, | ||
"def": false | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.batteryPower", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "batteryPower", | ||
"type": "number", | ||
"read": true, | ||
"write": false, | ||
"def": 0 | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.batterySoc", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "batterySoc", | ||
"type": "number", | ||
"read": true, | ||
"write": false, | ||
"def": 0 | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.gridConfigured", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "gridConfigured", | ||
"type": "boolean", | ||
"read": true, | ||
"write": false, | ||
"def": false | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.gridCurrents", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "gridCurrents", | ||
"type": "string", | ||
"read": true, | ||
"write": false, | ||
"def": "" | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.gridPower", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "gridPower", | ||
"type": "number", | ||
"read": true, | ||
"write": false, | ||
"def": 0 | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.homePower", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "homePower", | ||
"type": "number", | ||
"read": true, | ||
"write": false, | ||
"def": 0 | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.prioritySoc", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "prioritySoc", | ||
"type": "number", | ||
"read": true, | ||
"write": false, | ||
"def": 0 | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.pvConfigured", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "pvConfigured", | ||
"type": "boolean", | ||
"read": true, | ||
"write": false, | ||
"def": false | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.pvPower", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "pvPower", | ||
"type": "number", | ||
"read": true, | ||
"write": false, | ||
"def": 0 | ||
}, | ||
"native": {} | ||
}, | ||
{ | ||
"_id": "status.siteTitle", | ||
"type": "state", | ||
"common": { | ||
"role": "state", | ||
"name": "siteTitle", | ||
"type": "string", | ||
"read": true, | ||
"write": false, | ||
"def": "" | ||
}, | ||
"native": {} | ||
} | ||
] | ||
} |
{ | ||
"name": "iobroker.evcc", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Controll evcc over rest api", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -8,3 +8,2 @@ ![Logo](admin/evcc.png) | ||
![Number of Installations (stable)](https://iobroker.live/badges/evcc-stable.svg) | ||
[![Dependency Status](https://img.shields.io/david/Newan/iobroker.evcc.svg)](https://david-dm.org/Newan/iobroker.evcc) | ||
@@ -26,2 +25,7 @@ [![NPM](https://nodei.co/npm/iobroker.evcc.png?downloads=true)](https://nodei.co/npm/iobroker.evcc/) | ||
--> | ||
### 0.1.1 (2024-01-07) | ||
* (Newan) add batteriemangement | ||
* (Newan) add Soc limit to loadpoint | ||
* (Newan) change vehicle on loadpoint | ||
### 0.1.0 (2023-12-30) | ||
@@ -57,3 +61,3 @@ * (Newan) rewrite for evcc api changes | ||
Copyright (c) 2023 Newan <info@newan.de> | ||
Copyright (c) 2024 Newan <info@newan.de> | ||
@@ -60,0 +64,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86841
991
77