avant modif

This commit is contained in:
2026-04-12 03:01:51 +02:00
commit e2733b809b
5 changed files with 2079 additions and 0 deletions

99
build.js Normal file
View File

@@ -0,0 +1,99 @@
const root = $input.first().json || {};
const decision = root.decision || {};
const calls = root.ha_service_calls || {};
const actions = [];
function pushAction(action, call) {
if (!call) return;
actions.push({
json: {
action,
...call
}
});
}
// Helpers toujours mis à jour
pushAction('helper_state', calls.helper_state);
pushAction('helper_current_decision', calls.helper_current_decision);
pushAction('helper_reason', calls.helper_reason);
pushAction('helper_operating_mode', calls.helper_operating_mode);
pushAction('helper_target_current', calls.helper_target_current);
pushAction('helper_budget_remaining', calls.helper_budget_remaining);
pushAction('helper_projected_soc', calls.helper_projected_soc);
pushAction('helper_cloud_debt', calls.helper_cloud_debt);
pushAction('helper_dynamic_ok', calls.helper_dynamic_ok);
pushAction('helper_must_stop', calls.helper_must_stop);
// Helpers V1.4 additionnels
if (decision.set_cloud_debt_started_at) {
pushAction('helper_cloud_debt_started_at', calls.helper_cloud_debt_started_at);
}
if (decision.set_block_reason) {
pushAction('helper_block_reason', calls.helper_block_reason);
}
if (decision.set_blocked_until) {
pushAction('helper_blocked_until', calls.helper_blocked_until);
}
if (decision.set_probe_started_at) {
pushAction('helper_probe_started_at', calls.helper_probe_started_at);
}
// Forcer Auto Start OFF si besoin
if (decision.auto_start_action !== 'none') {
pushAction('evcs_auto_start_off', calls.evcs_auto_start_off);
}
// Si on arrête : charging OFF d'abord
if (decision.charging_action === 'turn_off') {
pushAction('evcs_charging', calls.evcs_charging);
}
// Permission / latch
if (decision.permission_action !== 'none') {
pushAction('helper_permission', calls.helper_permission);
}
if (decision.latch_action !== 'none') {
pushAction('helper_latch', calls.helper_latch);
}
// Courant si nécessaire
if (decision.current_action === 'set') {
pushAction('evcs_set_current', calls.evcs_set_current);
if (decision.set_last_current_change_at) {
pushAction('helper_last_current_change_at', calls.helper_last_current_change_at);
}
}
// Si on démarre : charging ON à la fin
if (decision.charging_action === 'turn_on') {
pushAction('evcs_charging', calls.evcs_charging);
}
// Timestamps start / stop
if (decision.set_last_start_at) {
pushAction('helper_last_start_at', calls.helper_last_start_at);
}
if (decision.set_last_stop_at) {
pushAction('helper_last_stop_at', calls.helper_last_stop_at);
}
// Signature + logbook si changement
if (decision.signature_changed) {
pushAction('helper_signature', calls.helper_signature);
pushAction('logbook', calls.logbook);
}
// Notifications
if (decision.should_notify) {
pushAction('mobile_notification', calls.mobile_notification);
}
return actions;

8
helperv2.txt Normal file
View File

@@ -0,0 +1,8 @@
input_text.victron_evcs_surplus_state
input_text.victron_evcs_surplus_reason
input_text.victron_evcs_surplus_current_decision
input_text.victron_evcs_operating_mode
input_text.victron_evcs_source_mode
input_text.victron_evcs_last_block_reason
input_datetime.victron_evcs_blocked_until

5
legacy.txt Normal file
View File

@@ -0,0 +1,5 @@
input_text.victron_evcs_control_state
input_text.victron_evcs_control_reason
input_text.victron_evcs_current_decision
input_text.victron_evcs_control_last_signature

138
snapshot.js Normal file
View File

