iobroker.luxtronik2-controller 1.2.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -16
- package/admin/jsonConfig.json +50 -6
- package/admin/webcomponents/luxtronik-base.js +242 -0
- package/admin/webcomponents/luxtronik-cop-cockpit.js +303 -0
- package/admin/webcomponents/luxtronik-cop-cockpit.json +44 -0
- package/admin/webcomponents/luxtronik-dhw-tank.js +505 -0
- package/admin/webcomponents/luxtronik-dhw-tank.json +42 -0
- package/admin/webcomponents/luxtronik-diagnostics-feed.js +431 -0
- package/admin/webcomponents/luxtronik-diagnostics-feed.json +42 -0
- package/admin/webcomponents/luxtronik-health-monitor.js +378 -0
- package/admin/webcomponents/luxtronik-health-monitor.json +44 -0
- package/admin/webcomponents/luxtronik-heatcurve-tuner.js +515 -0
- package/admin/webcomponents/luxtronik-heatcurve-tuner.json +42 -0
- package/admin/webcomponents/luxtronik-hydraulics-flow.js +464 -0
- package/admin/webcomponents/luxtronik-hydraulics-flow.json +34 -0
- package/admin/webcomponents/luxtronik-schedule-radar.js +448 -0
- package/admin/webcomponents/luxtronik-schedule-radar.json +34 -0
- package/admin/webcomponents/luxtronik-status-card.js +2 -2
- package/build/mapping/info.js +2 -0
- package/build/mapping/info.js.map +2 -2
- package/build/pvManager.js +31 -17
- package/build/pvManager.js.map +2 -2
- package/io-package.json +39 -29
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -103,6 +103,27 @@ _This project is not affiliated with Alpha Innotec, Novelan, ait-deutschland Gmb
|
|
|
103
103
|
//### **WORK IN PROGRESS**
|
|
104
104
|
|
|
105
105
|
## Changelog
|
|
106
|
+
### 1.3.1 (2026-11-25)
|
|
107
|
+
|
|
108
|
+
- Fixed missing error and outage descriptions in `<luxtronik-diagnostics-feed>` by expanding the JSON parser with a generic text-field fallback
|
|
109
|
+
- Marked `hours_compressor1` and `starts_compressor1` as `required: true` in `src/mapping/info.ts` so compressor start counts and average cycle duration (`Ø MIN / TAKT`) in `<luxtronik-health-monitor>` are always populated regardless of visibility flags
|
|
110
|
+
- Added a target temperature stepper (`−` / input / `+`) to `<luxtronik-dhw-tank>` allowing direct adjustment of `temperature_hot_water_target` alongside the one-shot heating trigger
|
|
111
|
+
- Switched PV surplus calculation in `src/pvManager.ts` to a signed net-balance (`grid + battery + heat pump power`) and added optional heat pump power consumption compensation (`pv_wp_power_active`, `pv_wp_power_dp`, `pv_wp_power_unit`) so an already running compressor cycle no longer cancels out available PV surplus
|
|
112
|
+
|
|
113
|
+
### 1.3.0 (2026-11-25)
|
|
114
|
+
|
|
115
|
+
- Fixed COP/JAZ datapoint paths (`Information.16_Efficiency.Total.*`) in `<luxtronik-status-card>` so daily COP and annual JAZ values populate correctly
|
|
116
|
+
- Added shared Web Component base class (`luxtronik-base.js`) and two new `@iobroker/web-components` widgets for Aura, VIS-2, and WebUI:
|
|
117
|
+
- `<luxtronik-hydraulics-flow>`: animated hydraulics & energy flow diagram (heating, DHW, defrost reverse flow, ZWE1, dynamic inverter speed)
|
|
118
|
+
- `<luxtronik-dhw-tank>`: hot water tank level gauge with hysteresis recharge threshold, one-shot heating trigger, and animated ZIP countdown ring
|
|
119
|
+
|
|
120
|
+
- Added five additional `@iobroker/web-components` widgets for Aura, VIS-2, and WebUI (completing the 8-widget suite):
|
|
121
|
+
- `<luxtronik-heatcurve-tuner>`: interactive live heating curve with hysteresis band, heating limit indicator, live operating point, and parallel offset slider with preview and apply controls
|
|
122
|
+
- `<luxtronik-cop-cockpit>`: COP/JAZ efficiency matrix (Total, Heating, Hot Water across Today, 7 Days, Month, Year) with live COP calculation and lifetime totals
|
|
123
|
+
- `<luxtronik-health-monitor>`: compressor cycle duration gauge (avg. min/cycle), context-aware active lock/delay/defrost timers, and EEPROM write cycle monitor
|
|
124
|
+
- `<luxtronik-schedule-radar>`: 24-hour schedule bars for heating reduction, hot water lock times, and circulation pump windows with a live time marker
|
|
125
|
+
- `<luxtronik-diagnostics-feed>`: switchable error log and outage history feed with firmware update banner, changelog preview, and optional Modbus error reset
|
|
126
|
+
|
|
106
127
|
### 1.2.1 (2026-11-24)
|
|
107
128
|
|
|
108
129
|
- Fixed `temperature_target_return` being overwritten with `35.0 °C` in SHI Modbus mode when `sync_modbus_holding_1` (`10060`, room thermostat target) is enabled by removing the duplicate Modbus mapping from `src/mapping/info.ts`
|
|
@@ -119,22 +140,6 @@ _This project is not affiliated with Alpha Innotec, Novelan, ait-deutschland Gmb
|
|
|
119
140
|
- Fixed temporary hot water start impulses (`forceSoll` & `Zwangswarmwasser`) overshooting the actual target temperature by immediately restoring the baseline or active PV boost target once hot water generation is actively running (`WP_BZ_akt = 1` & `VD1`)
|
|
120
141
|
- Added native controller state duration check (`rawValues[120]`) to `istBetriebszustandAelterAls()` for reliable cycle timing at longer polling intervals
|
|
121
142
|
|
|
122
|
-
### 1.1.0 (2026-11-24)
|
|
123
|
-
|
|
124
|
-
- Replaced static `35 °C` / `+10.0 K` jump in cycle optimization (`CycleOpt-PreHeat` / `CycleOpt-AfterWW`) and forced heating (`Zwangsheizen`) with a dynamic, hysteresis-based relative offset (`base offset + hysteresis + 0.5 K`) via `heating_temperature` (volatile SHI `10002` / native Param `1`) to prevent screed overshoot and short-cycling in well-insulated homes
|
|
125
|
-
- Added heating release checks (`P0003` / `C0125`) and hot water lock-time schedule checks (`P0004` / `C0124` / `P405..P505`, including midnight wrap-around and 25-minute pre-heat lookahead) to cycle optimization
|
|
126
|
-
- Improved `Heizen_nach_Wasser` reset handling (3-minute spike guard instead of 10 minutes once return target is reached), immediate pre-heat offset reset on WW start, and automatic cleanup of stale `CycleOpt-PreHeat` offsets in idle without affecting manual `Zwangsheizen`
|
|
127
|
-
- Added automatic restoration of temporary hot water target increases (`forceSoll` & `Zwangswarmwasser`) after WW completion even when `idle_defaults_aktiv` is disabled
|
|
128
|
-
- Eliminated PV boost flip-flop writes during idle and cycle transitions by delegating directly to `evaluatePvBoost` without intermediate resets to baseline
|
|
129
|
-
- Fixed raw fallback indices in `calculateTotalEnergy()` to read `rawParams[1136]/[1137]` (factor `0.01`) instead of `rawValues[156]/[157]` and added 2-decimal rounding
|
|
130
|
-
|
|
131
|
-
### 1.0.4 (2026-11-21)
|
|
132
|
-
|
|
133
|
-
- Optimized V3.9x SHI Modbus Hybrid mode to achieve zero EEPROM write cycles during cycle optimization, pre-heating, and forced heating (uses volatile SHI offset `+10.0 K` via Holding 23 / `10002` instead of base point parameter `12`)
|
|
134
|
-
- Fixed startup order in `onReady()` so Modbus TCP availability is checked before PV initialization and hardware ZIP timer disable runs after initial raw parameter fetch
|
|
135
|
-
- Improved PV startup recovery to only reset setpoints if a PV boost was actually active before restart, and decoupled PV heating boost from active SHI cycle optimization
|
|
136
|
-
- Released SHI DHW mode (`10005 = 0`) when reverting hot water target to baseline and avoided unnecessary HUP voltage writes in `setIdleDefaults()` when HUP optimization is disabled
|
|
137
|
-
|
|
138
143
|
## License
|
|
139
144
|
|
|
140
145
|
MIT License
|
package/admin/jsonConfig.json
CHANGED
|
@@ -1676,6 +1676,50 @@
|
|
|
1676
1676
|
"lg": 4,
|
|
1677
1677
|
"xl": 4
|
|
1678
1678
|
},
|
|
1679
|
+
"pv_wp_power_active": {
|
|
1680
|
+
"type": "checkbox",
|
|
1681
|
+
"label": "Include current heat pump power consumption",
|
|
1682
|
+
"help": "Adds the heat pump's own power draw to the net PV balance so an already running cycle does not cancel out the PV surplus.",
|
|
1683
|
+
"newLine": true,
|
|
1684
|
+
"default": false,
|
|
1685
|
+
"hidden": "!data.pv_active",
|
|
1686
|
+
"xs": 12,
|
|
1687
|
+
"sm": 12,
|
|
1688
|
+
"md": 12,
|
|
1689
|
+
"lg": 12,
|
|
1690
|
+
"xl": 12
|
|
1691
|
+
},
|
|
1692
|
+
"pv_wp_power_dp": {
|
|
1693
|
+
"type": "objectId",
|
|
1694
|
+
"label": "Datapoint for heat pump power",
|
|
1695
|
+
"hidden": "!data.pv_active || !data.pv_wp_power_active",
|
|
1696
|
+
"xs": 12,
|
|
1697
|
+
"sm": 12,
|
|
1698
|
+
"md": 8,
|
|
1699
|
+
"lg": 8,
|
|
1700
|
+
"xl": 8
|
|
1701
|
+
},
|
|
1702
|
+
"pv_wp_power_unit": {
|
|
1703
|
+
"type": "select",
|
|
1704
|
+
"label": "Unit",
|
|
1705
|
+
"options": [
|
|
1706
|
+
{
|
|
1707
|
+
"label": "Watt (W)",
|
|
1708
|
+
"value": "W"
|
|
1709
|
+
},
|
|
1710
|
+
{
|
|
1711
|
+
"label": "Kilowatt (kW)",
|
|
1712
|
+
"value": "kW"
|
|
1713
|
+
}
|
|
1714
|
+
],
|
|
1715
|
+
"default": "W",
|
|
1716
|
+
"hidden": "!data.pv_active || !data.pv_wp_power_active",
|
|
1717
|
+
"xs": 12,
|
|
1718
|
+
"sm": 12,
|
|
1719
|
+
"md": 4,
|
|
1720
|
+
"lg": 4,
|
|
1721
|
+
"xl": 4
|
|
1722
|
+
},
|
|
1679
1723
|
"header_pv_start": {
|
|
1680
1724
|
"type": "header",
|
|
1681
1725
|
"text": "Activation (Boost)",
|
|
@@ -3186,11 +3230,11 @@
|
|
|
3186
3230
|
"sync_hours_compressor1": {
|
|
3187
3231
|
"type": "checkbox",
|
|
3188
3232
|
"label": {
|
|
3189
|
-
"en": "Operating hours compressor 1",
|
|
3190
|
-
"de": "Operating hours compressor 1"
|
|
3233
|
+
"en": "Operating hours compressor 1 (System critical)",
|
|
3234
|
+
"de": "Operating hours compressor 1 (Systemrelevant)"
|
|
3191
3235
|
},
|
|
3192
3236
|
"default": true,
|
|
3193
|
-
"disabled":
|
|
3237
|
+
"disabled": true,
|
|
3194
3238
|
"xs": 12,
|
|
3195
3239
|
"sm": 6,
|
|
3196
3240
|
"md": 3,
|
|
@@ -3200,11 +3244,11 @@
|
|
|
3200
3244
|
"sync_starts_compressor1": {
|
|
3201
3245
|
"type": "checkbox",
|
|
3202
3246
|
"label": {
|
|
3203
|
-
"en": "Switch cycles compressor 1",
|
|
3204
|
-
"de": "Switch cycles compressor 1"
|
|
3247
|
+
"en": "Switch cycles compressor 1 (System critical)",
|
|
3248
|
+
"de": "Switch cycles compressor 1 (Systemrelevant)"
|
|
3205
3249
|
},
|
|
3206
3250
|
"default": true,
|
|
3207
|
-
"disabled":
|
|
3251
|
+
"disabled": true,
|
|
3208
3252
|
"xs": 12,
|
|
3209
3253
|
"sm": 6,
|
|
3210
3254
|
"md": 3,
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemeinsame Basisklasse für alle Luxtronik `@iobroker/web-components`.
|
|
3
|
+
* Kapselt Socket-Handling, State-Abos, Edit-Mode-Schutz und Formatierungs-Helfer.
|
|
4
|
+
*/
|
|
5
|
+
export class LuxtronikBaseCard extends HTMLElement {
|
|
6
|
+
static get stateMap() {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static get actionMap() {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.attachShadow({ mode: 'open' });
|
|
17
|
+
this._socket = null;
|
|
18
|
+
this._settings = {};
|
|
19
|
+
this._theme = '';
|
|
20
|
+
this._editMode = false;
|
|
21
|
+
this._values = {};
|
|
22
|
+
this._subscriptions = [];
|
|
23
|
+
this._rendered = false;
|
|
24
|
+
this._connected = false;
|
|
25
|
+
this._refs = {};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set socket(value) {
|
|
29
|
+
if (this._socket === value) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this._unsubscribeAll();
|
|
33
|
+
this._socket = value;
|
|
34
|
+
if (this._connected) {
|
|
35
|
+
this._resubscribe();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get socket() {
|
|
40
|
+
return this._socket;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
set settings(value) {
|
|
44
|
+
const prevInstance = this._getInstancePrefix();
|
|
45
|
+
this._settings = value && typeof value === 'object' ? value : {};
|
|
46
|
+
const nextInstance = this._getInstancePrefix();
|
|
47
|
+
|
|
48
|
+
if (this._connected && prevInstance !== nextInstance) {
|
|
49
|
+
this._resubscribe();
|
|
50
|
+
}
|
|
51
|
+
if (this._rendered) {
|
|
52
|
+
this._updateView();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get settings() {
|
|
57
|
+
return this._settings;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
set theme(value) {
|
|
61
|
+
this._theme = value || '';
|
|
62
|
+
if (this._theme === 'light' || this._theme === 'dark') {
|
|
63
|
+
this.setAttribute('theme', this._theme);
|
|
64
|
+
} else {
|
|
65
|
+
this.removeAttribute('theme');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get theme() {
|
|
70
|
+
return this._theme;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
set editMode(value) {
|
|
74
|
+
this._editMode = Boolean(value);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
get editMode() {
|
|
78
|
+
return this._editMode;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
connectedCallback() {
|
|
82
|
+
this._connected = true;
|
|
83
|
+
if (!this._rendered) {
|
|
84
|
+
this._renderBase();
|
|
85
|
+
this._collectRefs();
|
|
86
|
+
this._rendered = true;
|
|
87
|
+
}
|
|
88
|
+
this._resubscribe();
|
|
89
|
+
this._updateView();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
disconnectedCallback() {
|
|
93
|
+
this._connected = false;
|
|
94
|
+
this._unsubscribeAll();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
_collectRefs() {
|
|
98
|
+
this._refs = {};
|
|
99
|
+
this.shadowRoot.querySelectorAll('[data-ref]').forEach(el => {
|
|
100
|
+
this._refs[el.getAttribute('data-ref')] = el;
|
|
101
|
+
});
|
|
102
|
+
this.shadowRoot.querySelectorAll('[data-action]').forEach(btn => {
|
|
103
|
+
btn.addEventListener('click', () => this._triggerAction(btn.getAttribute('data-action')));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
_getInstancePrefix() {
|
|
108
|
+
const raw = this._settings?.instance;
|
|
109
|
+
if (!raw || typeof raw !== 'string') {
|
|
110
|
+
return '';
|
|
111
|
+
}
|
|
112
|
+
return raw.trim().replace(/^system\.adapter\./, '');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
_unsubscribeAll() {
|
|
116
|
+
if (this._socket && typeof this._socket.unsubscribeState === 'function') {
|
|
117
|
+
for (const { oid, handler } of this._subscriptions) {
|
|
118
|
+
try {
|
|
119
|
+
this._socket.unsubscribeState(oid, handler);
|
|
120
|
+
} catch {
|
|
121
|
+
/* ignore */
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
this._subscriptions = [];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
_resubscribe() {
|
|
129
|
+
this._unsubscribeAll();
|
|
130
|
+
this._values = {};
|
|
131
|
+
|
|
132
|
+
const prefix = this._getInstancePrefix();
|
|
133
|
+
if (!this._socket || !prefix) {
|
|
134
|
+
if (this._rendered) {
|
|
135
|
+
this._updateView();
|
|
136
|
+
}
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const map = this.constructor.stateMap || {};
|
|
141
|
+
for (const [key, relPath] of Object.entries(map)) {
|
|
142
|
+
const oid = `${prefix}.${relPath}`;
|
|
143
|
+
const handler = (_id, state) => {
|
|
144
|
+
this._values[key] = state ? state.val : null;
|
|
145
|
+
if (this._rendered) {
|
|
146
|
+
this._updateView();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
this._subscriptions.push({ oid, handler });
|
|
150
|
+
|
|
151
|
+
if (typeof this._socket.subscribeState === 'function') {
|
|
152
|
+
try {
|
|
153
|
+
this._socket.subscribeState(oid, handler);
|
|
154
|
+
} catch {
|
|
155
|
+
/* ignore */
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (typeof this._socket.getState === 'function') {
|
|
159
|
+
Promise.resolve(this._socket.getState(oid))
|
|
160
|
+
.then(state => {
|
|
161
|
+
if (state) {
|
|
162
|
+
this._values[key] = state.val;
|
|
163
|
+
if (this._rendered) {
|
|
164
|
+
this._updateView();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
.catch(() => {});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
_writeState(relPath, val) {
|
|
174
|
+
if (this._editMode) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const prefix = this._getInstancePrefix();
|
|
178
|
+
if (this._socket && prefix && relPath && typeof this._socket.setState === 'function') {
|
|
179
|
+
Promise.resolve(this._socket.setState(`${prefix}.${relPath}`, val, false)).catch(() => {});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
_triggerAction(actionKey) {
|
|
184
|
+
const map = this.constructor.actionMap || {};
|
|
185
|
+
if (map[actionKey]) {
|
|
186
|
+
this._writeState(map[actionKey], true);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
_toNum(val) {
|
|
191
|
+
if (val === null || val === undefined || val === '') {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
const n = parseFloat(String(val).replace(',', '.'));
|
|
195
|
+
return isNaN(n) ? null : n;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
_toBool(val) {
|
|
199
|
+
if (typeof val === 'boolean') {
|
|
200
|
+
return val;
|
|
201
|
+
}
|
|
202
|
+
if (typeof val === 'number') {
|
|
203
|
+
return val === 1;
|
|
204
|
+
}
|
|
205
|
+
const s = String(val || '')
|
|
206
|
+
.trim()
|
|
207
|
+
.toLowerCase();
|
|
208
|
+
return s === 'true' || s === '1' || s === 'ein' || s === 'on';
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
_fmtTemp(val, digits = 1) {
|
|
212
|
+
const n = this._toNum(val);
|
|
213
|
+
return n === null ? '–' : `${n.toFixed(digits)} °C`;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
_fmtNum(val, unit = '', digits = 1) {
|
|
217
|
+
const n = this._toNum(val);
|
|
218
|
+
if (n === null) {
|
|
219
|
+
return '–';
|
|
220
|
+
}
|
|
221
|
+
return unit ? `${n.toFixed(digits)} ${unit}` : n.toFixed(digits);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
_fmtSec(sec) {
|
|
225
|
+
const n = this._toNum(sec);
|
|
226
|
+
if (n === null || n <= 0) {
|
|
227
|
+
return '0:00';
|
|
228
|
+
}
|
|
229
|
+
const total = Math.round(n);
|
|
230
|
+
const m = Math.floor(total / 60);
|
|
231
|
+
const s = total % 60;
|
|
232
|
+
return `${m}:${String(s).padStart(2, '0')}`;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
_renderBase() {
|
|
236
|
+
// In Unterklassen überschreiben
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
_updateView() {
|
|
240
|
+
// In Unterklassen überschreiben
|
|
241
|
+
}
|
|
242
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <luxtronik-cop-cockpit>
|
|
3
|
+
* COP- & JAZ-Vergleichsmatrix (Gesamt / Heizen / Warmwasser) inkl. Live-COP
|
|
4
|
+
* für `@iobroker/web-components`.
|
|
5
|
+
*/
|
|
6
|
+
import { LuxtronikBaseCard } from './luxtronik-base.js';
|
|
7
|
+
|
|
8
|
+
const MATRIX_ROWS = [
|
|
9
|
+
{ key: 'total', label: 'Gesamt', color: '#22c55e' },
|
|
10
|
+
{ key: 'heating', label: 'Heizen', color: '#f97316' },
|
|
11
|
+
{ key: 'water', label: 'Warmwasser', color: '#3b82f6' },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const MATRIX_COLS = [
|
|
15
|
+
{ key: 'today', label: 'Heute' },
|
|
16
|
+
{ key: '7d', label: '7 Tage' },
|
|
17
|
+
{ key: 'month', label: 'Monat' },
|
|
18
|
+
{ key: 'year', label: 'Jahr' },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
class LuxtronikCopCockpit extends LuxtronikBaseCard {
|
|
22
|
+
static get stateMap() {
|
|
23
|
+
return {
|
|
24
|
+
total_today: 'Information.16_Efficiency.Total.cop_total_today',
|
|
25
|
+
total_7d: 'Information.16_Efficiency.Total.cop_total_7d',
|
|
26
|
+
total_month: 'Information.16_Efficiency.Total.cop_total_month',
|
|
27
|
+
total_year: 'Information.16_Efficiency.Total.cop_total_year',
|
|
28
|
+
heating_today: 'Information.16_Efficiency.Heating.cop_heating_today',
|
|
29
|
+
heating_7d: 'Information.16_Efficiency.Heating.cop_heating_7d',
|
|
30
|
+
heating_month: 'Information.16_Efficiency.Heating.cop_heating_month',
|
|
31
|
+
heating_year: 'Information.16_Efficiency.Heating.cop_heating_year',
|
|
32
|
+
water_today: 'Information.16_Efficiency.HotWater.cop_water_today',
|
|
33
|
+
water_7d: 'Information.16_Efficiency.HotWater.cop_water_7d',
|
|
34
|
+
water_month: 'Information.16_Efficiency.HotWater.cop_water_month',
|
|
35
|
+
water_year: 'Information.16_Efficiency.HotWater.cop_water_year',
|
|
36
|
+
heatPower: 'Information.12_SystemInfo.current_heat_output',
|
|
37
|
+
elecPower: 'Information.12_SystemInfo.current_power_consumption',
|
|
38
|
+
thermalTotal: 'Information.09_ThermalEnergy.thermalenergy_total',
|
|
39
|
+
energyTotal: 'Information.10_Energy.energy_total',
|
|
40
|
+
vd1: 'Information.03_Outputs.VD1out',
|
|
41
|
+
pvBoost: 'Information.17_PV_Surplus.pv_boost_active',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
_copColor(val) {
|
|
46
|
+
if (val === null || val <= 0) {
|
|
47
|
+
return 'rgba(148, 163, 184, 0.45)';
|
|
48
|
+
}
|
|
49
|
+
if (val < 2.5) {
|
|
50
|
+
return '#ef4444';
|
|
51
|
+
}
|
|
52
|
+
if (val < 3.4) {
|
|
53
|
+
return '#f59e0b';
|
|
54
|
+
}
|
|
55
|
+
if (val < 4.3) {
|
|
56
|
+
return '#22c55e';
|
|
57
|
+
}
|
|
58
|
+
return '#06b6d4';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_renderBase() {
|
|
62
|
+
const headerCols = MATRIX_COLS.map(c => `<div class="col-head">${c.label}</div>`).join('');
|
|
63
|
+
const bodyRows = MATRIX_ROWS.map(row => {
|
|
64
|
+
const cells = MATRIX_COLS.map(col => {
|
|
65
|
+
const id = `${row.key}_${col.key}`;
|
|
66
|
+
return `
|
|
67
|
+
<div class="cell">
|
|
68
|
+
<div class="cell-val" data-ref="val_${id}">–</div>
|
|
69
|
+
<div class="bar-track"><div class="bar-fill" data-ref="bar_${id}"></div></div>
|
|
70
|
+
</div>
|
|
71
|
+
`;
|
|
72
|
+
}).join('');
|
|
73
|
+
return `
|
|
74
|
+
<div class="row-label">
|
|
75
|
+
<span class="dot" style="background:${row.color}"></span>
|
|
76
|
+
<span>${row.label}</span>
|
|
77
|
+
</div>
|
|
78
|
+
${cells}
|
|
79
|
+
`;
|
|
80
|
+
}).join('');
|
|
81
|
+
|
|
82
|
+
const tpl = document.createElement('template');
|
|
83
|
+
tpl.innerHTML = `
|
|
84
|
+
<style>
|
|
85
|
+
:host {
|
|
86
|
+
--lux-surface: rgba(127, 127, 127, 0.11);
|
|
87
|
+
--lux-border: rgba(127, 127, 127, 0.24);
|
|
88
|
+
--lux-pv: #eab308;
|
|
89
|
+
--lux-ok: #22c55e;
|
|
90
|
+
display: block;
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 100%;
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
font-family: inherit;
|
|
95
|
+
color: inherit;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.card {
|
|
99
|
+
width: 100%;
|
|
100
|
+
height: 100%;
|
|
101
|
+
box-sizing: border-box;
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
gap: 10px;
|
|
105
|
+
padding: 12px;
|
|
106
|
+
overflow: auto;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.header {
|
|
110
|
+
display: flex;
|
|
111
|
+
justify-content: space-between;
|
|
112
|
+
align-items: center;
|
|
113
|
+
gap: 8px;
|
|
114
|
+
flex-wrap: wrap;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.title { font-size: 0.98rem; font-weight: 600; }
|
|
118
|
+
.subtitle { font-size: 0.74rem; opacity: 0.72; }
|
|
119
|
+
.badges { display: flex; gap: 6px; align-items: center; }
|
|
120
|
+
|
|
121
|
+
.pill {
|
|
122
|
+
padding: 3px 9px;
|
|
123
|
+
border-radius: 999px;
|
|
124
|
+
font-size: 0.74rem;
|
|
125
|
+
font-weight: 700;
|
|
126
|
+
background: var(--lux-surface);
|
|
127
|
+
border: 1px solid var(--lux-border);
|
|
128
|
+
font-variant-numeric: tabular-nums;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.pill.live { color: var(--lux-ok); border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.14); }
|
|
132
|
+
.pill.pv { color: var(--lux-pv); border-color: rgba(234, 179, 8, 0.45); background: rgba(234, 179, 8, 0.14); }
|
|
133
|
+
.hidden { display: none !important; }
|
|
134
|
+
|
|
135
|
+
.matrix {
|
|
136
|
+
display: grid;
|
|
137
|
+
grid-template-columns: minmax(90px, 1.15fr) repeat(4, minmax(56px, 1fr));
|
|
138
|
+
gap: 7px;
|
|
139
|
+
align-items: center;
|
|
140
|
+
flex: 1;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.col-head {
|
|
144
|
+
font-size: 0.7rem;
|
|
145
|
+
font-weight: 600;
|
|
146
|
+
opacity: 0.68;
|
|
147
|
+
text-transform: uppercase;
|
|
148
|
+
text-align: center;
|
|
149
|
+
letter-spacing: 0.03em;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.row-label {
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
gap: 6px;
|
|
156
|
+
font-size: 0.8rem;
|
|
157
|
+
font-weight: 600;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.row-label .dot {
|
|
161
|
+
width: 8px;
|
|
162
|
+
height: 8px;
|
|
163
|
+
border-radius: 50%;
|
|
164
|
+
flex-shrink: 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.cell {
|
|
168
|
+
background: var(--lux-surface);
|
|
169
|
+
border: 1px solid var(--lux-border);
|
|
170
|
+
border-radius: 8px;
|
|
171
|
+
padding: 6px 6px 5px;
|
|
172
|
+
display: flex;
|
|
173
|
+
flex-direction: column;
|
|
174
|
+
gap: 4px;
|
|
175
|
+
align-items: center;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.cell-val {
|
|
179
|
+
font-size: 0.92rem;
|
|
180
|
+
font-weight: 700;
|
|
181
|
+
font-variant-numeric: tabular-nums;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.bar-track {
|
|
185
|
+
width: 100%;
|
|
186
|
+
height: 4px;
|
|
187
|
+
border-radius: 999px;
|
|
188
|
+
background: rgba(127, 127, 127, 0.22);
|
|
189
|
+
overflow: hidden;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.bar-fill {
|
|
193
|
+
height: 100%;
|
|
194
|
+
width: 0%;
|
|
195
|
+
border-radius: 999px;
|
|
196
|
+
transition: width 0.35s ease, background-color 0.35s ease;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.footer {
|
|
200
|
+
display: flex;
|
|
201
|
+
justify-content: space-between;
|
|
202
|
+
align-items: center;
|
|
203
|
+
flex-wrap: wrap;
|
|
204
|
+
gap: 8px;
|
|
205
|
+
padding-top: 6px;
|
|
206
|
+
border-top: 1px solid var(--lux-border);
|
|
207
|
+
font-size: 0.74rem;
|
|
208
|
+
opacity: 0.82;
|
|
209
|
+
font-variant-numeric: tabular-nums;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.footer strong { font-weight: 600; }
|
|
213
|
+
</style>
|
|
214
|
+
|
|
215
|
+
<div class="card">
|
|
216
|
+
<div class="header">
|
|
217
|
+
<div>
|
|
218
|
+
<div class="title" data-ref="title">Effizienz / COP</div>
|
|
219
|
+
<div class="subtitle" data-ref="subtitle">Arbeitszahlen nach Zeitraum</div>
|
|
220
|
+
</div>
|
|
221
|
+
<div class="badges">
|
|
222
|
+
<span class="pill pv hidden" data-ref="pvBadge">PV-Boost</span>
|
|
223
|
+
<span class="pill" data-ref="liveCopBadge">Live: –</span>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
|
|
227
|
+
<div class="matrix">
|
|
228
|
+
<div></div>
|
|
229
|
+
${headerCols}
|
|
230
|
+
${bodyRows}
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<div class="footer">
|
|
234
|
+
<span>Wärme ges.: <strong data-ref="thermalTotal">–</strong></span>
|
|
235
|
+
<span>Strom ges.: <strong data-ref="energyTotal">–</strong></span>
|
|
236
|
+
<span>Gesamt-JAZ: <strong data-ref="lifetimeJaz">–</strong></span>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
`;
|
|
240
|
+
this.shadowRoot.appendChild(tpl.content.cloneNode(true));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
_updateView() {
|
|
244
|
+
const r = this._refs;
|
|
245
|
+
if (!r.title) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const v = this._values;
|
|
250
|
+
const maxScale = Math.max(3, this._toNum(this._settings?.maxScale) ?? 5.5);
|
|
251
|
+
|
|
252
|
+
r.title.textContent = this._settings?.title || 'Effizienz / COP';
|
|
253
|
+
r.pvBadge.classList.toggle('hidden', !this._toBool(v.pvBoost));
|
|
254
|
+
|
|
255
|
+
// Live-COP berechnen (falls Verdichter läuft und Leistungswerte vorhanden)
|
|
256
|
+
const heatW = this._toNum(v.heatPower);
|
|
257
|
+
const elecW = this._toNum(v.elecPower);
|
|
258
|
+
const vd1 = this._toBool(v.vd1);
|
|
259
|
+
|
|
260
|
+
if (vd1 && heatW !== null && heatW > 0 && elecW !== null && elecW > 50) {
|
|
261
|
+
const liveCop = heatW / elecW;
|
|
262
|
+
r.liveCopBadge.textContent = `Live COP ${liveCop.toFixed(2)}`;
|
|
263
|
+
r.liveCopBadge.className = 'pill live';
|
|
264
|
+
r.subtitle.textContent = `${(heatW / 1000).toFixed(2)} kW th. / ${(elecW / 1000).toFixed(2)} kW el.`;
|
|
265
|
+
} else {
|
|
266
|
+
r.liveCopBadge.textContent = vd1 ? 'Verdichter aktiv' : 'Standby';
|
|
267
|
+
r.liveCopBadge.className = 'pill';
|
|
268
|
+
r.subtitle.textContent = 'Arbeitszahlen nach Zeitraum';
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Matrix-Zellen aktualisieren
|
|
272
|
+
for (const row of MATRIX_ROWS) {
|
|
273
|
+
for (const col of MATRIX_COLS) {
|
|
274
|
+
const id = `${row.key}_${col.key}`;
|
|
275
|
+
const num = this._toNum(v[id]);
|
|
276
|
+
const valEl = r[`val_${id}`];
|
|
277
|
+
const barEl = r[`bar_${id}`];
|
|
278
|
+
|
|
279
|
+
if (num !== null && num > 0) {
|
|
280
|
+
valEl.textContent = num.toFixed(2);
|
|
281
|
+
const pct = Math.max(4, Math.min(100, (num / maxScale) * 100));
|
|
282
|
+
barEl.style.width = `${pct.toFixed(0)}%`;
|
|
283
|
+
barEl.style.backgroundColor = this._copColor(num);
|
|
284
|
+
} else {
|
|
285
|
+
valEl.textContent = '–';
|
|
286
|
+
barEl.style.width = '0%';
|
|
287
|
+
barEl.style.backgroundColor = 'transparent';
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Gesamtzähler & Lebenszeit-JAZ
|
|
293
|
+
const th = this._toNum(v.thermalTotal);
|
|
294
|
+
const el = this._toNum(v.energyTotal);
|
|
295
|
+
r.thermalTotal.textContent = th !== null ? `${Math.round(th).toLocaleString('de-DE')} kWh` : '–';
|
|
296
|
+
r.energyTotal.textContent = el !== null ? `${Math.round(el).toLocaleString('de-DE')} kWh` : '–';
|
|
297
|
+
r.lifetimeJaz.textContent = th !== null && el !== null && el > 0 ? (th / el).toFixed(2) : '–';
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (!customElements.get('luxtronik-cop-cockpit')) {
|
|
302
|
+
customElements.define('luxtronik-cop-cockpit', LuxtronikCopCockpit);
|
|
303
|
+
}
|