JEEP branchee a midi : reseau en HC seulement si le solaire ne suffit pas avant son depart

Regle du proprietaire (28/09). Le bilan compare le besoin saisi (niveau x capacite
mesuree - deja delivre) au solaire disponible avant le depart de 15:30 (mar/mer/
ven/sam) sans descendre la batterie sous le plancher « tenir jusqu'a la prochaine
HC ». Le controleur relaie le verdict sous les gardes du bilan ; session de midi
engagee -> voiture sur le reseau avec la batterie. Bilan 61/61, golden 121/121.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011uJ47NxgfpGnuuMr3f2n7Z
This commit is contained in:
Tallagrand Thierry
2026-09-28 13:55:40 +02:00
parent 9b1c9d30cf
commit 3b9b67268c
17 changed files with 501 additions and 14 deletions

View File

@@ -20,8 +20,34 @@
{%- if w[0] >= repere and ns.suivant == '' -%}{%- set ns.suivant = w[0] -%}{%- endif -%}
{%- if w[0] >= repere and w[2] == 'nuit' and ns.nuit == '' -%}{%- set ns.nuit = w[0] -%}{%- endif -%}
{%- endfor -%}
{#- Voiture branchee a midi (28/09/2026). Le calendrier (jours et heure de
depart de la JEEP apres le dejeuner) reste dans HA : le bilan recoit un
instant de depart, vide si la voiture ne repart pas aujourd'hui. Le niveau
saisi n'est retenu que s'il date de ce branchement (tolerance 1 h avant). -#}
{%- set vh = namespace(dep='', valide=false, cap=none) -%}
{%- set jours = ['lun', 'mar', 'mer', 'jeu', 'ven', 'sam', 'dim'] -%}
{%- if is_state('input_select.victron_evcs_vehicle', 'JEEP') -%}
{%- set vh.cap = states('input_number.victron_evcs_capacity_jeep_kwh') -%}
{%- if jours[now().weekday()] in states('input_text.victron_evcs_jeep_midday_departure_days') | lower -%}
{%- set d = today_at(states('input_datetime.victron_evcs_jeep_midday_departure')) -%}
{%- if d > now() -%}{%- set vh.dep = d -%}{%- endif -%}
{%- endif -%}
{%- elif is_state('input_select.victron_evcs_vehicle', 'VW') -%}
{%- set vh.cap = states('input_number.victron_evcs_capacity_vw_kwh') -%}
{%- endif -%}
{%- set branche = states.binary_sensor.victron_evcs_vehicle_connected -%}
{%- set niveau = states.input_number.victron_evcs_vehicle_level_pct -%}
{%- if branche is not none and niveau is not none and branche.state == 'on' -%}
{%- set vh.valide = as_timestamp(niveau.last_changed) >= as_timestamp(branche.last_changed) - 3600 -%}
{%- endif -%}
{{ {
"ts": now().isoformat(),
"vehicle_connected": is_state("binary_sensor.victron_evcs_vehicle_connected", "on"),
"vehicle_departure_ms": (as_timestamp(vh.dep) * 1000) if vh.dep != '' else none,
"vehicle_level_pct": states("input_number.victron_evcs_vehicle_level_pct"),
"vehicle_level_valid": vh.valide,
"vehicle_capacity_kwh": vh.cap,
"vehicle_delivered_since_level_kwh": ((states("sensor.evcs_hq2239dnt7p_total_energy") | float(0)) - (states("input_number.victron_evcs_vehicle_level_ref_kwh") | float(0))) if states("sensor.evcs_hq2239dnt7p_total_energy") | is_number else none,
"hc_window_end_ms": (as_timestamp(ns.fin) * 1000) if ns.fin != '' else none,
"next_hc_start_ms": (as_timestamp(ns.suivant) * 1000) if ns.suivant != '' else none,
"next_night_hc_start_ms": (as_timestamp(ns.nuit) * 1000) if ns.nuit != '' else none,