@@ -0,0 +1,138 @@
{{ {
"soc_percent": states("sensor.victron_battery_soc"),
"battery_current_a": states("sensor.victron_battery_current"),
"pv_power_w": states("sensor.victron_pv_power_system"),
"pv_power_10m_avg_w": states("sensor.victron_pv_power_10m_avg"),
"pv_trend_w": states("sensor.victron_pv_power_trend_w"),
"house_ac_power_w": states("sensor.victron_consumption_power_l1"),
"grid_power_w": states("sensor.victron_grid_power_l1"),
"grid_state": states("switch.edf_general_ok_switch"),
"today_remaining_kwh": states("sensor.energy_production_today_remaining"),
"evcs_device_connected": states("binary_sensor.victron_evcs_device_connected"),
"evcs_vehicle_connected": states("binary_sensor.victron_evcs_vehicle_connected"),
"evcs_status_raw": states("sensor.victron_evcs_status_raw"),
"evcs_mode_sensor": states("sensor.victron_evcs_mode"),
"evcs_mode_fallback": states("input_text.sensor_victron_evcs_mode"),
"evcs_set_current_a": states("sensor.victron_evcs_set_current"),
"evcs_command_current_a": states("number.victron_evcs_set_current_command"),
"evcs_current_a": states("sensor.victron_evcs_current"),
"evcs_ac_power_w": states("sensor.victron_evcs_ac_power"),
"evcs_charging_switch": states("switch.victron_evcs_charging"),
"evcs_auto_start_switch": states("switch.victron_evcs_auto_start"),
"controller_enabled": states("input_boolean.victron_evcs_surplus_auto_enabled"),
"notifications_enabled": states("input_boolean.victron_evcs_surplus_notifications"),
"hard_stop_enabled": states("input_boolean.victron_evcs_hard_stop_enabled"),
"charge_permission_now": states("input_boolean.victron_evcs_charge_permission_now"),
"control_latch": states("input_boolean.victron_evcs_control_latch"),
"departure_priority_enabled": states("input_boolean.victron_evcs_departure_priority_enabled"),
"forecast_mode_enabled": states("input_boolean.victron_evcs_forecast_mode_enabled"),
"target_current_auto_a": states("input_number.victron_evcs_target_current_auto"),
"budget_remaining_kwh": states("input_number.victron_evcs_budget_remaining_kwh"),
"projected_end_soc_after_charge": states("input_number.victron_evcs_projected_end_soc_after_charge"),
"pv_start_min_w": states("input_number.victron_evcs_pv_start_min_w"),
"pv_hold_min_w": states("input_number.victron_evcs_pv_hold_min_w"),
"house_ac_headroom_w": states("input_number.victron_evcs_house_ac_headroom_w"),
"battery_discharge_soft_a": states("input_number.victron_evcs_battery_discharge_soft_a"),
"battery_discharge_hard_a": states("input_number.victron_evcs_battery_discharge_hard_a"),
"battery_reserve_up_a": states("input_number.victron_evcs_battery_reserve_up_a"),
"battery_neutral_band_a": states("input_number.victron_evcs_battery_neutral_band_a"),
"soc_start_min": states("input_number.victron_evcs_soc_start_min"),
"soc_stop_min": states("input_number.victron_evcs_soc_stop_min"),
"current_min_a": states("input_number.victron_evcs_current_min_a"),
"current_max_auto_a": states("input_number.victron_evcs_current_max_auto_a"),
"current_step_up_a": states("input_number.victron_evcs_current_step_up_a"),
"current_step_down_a": states("input_number.victron_evcs_current_step_down_a"),
"current_change_cooldown_seconds": states("input_number.victron_evcs_current_change_cooldown_seconds"),
"min_run_minutes": states("input_number.victron_evcs_min_run_minutes"),
"min_stop_minutes": states("input_number.victron_evcs_min_stop_minutes"),
"required_energy_kwh": states("input_number.victron_evcs_required_energy_kwh"),
"soc_comfort_target": states("input_number.victron_evcs_soc_comfort_target"),
"end_of_day_soc_guard": states("input_number.victron_evcs_end_of_day_soc_guard"),
"base_load_remaining_kwh": states("input_number.victron_base_load_remaining_kwh"),
"flexible_safety_margin_kwh": states("input_number.victron_flexible_safety_margin_kwh"),
"end_of_day_soc_target": states("input_number.victron_end_of_day_soc_target"),
"ac_loads_max_safe_w": states("input_number.victron_ac_loads_max_safe_w"),
"battery_full_soc": states("input_number.victron_evcs_battery_full_soc"),
"battery_full_forecast_min_kwh": states("input_number.victron_evcs_battery_full_forecast_min_kwh"),
"forecast_commit_soc_floor": states("input_number.victron_evcs_forecast_commit_soc_floor"),
"forecast_commit_min_kwh": states("input_number.victron_evcs_forecast_commit_min_kwh"),
"cloud_debt_kwh": states("input_number.victron_evcs_cloud_debt_kwh"),
"cloud_debt_max_kwh": states("input_number.victron_evcs_cloud_debt_max_kwh"),
"cloud_tolerance_minutes": states("input_number.victron_evcs_cloud_tolerance_minutes"),
"cloud_debt_started_at": states("input_datetime.victron_evcs_cloud_debt_started_at"),
"operating_mode_helper": states("input_text.victron_evcs_operating_mode"),
"departure_time": states("input_datetime.victron_evcs_departure_time"),
"last_start_at": states("input_datetime.victron_evcs_last_start_at"),
"last_stop_at": states("input_datetime.victron_evcs_last_stop_at"),
"last_current_change_at": states("input_datetime.victron_evcs_last_current_change_at"),
"day_start_time": states("input_datetime.victron_flexible_day_start_time"),
"day_stop_time": states("input_datetime.victron_flexible_day_stop_time"),
"vebus_overload": states("binary_sensor.victron_ve_bus_overload"),
"vebus_l1_overload": states("binary_sensor.victron_ve_bus_l1_overload"),
"vebus_low_battery": states("binary_sensor.victron_ve_bus_low_battery"),
"vebus_l1_low_battery": states("binary_sensor.victron_ve_bus_l1_low_battery"),
"vebus_ac_out_l1_power_w": states("sensor.victron_ve_bus_ac_out_l1_power"),
"vebus_ac_out_l1_current_a": states("sensor.victron_ve_bus_ac_out_l1_current"),
"vebus_ac_out_l1_voltage_v": states("sensor.victron_ve_bus_ac_out_l1_voltage"),
"vebus_dc_voltage_v": states("sensor.victron_ve_bus_dc_voltage"),
"vebus_dc_current_a": states("sensor.victron_ve_bus_dc_current"),
"vebus_dc_power_w": states("sensor.victron_ve_bus_dc_power_system"),
"vebus_state": states("sensor.victron_ve_bus_state"),
"vebus_main_state": states("sensor.victron_ve_bus_main_state"),
"last_signature": states("input_text.victron_evcs_control_last_signature"),
"hc_night_start_time": states("input_datetime.victron_evcs_hc_night_start"),
"hc_night_stop_time": states("input_datetime.victron_evcs_hc_night_stop"),
"morning_start_time": states("input_datetime.victron_evcs_morning_start"),
"morning_stop_time": states("input_datetime.victron_evcs_morning_stop"),
"hc_midday_start_time": states("input_datetime.victron_evcs_hc_midday_start"),
"hc_midday_stop_time": states("input_datetime.victron_evcs_hc_midday_stop"),
"evening_start_time": states("input_datetime.victron_evcs_evening_start"),
"evening_stop_time": states("input_datetime.victron_evcs_evening_stop"),
"allow_grid_hc_night": states("input_boolean.victron_evcs_allow_grid_hc_night"),
"allow_grid_hc_midday": states("input_boolean.victron_evcs_allow_grid_hc_midday"),
"probe_enabled": states("input_boolean.victron_evcs_probe_enabled"),
"probe_minutes": states("input_number.victron_evcs_probe_minutes"),
"probe_retry_minutes": states("input_number.victron_evcs_probe_retry_minutes"),
"probe_current_a": states("input_number.victron_evcs_probe_current_a"),
"grid_battery_soft_a": states("input_number.victron_evcs_grid_battery_soft_a"),
"grid_battery_hard_a": states("input_number.victron_evcs_grid_battery_hard_a"),
"morning_probe_pv_avg_min_w": states("input_number.victron_evcs_morning_probe_pv_avg_min_w"),
"morning_probe_pv_trend_min_w": states("input_number.victron_evcs_morning_probe_pv_trend_min_w"),
"midday_probe_pv_avg_min_w": states("input_number.victron_evcs_midday_probe_pv_avg_min_w"),
"morning_soc_min": states("input_number.victron_evcs_morning_soc_min"),
"midday_soc_min": states("input_number.victron_evcs_midday_soc_min"),
"evening_soc_start_min": states("input_number.victron_evcs_evening_soc_start_min"),
"evening_soc_stop_min": states("input_number.victron_evcs_evening_soc_stop_min"),
"morning_battery_max_discharge_a": states("input_number.victron_evcs_morning_battery_max_discharge_a"),
"midday_battery_max_discharge_a": states("input_number.victron_evcs_midday_battery_max_discharge_a"),
"evening_battery_max_discharge_a": states("input_number.victron_evcs_evening_battery_max_discharge_a"),
"last_block_reason": states("input_text.victron_evcs_last_block_reason"),
"blocked_until": states("input_datetime.victron_evcs_blocked_until"),
"probe_started_at": states("input_datetime.victron_evcs_probe_started_at"),
"victron_evcs_strategy": states("input_select.victron_evcs_strategy")
} | tojson }}

1829
surplus.js Normal file

File diff suppressed because it is too large Load Diff