foxriver76 / ioBroker.sonnen

An ioBroker adapter for sonnen batterys.
MIT License
17 stars 8 forks source link

Zusätzliche Datenpunkte für Inverter und Powermeter benötigt #297

Closed ichaufgithub closed 6 months ago

ichaufgithub commented 6 months ago

Hallo foxriver76!

Ich bräuchte ein paar zusätzliche Datenpunkte. Die Datenpunkte sind unter der API V2 vorhanden. Unter: inverter: vorhanden: pacTotal, tmax, ubat benötigt: fac, iac_total, ibat, ipv, pac, pbat, phi, ppv, sac_total, uac, upv

powermeter: vorhanden: a_l1, a_l2, a_l3, v_l1_l2, v_l2_l3, v_l3_l1, v_l1_n, v_l2_n, v_l3_n, kwh_exported, kwh_imported, w_l1, w_l2, w_l3 benötigt: va_total, var_total, w_total

Ich hab es auf meinem Testsystem folgendermasen getestet:

File: main.js: -------------------------------INVERTER Datenpunkte----------------------- EXIST promises.push(this.setStateAsync('inverter.pacTotal', invererData.pac_total, true)); promises.push(this.setStateAsync('inverter.tmax', invererData.tmax, true)); promises.push(this.setStateAsync('inverter.ubat', invererData.ubat, true)); ENDEXIST ADD promises.push(this.setStateAsync('inverter.fac', invererData.fac, true)); promises.push(this.setStateAsync('inverter.iac_total', invererData.iac_total, true)); promises.push(this.setStateAsync('inverter.ibat', invererData.ibat, true)); promises.push(this.setStateAsync('inverter.ipv', invererData.ipv, true)); promises.push(this.setStateAsync('inverter.pac_microgrid', invererData.pac_microgrid, true)); promises.push(this.setStateAsync('inverter.pbat', invererData.pbat, true)); promises.push(this.setStateAsync('inverter.phi', invererData.phi, true)); promises.push(this.setStateAsync('inverter.ppv', invererData.ppv, true)); promises.push(this.setStateAsync('inverter.sac_total', invererData.sac_total, true)); promises.push(this.setStateAsync('inverter.uac', invererData.uac, true)); promises.push(this.setStateAsync('inverter.upv', invererData.upv, true)); ENDADD -----------------------------POWERMETER Datenpunkte---------------------- EXIST const relevantStates = [ 'a_l1', 'a_l2', 'a_l3', 'v_l1_l2', 'v_l2_l3', 'v_l3_l1', 'v_l1_n', 'v_l2_n', 'v_l3_n', 'kwh_exported', 'kwh_imported', 'w_l1', 'w_l2', 'w_l3' ENDEXIST ADD:, 'va_total', 'var_total', 'w_total' ENDADD

File: build/utils.js:

-------------------------------INVERTER Datenpunkte----------------------- EXIST exports.apiStatesV2 = [ ENDEXIST ADD { _id: 'inverter.fac', type: 'state', common: { name: 'AC frequency', type: 'number', role: 'value.frequency', read: true, write: false, desc: 'AC frequency in Hz', unit: 'Hz' }, native: {} }, { _id: 'inverter.iac_total', type: 'state', common: { name: 'AC Current Total', type: 'number', role: 'value.current', read: true, write: false, desc: 'Total AC Current', unit: 'A' }, native: {} }, { _id: 'inverter.ibat', type: 'state', common: { name: 'DC Current', type: 'number', role: 'value.current', read: true, write: false, desc: 'DC Current', unit: 'A' }, native: {} }, { _id: 'inverter.ipv', type: 'state', common: { name: 'ipv', type: 'number', role: 'value.current', read: true, write: false, desc: 'ipv', unit: 'A' }, native: {} }, { _id: 'inverter.pac_microgrid', type: 'state', common: { name: 'AC Power microgrid', type: 'number', role: 'value.power', read: true, write: false, desc: 'AC Power microgrid', unit: 'W' }, native: {} }, { _id: 'inverter.pbat', type: 'state', common: { name: 'Power Battery', type: 'number', role: 'value.power', read: true, write: false, desc: 'Power Battery', unit: 'W' }, native: {} }, { _id: 'inverter.phi', type: 'state', common: { name: 'Phase Shift phi', type: 'number', role: 'value', read: true, write: false, desc: 'Phase Shift phi', unit: '°' }, native: {} }, { _id: 'inverter.ppv', type: 'state', common: { name: 'ppv', type: 'number', role: 'value.power', read: true, write: false, desc: 'ppv', unit: 'W' }, native: {} }, { _id: 'inverter.sac_total', type: 'state', common: { name: 'sac Total', type: 'number', role: 'value.power', read: true, write: false, desc: 'sac Total', unit: 'VA' }, native: {} }, { _id: 'inverter.uac', type: 'state', common: { name: 'AC Voltage', type: 'number', role: 'value.voltage', read: true, write: false, desc: 'AC Voltage', unit: 'V' }, native: {} }, { _id: 'inverter.upv', type: 'state', common: { name: 'upv', type: 'number', role: 'value.voltage', read: true, write: false, desc: 'upv', unit: 'V' }, native: {} } ENDADD -----------------------------POWERMETER Datenpunkte---------------------- POWERMETER: EXIST const getPowermeterStates = (id, direction) => { return [ ENDEXIST ADD: { _id: powermeter.${id}.va_total, type: 'state', common: { name: 'Apparent Power Total', type: 'number', role: 'value.power', read: true, write: false, desc: 'Apparent Power Total', unit: 'VA' }, native: {} }, { _id: powermeter.${id}.var_total, type: 'state', common: { name: 'Reactive Power Total', type: 'number', role: 'value.power', read: true, write: false, desc: 'Reactive Power Total', unit: 'VAr' }, native: {} }, { _id: powermeter.${id}.w_total, type: 'state', common: { name: 'Active Power Total', type: 'number', role: 'value.power', read: true, write: false, desc: 'Active Power Total', unit: 'W' }, native: {} } ENDADD

Das Ganzs soll dann so aussehen wie im Anhang: Inverter powermeter

Vielen Dank! Robert

foxriver76 commented 6 months ago

Habe es eingebaut, falls du mit der Struktur schon etwas machst, im Inverter Endpunkt waren die DPS immer Camel Case, so habe ich es für die neuen auch gemacht. Also sac_total ist im Adapter dann sacTotal - ich weiß ist nicht konsequent im ganzen Adapter aber zumindest in dem Channel.

Danke jedenfalls für die Definitionen, das spart super viel Zeit.