Files
EVCS/dashboards/victron_mobile.yaml
2026-10-07 07:42:21 +02:00

244 lines
12 KiB
YAML
Executable File

# =====================================================================
# VICTRON MOBILE — refait le 07/10/2026 (demande du proprietaire).
# Une colonne, de haut en bas : alertes, batterie, reseau, energie du jour,
# nuit, borne, chauffe-eau, cellules, flux des 4 dernieres heures.
# ⚠️ LECTURE SEULE : aucun appui ne commande le contacteur EDF, la borne ou
# le chauffe-eau (une fiche « more-info » de switch permet de les basculer en
# deux appuis ; les automates en sont les seuls proprietaires).
# Ancienne version : victron_mobile.yaml.bak-20261007.
# =====================================================================
views:
- title: Mobile
path: default_view
icon: mdi:cellphone
cards:
- type: vertical-stack
cards:
# ---------- 1. ALERTES (seulement quand quelque chose ne va pas) ----------
# « EDF ouvert » n'est PAS une alerte : c'est l'etat normal ici.
- type: conditional
conditions:
- condition: or
conditions:
- condition: state
entity: sensor.evcs_reseau
state: mesure_muette
- condition: state
entity: sensor.evcs_reseau
state: incoherent
card:
type: markdown
content: |
## ⚠️ Réseau : {{ states('sensor.evcs_reseau') | replace('_', ' ') }}
{{ state_attr('sensor.evcs_reseau', 'explication') or '' }}
- type: conditional
conditions:
- condition: or
conditions:
- condition: state
entity: sensor.evcs_cellules
state: perime
- condition: state
entity: sensor.evcs_cellules
state: muet
card:
type: markdown
content: |
## ⚠️ Cellules : {{ states('sensor.evcs_cellules') }}
Modules lus : {{ state_attr('sensor.evcs_cellules', 'modules_lus') }} sur 9.
- type: conditional
conditions:
- condition: state
entity: input_boolean.victron_auto_charge_enabled
state: "off"
card:
type: markdown
content: |
## ⚠️ Auto batterie OFF
- type: conditional
conditions:
- condition: state
entity: input_boolean.victron_charge_override_enabled
state: "on"
card:
type: markdown
content: |
## 🖐️ Override actif
# ---------- 2. BATTERIE ----------
- type: custom:vertical-stack-in-card
card_mod: &carte
style: |
ha-card {
border-radius: 20px;
border: 1px solid rgba(255,255,255,0.10);
box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}
cards:
- type: custom:gauge-card-pro
entity: sensor.victron_battery_soc
header: Batterie
min: 0
max: 100
needle: true
segments:
- from: 0
color: "#f44336"
- from: 25
color: "#fb8c00"
- from: 50
color: "#fdd835"
- from: 75
color: "#43a047"
- type: custom:mushroom-template-card
primary: >-
{% set p = states('sensor.victron_battery_power') | float(0) %}
{{ 'Charge' if p > 30 else ('Décharge' if p < -30 else 'Au repos') }}
{{ p | abs | round(0) }} W ({{ states('sensor.victron_battery_current') | float(0) | round(1) }} A)
secondary: >-
Cible du matin {{ states('input_number.victron_evcs_night_target_soc') | float(0) | round(1) }} %
• requis maintenant {{ states('input_number.evcs_balance_required_soc') | float(0) | round(1) }} %
multiline_secondary: true
icon: mdi:battery-charging
tap_action:
action: none
# ---------- 3. RESEAU (lecture seule) ----------
- type: custom:mushroom-template-card
card_mod: *carte
primary: >-
{% set r = states('sensor.evcs_reseau') %}
{{ {'non_raccorde': 'EDF ouvert (normal)', 'raccorde': 'EDF fermé', 'etablissement': 'EDF en cours de fermeture',
'mesure_muette': 'EDF : mesure muette', 'incoherent': 'EDF : incohérent'}.get(r, 'EDF : ' ~ r) }}
{% if is_state('switch.edf_general_ok_switch', 'on') %} — {{ states('sensor.victron_grid_power_l1') | float(0) | round(0) }} W{% endif %}
secondary: >-
Acheté aujourd'hui : {{ states('sensor.evcs_import_jour_kwh') }} kWh
icon: mdi:transmission-tower
icon_color: "{{ 'blue' if is_state('switch.edf_general_ok_switch', 'on') else 'grey' }}"
tap_action:
action: none
# ---------- 4. ENERGIE DU JOUR ----------
- type: markdown
card_mod: *carte
content: |
{% set vt = states('input_text.evcs_balance_vrm_today').split(',') %}
{% set ns = namespace(tot=0, reste=0) %}
{% if vt | length == 24 %}{% for i in range(24) %}{% set v = vt[i] | float(0) %}{% set ns.tot = ns.tot + v %}{% if i > now().hour %}{% set ns.reste = ns.reste + v %}{% elif i == now().hour %}{% set ns.reste = ns.reste + v * (1 - now().minute / 60) %}{% endif %}{% endfor %}{% endif %}
### Aujourd'hui
| | |
|---|---:|
| ☀️ Produit | **{{ states('sensor.evcs_production_jour_kwh') }} kWh** |
| ☀️ Prévu (VRM) / reste | {{ ns.tot | round(1) }} / {{ ns.reste | round(1) }} kWh |
| 🏠 Consommé | {{ states('sensor.evcs_consommation_jour_kwh') }} kWh |
| ⚡ Acheté EDF | {{ states('sensor.evcs_import_jour_kwh') }} kWh |
| 🔎 Solaire maintenant | {{ states('sensor.victron_pv_power_system') | float(0) | round(0) }} W — {{ states('sensor.evcs_pv_diagnostic') | replace('_', ' ') }} |
{% if state_attr('sensor.evcs_historisation_heartbeat', 'statut') != 'ok' %}
**⚠️ Service d'historisation : {{ state_attr('sensor.evcs_historisation_heartbeat', 'statut') }}** — les capteurs calculés sont figés.
{% endif %}
# ---------- 5. LA NUIT ----------
# Le soir : la prevision ; le matin : le bilan de la nuit ecoulee.
- type: markdown
card_mod: *carte
content: |
{% if now().hour >= 14 or now().hour < 2 %}
### 🌙 Cette nuit
{{ state_attr('sensor.evcs_prevision_nuit', 'texte_rapport') or states('sensor.evcs_prevision_nuit') }}
{% else %}
### 🌙 La nuit dernière
{{ state_attr('sensor.evcs_bilan_nuit', 'texte_rapport') or states('sensor.evcs_bilan_nuit') }}
{% endif %}
Charge de la voiture la nuit : **{{ {'sans_edf': 'sans EDF', 'complete': 'complète'}.get(states('input_select.victron_evcs_night_charge_mode'), states('input_select.victron_evcs_night_charge_mode')) }}**
# ---------- 6. BORNE / VEHICULE ----------
- type: custom:mushroom-template-card
card_mod: *carte
primary: >-
{{ states('sensor.victron_evcs_status_fr') }}
{% if is_state('binary_sensor.victron_evcs_vehicle_connected', 'on') %} — {{ states('input_select.victron_evcs_vehicle') }}{% endif %}
secondary: >-
{% set w = states('sensor.victron_evcs_ac_power') | float(0) %}
{% if w > 50 %}{{ w | round(0) }} W • {{ states('input_text.victron_evcs_source_mode') }} • {{ states('sensor.evcs_hq2239dnt7p_last_session_energy') }} kWh
{% else %}{{ (states('input_text.victron_evcs_surplus_reason').split('|') | first) | trim }}{% endif %}
{% if is_state('input_select.victron_evcs_vehicle', 'JEEP') %} • Jeep {{ states('sensor.jeep_renegade_phev_hvbattery_charge') }} %{% endif %}
multiline_secondary: true
icon: mdi:ev-station
icon_color: >-
{% if states('sensor.victron_evcs_ac_power') | float(0) > 50 %}green
{% elif is_state('binary_sensor.victron_evcs_vehicle_connected', 'on') %}blue{% else %}grey{% endif %}
tap_action:
action: none
# ---------- 7. CHAUFFE-EAU ----------
- type: custom:mushroom-template-card
card_mod: *carte
primary: >-
Chauffe-eau {{ 'sous tension' if is_state('switch.tt_chauffe_eau_pleumeur_switch', 'on') else 'coupé' }}
{% set w = states('input_number.victron_water_heater_observed_power_w') | float(0) %}{% if w > 50 %} — {{ w | round(0) }} W{% endif %}
secondary: >-
{% set p = states('input_text.evcs_balance_ecs_nuit_jour').split('|') %}
{% if p | length >= 3 and p[0] == now().strftime('%Y-%m-%d') %}{{ 'Jour faible : eau chaude en heures creuses' if p[1] == 'on' else 'Jour normal : eau chaude au solaire' }}
{% else %}Décision du jour après 07:24{% endif %}
• {{ states('sensor.evcs_chauffe_eau_jour_kwh') }} kWh depuis 07:24
multiline_secondary: true
icon: mdi:water-boiler
icon_color: "{{ 'orange' if is_state('switch.tt_chauffe_eau_pleumeur_switch', 'on') else 'grey' }}"
tap_action:
action: none
# ---------- 8. CELLULES ----------
- type: custom:mushroom-template-card
card_mod: *carte
primary: >-
Cellules : écart {{ states('sensor.evcs_cellules') }}{{ ' mV' if states('sensor.evcs_cellules') | is_number else '' }}
secondary: >-
{{ state_attr('sensor.evcs_cellules', 'modules_lus') }} modules sur 9
• le plus sensible : n°{{ state_attr('sensor.evcs_cellules', 'repere_le_plus_sensible') }}
icon: mdi:battery-heart-variant
icon_color: "{{ 'green' if states('sensor.evcs_cellules') | is_number else 'orange' }}"
tap_action:
action: none
# ---------- 9. FLUX DES 4 DERNIERES HEURES ----------
- type: custom:apexcharts-card
card_mod: *carte
graph_span: 4h
header:
show: true
title: Flux d'énergie (4 h)
show_states: false
series:
- entity: sensor.victron_pv_power_system
name: Solaire
color: "#fdd835"
# Maison SANS le chauffe-eau ni la borne (07/10) ; chacun a part.
- entity: sensor.maison_hors_chauffe_eau
name: Maison
color: "#42a5f5"
- entity: input_number.victron_water_heater_observed_power_w
name: Chauffe-eau
color: "#ff9800"
curve: stepline
- entity: sensor.victron_evcs_ac_power
name: Borne
color: "#43a047"
- entity: sensor.victron_grid_power_l1
name: EDF
color: "#ef5350"
- entity: sensor.victron_battery_power
name: Batterie
color: "#ab47bc"
# ---------- 10. AUTRES CHARGES ----------
- type: custom:mushroom-template-card
card_mod: *carte
primary: "Garage : {{ states('input_text.garage_clim_state') | replace('_', ' ') }}"
secondary: "Clim {{ 'en marche' if is_state('switch.clim_hygro_socket_1', 'on') else 'arrêtée' }}"
icon: mdi:air-conditioner
icon_color: "{{ 'cyan' if is_state('switch.clim_hygro_socket_1', 'on') else 'grey' }}"
tap_action:
action: none