type: custom:stack-in-card
card_mod:
style: |
ha-card {
border: 2px solid #0097E0;
border-radius: 16px;
background: var(--ha-card-background, var(--card-background-color, #FFFFFF));
box-shadow: 0 8px 24px rgba(0, 151, 224, 0.18);
overflow: visible;
}
cards:
# --- HEADER: the same for every Daikin Cycle ML card (#427) ---
- type: custom:button-card
variables: &dcm
lang_override: '' # '' = auto (HA language, then integration language) | en | nl | fr
theme_override: auto # auto (follows the HA dark mode) | light | dark
show_help: true # false = hide the explanation notes
show_name: false
show_icon: false
triggers_update: all
styles:
card:
- background: none
- box-shadow: none
- border: none
- border-radius: 14px 14px 0 0
- padding: 0
grid:
- grid-template-areas: '"content"'
- grid-template-columns: 1fr
custom_fields:
content:
- width: 100%
custom_fields:
content: |
[[[
/* DCM-COMMON-BEGIN (#427) shared by every Daikin Cycle ML card: language, theme, header.
Do not edit in a card: edit tools/card_common.js and run tools/sync_card_common.py */
var DCM = (function () {
var V = (typeof variables !== 'undefined' && variables) ? variables : {};
var H = (typeof hass !== 'undefined' && hass) ? hass : {};
var S = (typeof states !== 'undefined' && states) ? states : {};
var find = function (tk, sfx) {
var ids = Object.keys(S), i, j, k, E = H.entities || {};
for (i = 0; i < ids.length; i++) {
if (ids[i].indexOf('sensor.') !== 0) continue;
for (j = 0; j < sfx.length; j++) { if (ids[i].slice(-sfx[j].length - 1) === '_' + sfx[j]) return ids[i]; }
}
for (k in E) { if (E[k] && E[k].platform === 'daikin_cycle_ml' && E[k].translation_key === tk && S[k]) return k; }
return null;
};
var A = function (id) { return (id && S[id] && S[id].attributes) ? S[id].attributes : {}; };
var csA = A(find('cycle_state', ['cycle_state', 'cyclus_status', 'etat_du_cycle']));
var spA = A(find('hp_specs', ['hp_specs', 'wp_specs', 'caracteristiques_de_la_pac']));
/* language: lang_override, then the HA language, then the integration language, then English */
var LS = ['en', 'nl', 'fr'];
var ov = String(V.lang_override || '').toLowerCase();
var ha = String(H.language || '').toLowerCase().slice(0, 2);
var cl = String(csA.configured_language || '').toLowerCase();
var lang = LS.indexOf(ov) >= 0 ? ov : (LS.indexOf(ha) >= 0 ? ha : (LS.indexOf(cl) >= 0 ? cl : 'en'));
/* theme: auto follows the HA dark mode; light / dark force it */
var th = String(V.theme_override || 'auto').toLowerCase();
var dark = th === 'dark' ? true : (th === 'light' ? false : !!(H.themes && H.themes.darkMode));
var P = dark
? { bg: '#1B1F24', bg2: '#232A33', bg3: '#1E3448', hd1: '#1E3448', hd2: '#15283A', text: '#E6F0FA', text2: '#90CAF9',
muted: '#B0BEC5', border: 'rgba(79,195,247,0.35)', accent: '#4FC3F7', good: '#66BB6A', warn: '#FFA726', bad: '#EF5350' }
: { bg: '#FFFFFF', bg2: '#F5FAFD', bg3: '#E3F2FD', hd1: '#E3F2FD', hd2: '#BBDEFB', text: '#0D47A1', text2: '#1565C0',
muted: '#546E7A', border: 'rgba(0,151,224,0.25)', accent: '#0097E0', good: '#2E7D32', warn: '#E65100', bad: '#C62828' };
/* light colours of the cards -> dark mode (light backgrounds dark, dark text light) */
var MAP = {
'#FFFFFF': P.bg, '#F5FAFD': P.bg2, '#F5FAFE': P.bg2, '#E6F4FB': P.bg2, '#E8F2FB': P.bg2, '#EAF2F8': P.bg2,
'#E3F2FD': P.bg3, '#D6ECF7': P.bg3, '#DCEBFA': P.bg3, '#BBDEFB': '#1F4A6B', '#D6EAF8': P.bg3, '#E1F5FE': P.bg3, '#AED6F1': '#1F4A6B',
'#FFF3E0': '#3A2A12', '#FFF8EC': '#3A2A12', '#FDEAD0': '#3A2A12', '#FFEBEE': '#3A1D1D', '#FDECEA': '#3A1D1D', '#FBD0C8': '#3A1D1D',
'#E8F5E9': '#1C3324', '#EAFAF1': '#1C3324', '#D5F5E3': '#1C3324', '#F3E5F5': '#2E2236',
'#0D47A1': P.text, '#003366': P.text, '#001B3D': P.text, '#003A70': P.text, '#00539F': '#BBDEFB', '#005A9C': '#BBDEFB',
'#1565C0': P.text2, '#1976D2': '#64B5F6', '#546E7A': P.muted, '#5D6D7E': P.muted, '#7F8C8D': '#9EADB5', '#95A5A6': '#9EADB5',
'#37474F': '#CFD8DC', '#444444': '#CFD8DC', '#000000': '#ECEFF1', '#94A3B8': '#78909C', '#6A1B9A': '#CE93D8',
'#2E7D32': '#4CAF50', '#1E8449': '#81C784', '#C62828': '#E53935', '#E65100': '#FB8C00', '#7D4F00': '#FFCC80',
'#8B1A1A': '#EF9A9A', '#7A0008': '#EF9A9A'
};
var paint = function (html) {
if (!dark || typeof html !== 'string') return html;
return html
.replace(/(background(?:-color)?\s*:\s*)(#fff\b|white\b)/gi, '$1' + P.bg)
.replace(/(<(?:rect|circle|ellipse|path)\b[^>]*?\sfill=")(white|#fff|#ffffff)(")/gi, '$1' + P.bg2 + '$3')
.replace(/rgba\(\s*255\s*,\s*255\s*,\s*255\s*,\s*([0-9.]+)\s*\)/g, function (m, a) { return 'rgba(255,255,255,' + Math.min(0.08, parseFloat(a) * 0.1).toFixed(3) + ')'; })
.replace(/#[0-9a-fA-F]{6}\b/g, function (m) { return MAP[m.toUpperCase()] || m; });
};
var T3 = function (o) { return (o && typeof o === 'object') ? (o[lang] || o.en || '') : String(o || ''); };
var model = spA.model ? String(spA.model).toUpperCase() : '';
var meta = [spA.family, spA.kw ? spA.kw + ' kW' : '', spA.refrigerant].filter(function (x) { return x && String(x) !== 'None'; }).join(' · ');
/* one header for every card: icon, title + model, subtitle + family / kW / refrigerant */
var header = function (icon, title, sub) {
return '
';
};
return { lang: lang, dark: dark, P: P, paint: paint, header: header, T3: T3, V: V, model: model,
showHelp: V.show_help !== false && V.show_hints !== false };
})();
/* DCM-COMMON-END */
return DCM.header("🔵",
{en: "Daikin Cycle ML", nl: "Daikin Cycle ML", fr: "Daikin Cycle ML"},
{en: "Live cycle · COP · quality · alerts", nl: "Live cyclus · COP · kwaliteit · alerts", fr: "Cycle en direct · COP · qualité · alertes"});
]]]
- type: custom:button-card
variables: *dcm
show_name: false
show_icon: false
styles:
grid:
- grid-template-areas: '"content"'
- grid-template-columns: 1fr
card:
- background: none
- box-shadow: none
- border: none
- padding: 10px 10px 6px 10px
- overflow: visible
custom_fields:
content:
- width: 100%
custom_fields:
content: |
[[[
/* DCM-COMMON-BEGIN (#427) shared by every Daikin Cycle ML card: language, theme, header.
Do not edit in a card: edit tools/card_common.js and run tools/sync_card_common.py */
var DCM = (function () {
var V = (typeof variables !== 'undefined' && variables) ? variables : {};
var H = (typeof hass !== 'undefined' && hass) ? hass : {};
var S = (typeof states !== 'undefined' && states) ? states : {};
var find = function (tk, sfx) {
var ids = Object.keys(S), i, j, k, E = H.entities || {};
for (i = 0; i < ids.length; i++) {
if (ids[i].indexOf('sensor.') !== 0) continue;
for (j = 0; j < sfx.length; j++) { if (ids[i].slice(-sfx[j].length - 1) === '_' + sfx[j]) return ids[i]; }
}
for (k in E) { if (E[k] && E[k].platform === 'daikin_cycle_ml' && E[k].translation_key === tk && S[k]) return k; }
return null;
};
var A = function (id) { return (id && S[id] && S[id].attributes) ? S[id].attributes : {}; };
var csA = A(find('cycle_state', ['cycle_state', 'cyclus_status', 'etat_du_cycle']));
var spA = A(find('hp_specs', ['hp_specs', 'wp_specs', 'caracteristiques_de_la_pac']));
/* language: lang_override, then the HA language, then the integration language, then English */
var LS = ['en', 'nl', 'fr'];
var ov = String(V.lang_override || '').toLowerCase();
var ha = String(H.language || '').toLowerCase().slice(0, 2);
var cl = String(csA.configured_language || '').toLowerCase();
var lang = LS.indexOf(ov) >= 0 ? ov : (LS.indexOf(ha) >= 0 ? ha : (LS.indexOf(cl) >= 0 ? cl : 'en'));
/* theme: auto follows the HA dark mode; light / dark force it */
var th = String(V.theme_override || 'auto').toLowerCase();
var dark = th === 'dark' ? true : (th === 'light' ? false : !!(H.themes && H.themes.darkMode));
var P = dark
? { bg: '#1B1F24', bg2: '#232A33', bg3: '#1E3448', hd1: '#1E3448', hd2: '#15283A', text: '#E6F0FA', text2: '#90CAF9',
muted: '#B0BEC5', border: 'rgba(79,195,247,0.35)', accent: '#4FC3F7', good: '#66BB6A', warn: '#FFA726', bad: '#EF5350' }
: { bg: '#FFFFFF', bg2: '#F5FAFD', bg3: '#E3F2FD', hd1: '#E3F2FD', hd2: '#BBDEFB', text: '#0D47A1', text2: '#1565C0',
muted: '#546E7A', border: 'rgba(0,151,224,0.25)', accent: '#0097E0', good: '#2E7D32', warn: '#E65100', bad: '#C62828' };
/* light colours of the cards -> dark mode (light backgrounds dark, dark text light) */
var MAP = {
'#FFFFFF': P.bg, '#F5FAFD': P.bg2, '#F5FAFE': P.bg2, '#E6F4FB': P.bg2, '#E8F2FB': P.bg2, '#EAF2F8': P.bg2,
'#E3F2FD': P.bg3, '#D6ECF7': P.bg3, '#DCEBFA': P.bg3, '#BBDEFB': '#1F4A6B', '#D6EAF8': P.bg3, '#E1F5FE': P.bg3, '#AED6F1': '#1F4A6B',
'#FFF3E0': '#3A2A12', '#FFF8EC': '#3A2A12', '#FDEAD0': '#3A2A12', '#FFEBEE': '#3A1D1D', '#FDECEA': '#3A1D1D', '#FBD0C8': '#3A1D1D',
'#E8F5E9': '#1C3324', '#EAFAF1': '#1C3324', '#D5F5E3': '#1C3324', '#F3E5F5': '#2E2236',
'#0D47A1': P.text, '#003366': P.text, '#001B3D': P.text, '#003A70': P.text, '#00539F': '#BBDEFB', '#005A9C': '#BBDEFB',
'#1565C0': P.text2, '#1976D2': '#64B5F6', '#546E7A': P.muted, '#5D6D7E': P.muted, '#7F8C8D': '#9EADB5', '#95A5A6': '#9EADB5',
'#37474F': '#CFD8DC', '#444444': '#CFD8DC', '#000000': '#ECEFF1', '#94A3B8': '#78909C', '#6A1B9A': '#CE93D8',
'#2E7D32': '#4CAF50', '#1E8449': '#81C784', '#C62828': '#E53935', '#E65100': '#FB8C00', '#7D4F00': '#FFCC80',
'#8B1A1A': '#EF9A9A', '#7A0008': '#EF9A9A'
};
var paint = function (html) {
if (!dark || typeof html !== 'string') return html;
return html
.replace(/(background(?:-color)?\s*:\s*)(#fff\b|white\b)/gi, '$1' + P.bg)
.replace(/(<(?:rect|circle|ellipse|path)\b[^>]*?\sfill=")(white|#fff|#ffffff)(")/gi, '$1' + P.bg2 + '$3')
.replace(/rgba\(\s*255\s*,\s*255\s*,\s*255\s*,\s*([0-9.]+)\s*\)/g, function (m, a) { return 'rgba(255,255,255,' + Math.min(0.08, parseFloat(a) * 0.1).toFixed(3) + ')'; })
.replace(/#[0-9a-fA-F]{6}\b/g, function (m) { return MAP[m.toUpperCase()] || m; });
};
var T3 = function (o) { return (o && typeof o === 'object') ? (o[lang] || o.en || '') : String(o || ''); };
var model = spA.model ? String(spA.model).toUpperCase() : '';
var meta = [spA.family, spA.kw ? spA.kw + ' kW' : '', spA.refrigerant].filter(function (x) { return x && String(x) !== 'None'; }).join(' · ');
/* one header for every card: icon, title + model, subtitle + family / kW / refrigerant */
var header = function (icon, title, sub) {
return '';
};
return { lang: lang, dark: dark, P: P, paint: paint, header: header, T3: T3, V: V, model: model,
showHelp: V.show_help !== false && V.show_hints !== false };
})();
/* DCM-COMMON-END */
return DCM.paint((function () {
var _DEC = (function(){ try { var _lc = (typeof hass !== 'undefined' && hass && hass.locale) ? hass.locale : {}; var _nf = _lc.number_format; if (_nf === 'comma_decimal' || _nf === 'none') return '.'; if (_nf === 'decimal_comma' || _nf === 'space_comma') return ','; var _l = String(_lc.language || (typeof hass !== 'undefined' && hass && hass.language) || 'en'); return (1.5).toLocaleString(_l).indexOf(',') >= 0 ? ',' : '.'; } catch (e) { return '.'; } })(); /* #427: decimal separator from the HA number format */
/* #347 entity resolver (EN id -> [translation_key, nl, fr]) */
var _dcmA = {"binary_sensor.daikin_cycle_ml_buh_active":["buh_active","daikin_cycle_ml_buh_actief","daikin_cycle_ml_appoint_en_marche"],"binary_sensor.daikin_cycle_ml_compressor_running":["compressor_running","daikin_cycle_ml_compressor_actief","daikin_cycle_ml_compresseur_en_marche"],"binary_sensor.daikin_cycle_ml_cooling_active":["cooling_active","daikin_cycle_ml_koeling_actief","daikin_cycle_ml_rafraichissement_en_cours"],"binary_sensor.daikin_cycle_ml_defrost_active":["defrost_active","daikin_cycle_ml_defrost_actief","daikin_cycle_ml_degivrage_en_cours"],"binary_sensor.daikin_cycle_ml_dhw_active":["dhw_active","daikin_cycle_ml_sww_actief","daikin_cycle_ml_eau_chaude_en_cours"],"binary_sensor.daikin_cycle_ml_dhw_pendulum":["dhw_pendulum","daikin_cycle_ml_sww_pendelen","daikin_cycle_ml_cycles_d_eau_chaude_trop_frequents"],"binary_sensor.daikin_cycle_ml_heating_active":["heating_active","daikin_cycle_ml_verwarming_actief","daikin_cycle_ml_chauffage_en_cours"],"binary_sensor.daikin_cycle_ml_high_cycle_rate":["high_cycle_rate","daikin_cycle_ml_hoge_cyclusfrequentie","daikin_cycle_ml_frequence_de_cycles_elevee"],"binary_sensor.daikin_cycle_ml_missing_attributes":["missing_attrs","daikin_cycle_ml_ontbrekende_attributen","daikin_cycle_ml_valeurs_manquantes"],"binary_sensor.daikin_cycle_ml_pendulum_daily":["pendulum_daily","daikin_cycle_ml_pendelen_per_dag","daikin_cycle_ml_cycles_trop_frequents_jour"],"binary_sensor.daikin_cycle_ml_pendulum_hourly":["pendulum_hourly","daikin_cycle_ml_pendelen_per_uur","daikin_cycle_ml_cycles_trop_frequents_heure"],"binary_sensor.daikin_cycle_ml_setpoint_oscillating":["setpoint_oscillating","daikin_cycle_ml_setpoint_oscilleert","daikin_cycle_ml_consigne_instable"],"binary_sensor.daikin_cycle_ml_short_off":["short_off","daikin_cycle_ml_korte_off_tijd","daikin_cycle_ml_arret_court"],"binary_sensor.daikin_cycle_ml_short_run":["short_run","daikin_cycle_ml_korte_run","daikin_cycle_ml_marche_courte"],"binary_sensor.daikin_cycle_ml_source_stale":["source_stale","daikin_cycle_ml_bron_verouderd","daikin_cycle_ml_source_muette"],"sensor.daikin_cycle_ml_cop_today":["cop_today","daikin_cycle_ml_cop_vandaag","daikin_cycle_ml_cop_chauffage_du_jour"],"sensor.daikin_cycle_ml_current_cycle":["current_cycle","daikin_cycle_ml_huidige_cyclus","daikin_cycle_ml_cycle_en_cours"],"sensor.daikin_cycle_ml_cycle_state":["cycle_state","daikin_cycle_ml_cyclus_status","daikin_cycle_ml_etat_du_cycle"],"sensor.daikin_cycle_ml_cycles_today":["cycles_today","daikin_cycle_ml_cycli_vandaag","daikin_cycle_ml_cycles_aujourd_hui"],"sensor.daikin_cycle_ml_heating_curve_advice":["heating_curve_advice","daikin_cycle_ml_stooklijn_advies","daikin_cycle_ml_conseil_de_loi_d_eau"],"sensor.daikin_cycle_ml_last_cycle":["last_cycle","daikin_cycle_ml_laatste_cyclus","daikin_cycle_ml_dernier_cycle"],"sensor.daikin_cycle_ml_learned_thresholds":["learned_thresholds","daikin_cycle_ml_geleerde_drempels","daikin_cycle_ml_seuils_appris"],"sensor.daikin_cycle_ml_quality_today":["quality_today","daikin_cycle_ml_kwaliteit_vandaag","daikin_cycle_ml_qualite_du_jour"],"sensor.daikin_cycle_ml_source_health":["source_health","daikin_cycle_ml_bron_gezondheid","daikin_cycle_ml_fraicheur_de_la_source"]};
var _dcmC = {};
var _dcmR = function(id){ if (_dcmC[id]) return _dcmC[id]; var r = id, a = _dcmA[id], st = (typeof states !== 'undefined' && states) ? states : {}; if (!st[id] && a) { var dom = id.split('.')[0], i, k, ents = (typeof hass !== 'undefined' && hass && hass.entities) ? hass.entities : null; if (ents) { for (k in ents) { var e = ents[k]; if (e && e.platform === 'daikin_cycle_ml' && e.translation_key === a[0] && k.indexOf(dom + '.') === 0 && st[k]) { r = k; break; } } } if (r === id) { for (i = 1; i < a.length; i++) { if (st[dom + '.' + a[i]]) { r = dom + '.' + a[i]; break; } } } } _dcmC[id] = r; return r; };
/* ============ helpers ============ */
var st = function(s,d){ if(d===undefined)d=0; var x=states[s]; if(!x||!x.state)return d; if(x.state==='unknown'||x.state==='unavailable'||x.state==='')return d; var v=parseFloat(x.state); return isNaN(v)?d:v; };
var stStr = function(s,d){ if(d===undefined)d='—'; var x=states[s]; if(!x||!x.state)return d; if(x.state==='unknown'||x.state==='unavailable'||x.state==='none'||x.state==='')return d; return x.state; };
var isOn = function(s){ var x=states[s]; if(!x||!x.state)return false; var v=String(x.state).toLowerCase(); return v==='on'||v==='true'||v==='1'; };
var hasV = function(v){ return v!==null && v!==undefined && v!=='' && String(v)!=='None'; };
var v1 = function(v){ if(!hasV(v)||isNaN(parseFloat(v))||!isFinite(parseFloat(v)))return '—'; return Number(v).toFixed(1).replace('.', _DEC); };
var v2 = function(v){ if(!hasV(v)||isNaN(parseFloat(v))||!isFinite(parseFloat(v)))return '—'; return Number(v).toFixed(2).replace('.', _DEC); };
var vI = function(v){ if(!hasV(v)||isNaN(parseFloat(v)))return '—'; return Math.round(parseFloat(v)).toString(); };
var attr = function(id,n,d){ try{ var a=states[id] && states[id].attributes; if(!a)return d; var v=a[n]; if(v===undefined||v===null||String(v)==='None')return d; return v; } catch(e){ return d; } };
var aN = function(id,n,d){ var v=attr(id,n,null); if(v===null)return d; var x=parseFloat(v); return isNaN(x)?d:x; };
var aB = function(id,n,d){ var v=attr(id,n,d); if(typeof v==='boolean')return v; var s=String(v).toLowerCase(); if(s==='true'||s==='on'||s==='1')return true; if(s==='false'||s==='off'||s==='0')return false; return d; };
var tr = function(s,m){ if(s===null||s===undefined||s==='') return '—'; if(typeof s==='number' && !isFinite(s)) return '—'; var t=String(s); return t.length>m ? t.slice(0,m-1)+'…' : t; };
/* ============ LANGUAGE ============ */
var S_STATE = _dcmR('sensor.daikin_cycle_ml_cycle_state');
var cfgLangRaw = String(attr(S_STATE,'configured_language','en')).toLowerCase();
var LANG = DCM.lang; /* #427: shared language rule (variables.lang_override) */
/* ============ i18n ============ */
var STR = {
nl: {
sub:'Live cyclus · COP · kwaliteit · alerts',
phase:'Fase', cop:'COP', runs:'Runs', q:'Kwaliteit', src:'Bron',
today:'📅 Vandaag', last:'⏮️ Laatste cyclus',
dur:'Duur', avgDur:'Gem. duur', avgOff:'Gem. pauze', longest:'Langste',
ratio:'Goede cycli', sr:'Korte runs', mode:'Modus', outdoor:'Buiten',
dt:'ΔT', rps:'RPS', kw:'Vermogen', defrost:'Defrost', buh:'BUH',
stooklijn:'📈 Stooklijn advies', state:'Status', bucket:'Bucket',
savings:'Besparing', comfort:'Comfort', reliability:'Betrouwbaar',
explain:'💡 COP hoger = beter · Q = kwaliteit 0-100 · Alerts bovenaan = actie',
noAlert:'✅ Systeem OK — geen actieve waarschuwingen',
alertOne:'actief', alertMore:'meer',
hydKring:'♻️ Hydraulische kring', hpEmitter:'WP → AFGIFTE',
heatPump:'WARMTEPOMP', emitter:'AFGIFTE',
supplyLabel:'🔥 AANVOER →', returnLabel:'← 💧 RETOUR',
lvlCrit:'ACTIE VEREIST', lvlWarn:'AANDACHT', lvlInfo:'INFO',
phases:{ idle:'IDLE', defrost:'DEFROST', buh:'BUH', dhw:'SWW',
heating:'VERWARMEN', cooling:'KOELEN', running:'COMPRESSOR' },
cstate:{ idle:'stil', running:'draait' },
modes:{ heating:'verwarmen', dhw:'SWW', cooling:'koelen', unknown:'onbekend' },
advice:{ keep:'Behouden', lower_lwt:'Verlaag LWT', raise_lwt:'Verhoog LWT', no_data:'Geen data', unknown:'Onbekend' }
},
en: {
sub:'Live cycle · COP · quality · alerts',
phase:'Phase', cop:'COP', runs:'Runs', q:'Quality', src:'Source',
today:'📅 Today', last:'⏮️ Last cycle',
dur:'Duration', avgDur:'Avg duration', avgOff:'Avg off', longest:'Longest',
ratio:'Good ratio', sr:'Short runs', mode:'Mode', outdoor:'Outdoor',
dt:'ΔT', rps:'RPS', kw:'Power', defrost:'Defrost', buh:'BUH',
stooklijn:'📈 Heating curve advice', state:'State', bucket:'Bucket',
savings:'Savings', comfort:'Comfort', reliability:'Reliability',
explain:'💡 Higher COP = better · Q = quality 0-100 · Alerts on top = action',
noAlert:'✅ System OK — no active warnings',
alertOne:'active', alertMore:'more',
hydKring:'♻️ Hydraulic circuit', hpEmitter:'HP → EMITTER',
heatPump:'HEAT PUMP', emitter:'EMITTER',
supplyLabel:'🔥 SUPPLY →', returnLabel:'← 💧 RETURN',
lvlCrit:'ACTION REQUIRED', lvlWarn:'ATTENTION', lvlInfo:'INFO',
phases:{ idle:'IDLE', defrost:'DEFROST', buh:'BUH', dhw:'DHW',
heating:'HEATING', cooling:'COOLING', running:'COMPRESSOR' },
cstate:{ idle:'idle', running:'running' },
modes:{ heating:'heating', dhw:'DHW', cooling:'cooling', unknown:'unknown' },
advice:{ keep:'Keep', lower_lwt:'Lower LWT', raise_lwt:'Raise LWT', no_data:'No data', unknown:'Unknown' }
}
};
/* FR-I18N (azsono03) */
var FRM={" cycles in IDEAL zone":" cycles dans la zone IDÉALE"," cycles in PENDULUM zone":" cycles dans la zone TROP COURTE"," cycles over ":" cycles sur ","24h vs 7d":"24 h / 7 j","30d":"30 j","365d":"365 j","Last 7d":"7 derniers jours","SHORT 20-60m":"COURT 20-60 min","GOOD 60-180m":"BON 60-180 min","LONG >180m":"LONG >180 min","40-70 mid":"40-70 moyen","<40 low":"<40 faible","ACTION REQUIRED":"ACTION REQUISE","ATTENTION":"ATTENTION","AVG DURATION":"DURÉE MOY.","Average quality ":"Qualité moyenne ","Average quality low (":"Qualité moyenne faible (","Avg duration":"Durée moy.","Avg off":"Arrêt moy.","Avg quality":"Qualité moy.","Avg ratio":"Taux moy.","Avg/day":"Moy./jour","BUH":"Appoint","BUH >":"Appoint >","Band":"Plage","Best day":"Meilleur jour","Boiler COP":"COP chaudière","Bucket":"Tranche","CARNOT EFF.":"RENDEMENT CARNOT","COMPRESSOR":"COMPRESSEUR","COOLING":"RAFRAÎCHISSEMENT","COP":"COP","COP TODAY":"COP DU JOUR","COP TREND":"TENDANCE COP","COP above datasheet reference":"COP au-dessus de la fiche technique","CYCLES PER DAY":"CYCLES PAR JOUR","CYCLES/DAY":"CYCLES/JOUR","Comfort":"Confort","Compressor off":"Compresseur arrêté","Contribution":"Part","Cool":"Froid","Cooling":"Rafraîchissement","Cycles":"Cycles","Cycles per day":"Cycles par jour","DEFROST":"DÉGIVRAGE","DEFROST IMPACT":"EFFET DES DÉGIVRAGES","DHW":"ECS","DURATION/DAY":"DURÉE/JOUR","Days":"Jours","Defrost":"Dégivrage","Duration":"Durée","Duration per day":"Durée par jour","Duty":"Taux de marche","ELEC":"ÉLEC","ELECTRICAL":"ÉLECTRIQUE","EMITTER":"RADIATEURS","ENERGY TODAY":"ÉNERGIE DU JOUR","Elapsed":"Écoulé","Energy":"Énergie","Event counts per day":"Événements par jour","Event ratio per day":"Taux d'événements par jour","Good days":"Bons jours","Good ratio":"Taux de bons cycles","HEAT BALANCE":"BILAN DE CHALEUR","HEAT PUMP":"PAC","HEATING":"CHAUFFAGE","HEATING OFF":"CHAUFFAGE COUPÉ","HP → EMITTER":"PAC → RADIATEURS","Heat":"Chauffage","Heating":"Chauffage","IDLE":"À L'ARRÊT","IN":"ENTRÉE","INFO":"INFO","Insufficient data":"Pas assez de données","LWT":"Départ","LWT NOW":"DÉPART ACTUEL","LWT OPT":"DÉPART OPTIMAL","Last defrost":"Dernier dégivrage","Last: ":"Dernier : ","Live cycle · COP · quality · alerts":"Cycle en direct · COP · qualité · alertes","Longest":"Le plus long","Longest day":"Jour le plus long","Low days":"Jours faibles","MAX LWT":"DÉPART MAX","MIN LWT":"DÉPART MIN","MODES":"MODES","Max day":"Jour max","Mid days":"Jours moyens","Mode":"Mode","Month":"Mois","No COP data":"Pas de COP","No data":"Pas de données","OUT":"SORTIE","OUTDOOR TEMPERATURE (°C)":"TEMPÉRATURE EXTÉRIEURE (°C)","Outdoor":"Extérieur","PENDULUM <20m":"TROP COURT <20 min","Phase":"Phase","Power":"Puissance","QUALITY":"QUALITÉ","Quality":"Qualité","Quality dropping (":"Qualité en baisse (","Quality per day":"Qualité par jour","Quality rising (+":"Qualité en hausse (+","RPS":"tr/s","RUNNING":"EN MARCHE","Range":"Plage","Reliability":"Fiabilité","Runs":"Cycles","Runtime":"Durée de marche","SAVINGS":"ÉCONOMIE","SPF SEASON":"SPF SAISON","STANDBY":"EN ATTENTE","SUPPLY LWT (°C)":"DÉPART D'EAU (°C)","Samples":"Échantillons","Savings":"Économie","Share":"Part","Short runs":"Cycles courts","Since midnight":"Depuis minuit","Source":"Source","Span":"Période","Starts":"Démarrages","Starts today":"Démarrages du jour","State":"État","Step":"Pas","Sum":"Somme","System performing normally":"Le système fonctionne normalement","THERM":"CHALEUR","THERMAL":"CHALEUR","THERMAL SPLIT":"RÉPARTITION DE LA CHALEUR","Today":"Aujourd'hui","Total":"Total","Total BUH":"Appoint total","Total defrost":"Dégivrage total","Total runtime":"Marche totale","Trends":"Tendances","VS DATASHEET":"VS FICHE TECHNIQUE","WEEK TREND":"TENDANCE SEMAINE","Week":"Semaine","Worst day":"Pire jour","Y-axis max":"Échelle max","Year":"Année","act":"act.","active":"active","ago":"plus tôt","avg":"moy.","buckets":"tranches","cycles":"cycles","datasheet":"fiche technique","day":"jour","defrost <":"dégivrage <","demand":"demande","duration":"durée","events":"événements","heating OFF >":"chauffage coupé >","high":"élevé","in bucket":"dans la tranche","insufficient buckets":"pas assez de tranches","last":"dernier","low":"faible","max":"max","min":"min","month":"mois","more":"de plus","nominal":"normal","nominal COP":"COP nominal","of cycles":"des cycles","outdoor":"extérieur","per day":"par jour","samples":"échantillons","state":"état","supply":"départ","today":"aujourd'hui","total":"total","week":"semaine","Ø duration":"Ø durée","Ø/cycle":"Ø/cycle","← 💧 RETURN":"← 💧 RETOUR","≥70 good":"≥70 bon","⏮️ Last cycle":"⏮️ Dernier cycle","⏱️ DURATION":"⏱️ DURÉE","♻️ Hydraulic circuit":"♻️ Circuit hydraulique","⚠ BUH ASSIST":"⚠ APPOINT","⚡ BUH":"⚡ Appoint","⚡ EVENTS":"⚡ ÉVÉNEMENTS","✅ System OK — no active warnings":"✅ Système OK — aucune alerte active","❄ DEFROST":"❄ DÉGIVRAGE","❄ Defrost":"❄ Dégivrage","⭐ QUALITY":"⭐ QUALITÉ","🎯 COP":"🎯 COP","🎯 COP Efficiency":"🎯 Efficacité COP","🎯 Cycles vs Duration":"🎯 Cycles / durée","🎯 SCATTER":"🎯 NUAGE","💡 COP = efficiency · ~ref = approximate datasheet comparison (A7/W35) · duration/cycle trends per day":"💡 COP = efficacité · ~réf = comparaison approximative avec la fiche (A7/W35) · tendances durée/cycles par jour","💡 Cycle = continuous compressor run · <15m = inefficient cycling · >48h = safety limit":"💡 Cycle = marche continue du compresseur · <15 min = cycles trop courts · >48 h = limite de sécurité","💡 Duration = total compressor runtime per day · split per mode · ⚠ = clipped":"💡 Durée = marche totale du compresseur par jour · par mode · ⚠ = tronqué","💡 Higher COP = better · Q = quality 0-100 · Alerts on top = action":"💡 COP élevé = mieux · Q = qualité 0-100 · Alertes en haut = à traiter","💡 Ratio = events per cycle × 100 · green = nominal (15%) · red = elevated (35%)":"💡 Taux = événements par cycle × 100 · vert = normal (15 %) · rouge = élevé (35 %)","💡 Tap a bar for details — buckets by avg cycle duration per mode":"💡 Toucher une barre pour le détail — tranches par durée moyenne de cycle et par mode","💡 Tap a dot for details — X: cycles/day · Y: avg duration · color: quality":"💡 Toucher un point pour le détail — X : cycles/jour · Y : durée moy. · couleur : qualité","💡 Tap a dot or stat for day details":"💡 Toucher un point ou une valeur pour le détail du jour","💡 Tap an item for details":"💡 Toucher un élément pour le détail","📅 Today":"📅 Aujourd'hui","📈 Heating curve advice":"📈 Conseil de loi d'eau","📈 Regression":"📈 Régression","📊 Cycle duration distribution":"📊 Répartition des durées de cycle","📊 DISTRIBUTION":"📊 RÉPARTITION","📊 OVERVIEW":"📊 VUE D'ENSEMBLE","📊 historical":"📊 historique","🔄 CYCLES":"🔄 CYCLES","🔍 auto-discovery":"🔍 détection auto","🔥 SUPPLY →":"🔥 DÉPART →"," below datasheet":" sous la fiche technique"," well above target":" bien au-dessus de l'objectif","% week":" % / semaine","BUH active":"Appoint en marche","COP dropping ":"COP en baisse ","COP heating ":"COP chauffage ","COP low":"COP bas","DHW cycling":"Cycles d'eau chaude","High cycle rate":"Fréquence de cycles élevée","Missing attributes":"Valeurs manquantes","Pendulum/day":"Cycles trop fréquents/jour","Pendulum/hour":"Cycles trop fréquents/heure","Previous: BUH":"Précédent : appoint","Previous: defrost":"Précédent : dégivrage","SPF ":"SPF ","Setpoint oscillation":"Consigne instable","Short off-time":"Arrêt court","Short run":"Marche courte","Source stale":"Source muette","Too many cycles (target ":"Trop de cycles (objectif ","Update available":"Mise à jour disponible","is_stale flag":"Source en retard"};
var FR=function(x){ return (LANG==='fr' && typeof x==='string' && Object.prototype.hasOwnProperty.call(FRM,x)) ? FRM[x] : x; };
var FRO=function(o){ if(typeof o==='string') return Object.prototype.hasOwnProperty.call(FRM,o)?FRM[o]:o; if(o&&typeof o==='object'){ var r=Array.isArray(o)?[]:{}; for(var k in o){ r[k]=FRO(o[k]); } return r; } return o; };
STR.fr = FRO(STR.en);
STR.fr.cstate = { idle:'à l\'arrêt', running:'en marche' };
STR.fr.modes = { heating:'chauffage', dhw:'ECS', cooling:'froid', unknown:'inconnu' };
STR.fr.advice = { keep:'Garder', lower_lwt:'Baisser le départ', raise_lwt:'Monter le départ', no_data:'Pas de données', unknown:'Inconnu' };
var tm = function(group, k){ var g = t(group); return (g && typeof g === 'object' && g[k]) ? g[k] : k; };
var t = function(k){ return (STR[LANG] && STR[LANG][k]) || (STR.en && STR.en[k]) || k; };
/* ============ entities ============ */
var S = {
state:S_STATE,
cur:_dcmR('sensor.daikin_cycle_ml_current_cycle'),
last:_dcmR('sensor.daikin_cycle_ml_last_cycle'),
today:_dcmR('sensor.daikin_cycle_ml_cycles_today'),
q:_dcmR('sensor.daikin_cycle_ml_quality_today'),
cop:_dcmR('sensor.daikin_cycle_ml_cop_today'),
health:_dcmR('sensor.daikin_cycle_ml_source_health'),
learn:_dcmR('sensor.daikin_cycle_ml_learned_thresholds'),
stook:_dcmR('sensor.daikin_cycle_ml_heating_curve_advice')
};
var B = {
comp:_dcmR('binary_sensor.daikin_cycle_ml_compressor_running'),
heat:_dcmR('binary_sensor.daikin_cycle_ml_heating_active'),
cool:_dcmR('binary_sensor.daikin_cycle_ml_cooling_active'),
dhw:_dcmR('binary_sensor.daikin_cycle_ml_dhw_active'),
defrost:_dcmR('binary_sensor.daikin_cycle_ml_defrost_active'),
buh:_dcmR('binary_sensor.daikin_cycle_ml_buh_active'),
shortRun:_dcmR('binary_sensor.daikin_cycle_ml_short_run'),
shortOff:_dcmR('binary_sensor.daikin_cycle_ml_short_off'),
pendH:_dcmR('binary_sensor.daikin_cycle_ml_pendulum_hourly'),
pendD:_dcmR('binary_sensor.daikin_cycle_ml_pendulum_daily'),
dhwPend:_dcmR('binary_sensor.daikin_cycle_ml_dhw_pendulum'),
highRate:_dcmR('binary_sensor.daikin_cycle_ml_high_cycle_rate'),
setpoint:_dcmR('binary_sensor.daikin_cycle_ml_setpoint_oscillating'),
stale:_dcmR('binary_sensor.daikin_cycle_ml_source_stale'),
missing:_dcmR('binary_sensor.daikin_cycle_ml_missing_attributes')
};
var UPD = 'update.daikin_cycle_ml_update';
/* ============ read ============ */
var copV = st(S.cop,null);
var copMin=aN(S.cop,'cop_min',null), copMax=aN(S.cop,'cop_max',null);
var copSamples=aN(S.cop,'samples_today',0);
var cyc = st(S.today,0), target = aN(S.learn,'target_cycles_per_day',null);
var good=aN(S.q,'good_cycles',0), bad=aN(S.q,'bad_cycles',0), ratio=aN(S.q,'good_ratio_pct',null);
var age = st(S.health,null), err=aN(S.health,'coordinator_errors',0);
var isStale = aB(S.health,'is_stale',false);
var curDur=aN(S.cur,'duration_min',null), curDt=aN(S.cur,'dt_k',null), curRps=aN(S.cur,'rps',0);
var lastDur=aN(S.last,'duration_min',null), lastDt=aN(S.last,'dt_avg_k',aN(S.last,'dt_max_k',null));
var lastRps=aN(S.last,'rps_avg',null), lastKw=aN(S.last,'thermal_kw_avg',null);
var lastMode=attr(S.last,'mode',null);
var lastOut=aN(S.last,'outdoor_temp',null);
var lastBuh=aB(S.last,'buh_used',false), lastDefr=aB(S.last,'defrost_used',false);
var lastClus=attr(S.last,'cluster',null);
var lastQ=st(S.last,null);
var avgDur=aN(S.today,'avg_duration_min',null), avgOff=aN(S.today,'avg_off_time_min',null);
var longDur=aN(S.today,'longest_cycle_min',null), shortRuns=aN(S.today,'short_runs',0);
var stookState=stStr(S.stook,'unknown');
var stookBucket=attr(S.stook,'bucket',null);
var stookSav=aN(S.stook,'besparing_cop_pct',null);
var stookRel=aN(S.stook,'betrouwbaarheid',null);
var compOn=isOn(B.comp), heatOn=isOn(B.heat), coolOn=isOn(B.cool), dhwOn=isOn(B.dhw);
var defr=isOn(B.defrost), buhOn=isOn(B.buh);
var buhStep=aN(B.buh,'step',0);
/* ============ phase ============ */
var phColor='#7f8c8d', phIcon='💤', phKey='idle';
if (defr) { phKey='defrost'; phColor='#0097E0'; phIcon='❄️'; }
else if (buhOn) { phKey='buh'; phColor='#F5A623'; phIcon='⚡'; }
else if (dhwOn) { phKey='dhw'; phColor='#9b59b6'; phIcon='🚿'; }
else if (heatOn) { phKey='heating'; phColor='#E60012'; phIcon='🔥'; }
else if (coolOn) { phKey='cooling'; phColor='#0097E0'; phIcon='🧊'; }
else if (compOn) { phKey='running'; phColor='#00539F'; phIcon='⚙️'; }
var phLabel = t('phases')[phKey] + (buhOn?' S'+buhStep:'');
var liveRps = compOn ? curRps : (lastRps || 0);
var useFan = compOn && liveRps>0;
var fanPath='M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11M12.5,2C17,2 17.11,5.57 14.75,6.75C13.76,7.24 13.32,8.29 13.13,9.22C13.61,9.42 14.03,9.73 14.35,10.13C18.05,8.13 22.03,8.92 22.03,12.5C22.03,17 18.46,17.1 17.28,14.73C16.78,13.74 15.72,13.3 14.79,13.11C14.59,13.59 14.28,14 13.88,14.34C15.87,18.03 15.08,22 11.5,22C7,22 6.91,18.42 9.27,17.24C10.26,16.75 10.7,15.69 10.89,14.76C10.4,14.57 9.98,14.26 9.66,13.86C5.97,15.86 2,15.07 2,11.5C2,7 5.57,6.9 6.75,9.27C7.24,10.26 8.3,10.7 9.23,10.89C9.42,10.41 9.73,9.99 10.13,9.67C8.13,5.97 8.92,2 12.5,2Z';
var fanDur = function(r){ if(r>=75)return '0.4s'; if(r>=40)return '0.8s'; if(r>=15)return '1.5s'; if(r>0)return '3s'; return null; };
var fanHtml = function(r,sz,c){
var d=fanDur(r);
if(!d) return ' ';
return ' ';
};
/* ============ alerts ============ */
var alerts=[];
var A = {
missing: isOn(B.missing), stale: isOn(B.stale), buh: buhOn,
shortOff: isOn(B.shortOff), pendH: isOn(B.pendH), pendD: isOn(B.pendD),
shortRun: isOn(B.shortRun), dhwPend: isOn(B.dhwPend),
highRate: isOn(B.highRate), setpoint: isOn(B.setpoint),
copLow: copV!==null && copV<2.5,
defrost: lastDefr, buhLast: lastBuh,
update: isOn(UPD), isStale: isStale
};
var alertLabels = LANG==='nl' ? {
missing:'Attributen ontbreken', stale:'Bron verouderd', buh:'BUH actief',
shortOff:'Korte off-time', pendH:'Pendel/uur', pendD:'Pendel/dag',
shortRun:'Korte run', dhwPend:'SWW pendelt', highRate:'Hoge cyclusfrequentie',
setpoint:'Setpoint oscillatie', copLow:'COP laag', defrost:'Vorige: defrost',
buhLast:'Vorige: BUH', update:'Update beschikbaar', isStale:'is_stale flag'
} : {
missing:FR('Missing attributes'), stale:FR('Source stale'), buh:FR('BUH active'),
shortOff:FR('Short off-time'), pendH:FR('Pendulum/hour'), pendD:FR('Pendulum/day'),
shortRun:FR('Short run'), dhwPend:FR('DHW cycling'), highRate:FR('High cycle rate'),
setpoint:FR('Setpoint oscillation'), copLow:FR('COP low'), defrost:FR('Previous: defrost'),
buhLast:FR('Previous: BUH'), update:FR('Update available'), isStale:FR('is_stale flag')
};
function push(sev,icon,key){ if(A[key]) alerts.push({sev:sev,icon:icon,label:alertLabels[key]}); }
push('crit','❓','missing'); push('crit','📡','stale'); push('crit','⚡','buh');
push('crit','🚨','shortOff'); push('crit','🔁','pendH');
push('warn','🔄','pendD'); push('warn','⏱️','shortRun'); push('warn','🌊','dhwPend');
push('warn','📈','highRate'); push('warn','🎯','setpoint'); push('warn','📉','copLow');
push('info','❄️','defrost'); push('info','⚡','buhLast'); push('info','⬆️','update');
push('warn','🌐','isStale');
var sevOrd={crit:0,warn:1,info:2};
alerts.sort(function(a,b){return (sevOrd[a.sev]||3)-(sevOrd[b.sev]||3);});
/* ============ colors ============ */
var copColor = copV===null?'#7f8c8d':(copV>=4?'#4CAF50':copV>=2.5?'#F5A623':'#E60012');
/* #427: Q = the quality score (0-100) of today, as the footer explains;
the good-cycle ratio only when no score exists yet */
var qToday = st(S.q,null); if (qToday===null) qToday = ratio;
var qColor = qToday===null?'#7f8c8d':(qToday>=70?'#4CAF50':qToday>=40?'#F5A623':'#E60012');
var ageColor = age===null?'#7f8c8d':(age<120?'#4CAF50':age<600?'#F5A623':'#E60012');
var liveDt = curDt!==null ? curDt : (lastDt||0);
var liveKw = lastKw;
var dtColor = liveDt>=5?'#4CAF50':liveDt>=3?'#F5A623':'#E60012';
var kwColor = liveKw===null?'#7f8c8d':(liveKw>=3?'#4CAF50':liveKw>=1.5?'#F5A623':'#E60012');
/* ============ diagram SVG ============ */
var hW=420,hH=190;
var hpX=15,hpY=35,hpW=90,hpH=100;
var radX=315,radY=35,radW=90,radH=100;
var topY=55, botY=115;
var s='';
s+='';
s+=' ';
s+=' ';
s+=' ';
s+=' ';
s+=' ';
s+=' ';
s+=' ';
s+=' ';
s+=' ';
if(compOn){
s+=' ';
s+=' ';
s+=' ';
s+=' ';
}
s+=' ';
if(useFan && fanDur(liveRps)){
s+=' ';
} else {
s+=''+phIcon+' ';
}
s+=''+t('heatPump')+' ';
s+=''+vI(liveRps)+'rps ';
var rpsPct=Math.max(0,Math.min(100,(liveRps||0)/120*100));
s+=' ';
s+=' ';
s+=''+(lastOut===null?'—':v1(lastOut)+'°C')+' ';
var qScore = ratio!==null?ratio:0;
s+=' ';
s+='🏠 ';
s+=''+t('emitter')+' ';
s+=''+(liveKw===null?'—':v2(liveKw))+'kW ';
var kwPct=Math.max(0,Math.min(100,(liveKw||0)/6*100));
s+=' ';
s+=' ';
s+=''+((hasV(lastClus) && String(lastClus)!=='unknown')?'🏷️ '+tr(lastClus,8):'—')+' ';
var dtX=hW/2, dtY=(topY+botY)/2;
s+=' ';
s+='ΔT ';
s+=''+v1(liveDt)+'K ';
s+=' ';
s+=''+t('supplyLabel')+' ';
s+=' ';
s+=''+t('returnLabel')+' ';
s+=' ';
/* ============ RENDER ============ */
var r='';
r+='';
r+='
';
r+='
';
r+='
';
r+=(useFan && fanDur(liveRps)) ? fanHtml(liveRps,32,phColor) : ''+phIcon+' ';
r+='
';
r+='
';
r+='
'+t('phase')+' · '+tm('cstate', stStr(S.state,'idle'))+'
';
r+='
'+phLabel+'
';
r+='
'+vI(liveRps)+' rps
';
r+='
';
r+='
';
r+='
'+t('cop')+'
';
r+='
'+(copV===null?'—':v2(copV))+'
';
r+='
Q '+vI(qToday)+'
';
r+='
';
if(alerts.length>0){
var hasCrit=alerts.some(function(a){return a.sev==='crit';});
var hasWarn=alerts.some(function(a){return a.sev==='warn';});
var aBg=hasCrit?'linear-gradient(135deg,#fdecea,#fbd0c8)':hasWarn?'linear-gradient(135deg,#fff8ec,#fdead0)':'linear-gradient(135deg,#eaf2f8,#d6eaf8)';
var aBd=hasCrit?'#E60012':hasWarn?'#F5A623':'#0097E0';
var aTx=hasCrit?'#8b1a1a':hasWarn?'#7d4f00':'#00539F';
var aIc=hasCrit?'🚨':hasWarn?'⚠️':'ℹ️';
var aTi=hasCrit?t('lvlCrit'):hasWarn?t('lvlWarn'):t('lvlInfo');
var pS=hasCrit?'animation: efp 1.6s ease-in-out infinite;':'';
r+='
';
r+='
';
r+='
'+aIc+' ';
r+=''+aTi+'
';
r+='
'+alerts.length+' '+t('alertOne')+' ';
r+='
';
var showMax=Math.min(alerts.length,3);
for(var ai=0;ai
';
r+=''+al.icon+' ';
r+=''+al.label+' ';
r+=' ';
}
if(alerts.length>showMax){
r+='
+ '+(alerts.length-showMax)+' '+t('alertMore')+'
';
}
r+='
';
} else {
r+='';
r+=''+t('noAlert')+' ';
r+='
';
}
r+='';
r+='
'+t('hydKring')+' '+t('hpEmitter')+'
';
r+=s;
r+='
';
r+='';
var tile=function(icon,label,val,color){
return '
'
+'
'+icon+'
'
+'
'+label+'
'
+'
'+val+'
'
+'
';
};
r+=tile('📈',t('cop'), copV===null?'—':v2(copV), copColor);
r+=tile('🔄',t('runs'), vI(cyc)+(target?'/'+vI(target):''), (target && cyc<=target) ? '#4CAF50' : '#E60012');
r+=tile('⭐',t('q'), vI(qToday), qColor);
r+=tile('🩺',t('src'), age===null?'—':vI(age)+'s', ageColor);
r+='
';
r+='';
r+='
';
r+='
'+t('today')+' '+vI(cyc)+(target?'/'+vI(target):'')+'
';
r+='
'+t('avgDur')+' '+(avgDur===null?'—':v1(avgDur)+"'")+'
';
r+='
'+t('avgOff')+' '+(avgOff===null?'—':v1(avgOff)+"'")+'
';
r+='
'+t('longest')+' '+(longDur===null?'—':v1(longDur)+"'")+'
';
r+='
'+t('sr')+' '+vI(shortRuns)+'
';
r+='
';
r+='
';
r+='
'+t('last')+' '+((hasV(lastClus) && String(lastClus)!=='unknown') ? tr(lastClus,10) : (lastQ===null ? '—' : 'Q '+vI(lastQ)))+'
';
r+='
'+t('dur')+' '+(lastDur===null?'—':v1(lastDur)+"'")+'
';
r+='
'+t('dt')+' '+(lastDt===null?'—':v1(lastDt)+'K')+'
';
r+='
'+t('rps')+' '+(lastRps===null?'—':vI(lastRps))+'
';
r+='
'+t('mode')+' '+tr(lastMode ? tm('modes', lastMode) : '—',9)+'
';
r+='
';
r+='
';
var stKey = stookState.replace(/_\d+c$/, '');
var stCol = (stKey==='keep'||stKey==='ok')?'#4CAF50':(stKey==='unknown'||stKey==='no_data')?'#7f8c8d':'#F5A623';
var stLbl = tm('advice', stKey);
var svCol = (stookSav && stookSav>0)?'#4CAF50':'#7f8c8d';
var rlCol = stookRel===null?'#7f8c8d':(stookRel>=0.6?'#4CAF50':stookRel>=0.3?'#F5A623':'#E60012');
r+='';
r+='
'+t('stooklijn')+' '+stLbl+'
';
r+='
';
r+='
'
+'
'+t('state')+' '+tr(stLbl,16)+'
'
+'
'+t('bucket')+' '+tr(stookBucket||'—',10)+'
'
+'
';
r+='
'
+'
'+t('savings')+' '+(stookSav===null?'—':(stookSav>0?'+':'')+v1(stookSav)+'%')+'
'
+'
'+t('reliability')+' '+(stookRel===null?'—':vI(stookRel*100)+'%')+'
'
+'
';
r+='
';
r+='
';
r+='';
r+=t('explain');
r+='
';
r+='';
return r;
}).call(this));
]]]