R2: git = source de vérité — src/nodes/ + build/extract intégrés au push
- src/nodes/*.js (6 nodes + template snapshot) = source de vérité unique. - n8n-push.mjs reconstruit le JSON depuis src/ avant syntaxe+golden+PUT (src gagne toujours; n8n-extract.mjs pour resynchroniser si édition UI). - n8n-build.mjs --check pour vérifier la synchro. - Copies historiques déplacées dans archive/ (mortes, dérivées de la prod). - .gitignore: backups locaux de rollback. - AGENTS.md: règle R2 pour toutes les futures sessions (dont Qwen local). - Validé: idempotence, mutation/restauration, pipeline push complet en réel.
This commit is contained in:
183
archive/decoupesurplus/V2/HASERVICEOUTPUTP3.js
Normal file
183
archive/decoupesurplus/V2/HASERVICEOUTPUTP3.js
Normal file
@@ -0,0 +1,183 @@
|
||||
decision: {
|
||||
state: decision.state,
|
||||
current_decision: decision.currentDecision,
|
||||
desired_charging: decision.desiredCharging,
|
||||
desired_permission: decision.desiredPermission,
|
||||
desired_latch: decision.desiredLatch,
|
||||
desired_current_a: round1(desiredCurrentA),
|
||||
|
||||
charging_action: chargingAction,
|
||||
permission_action: permissionAction,
|
||||
latch_action: latchAction,
|
||||
current_action: currentAction,
|
||||
auto_start_action: autoStartAction,
|
||||
|
||||
set_last_start_at: setLastStartAt,
|
||||
set_last_stop_at: setLastStopAt,
|
||||
set_last_current_change_at: setLastCurrentChangeAt,
|
||||
set_cloud_debt_started_at: decision.setCloudDebtStartedAt,
|
||||
set_probe_started_at: decision.setProbeStartedAt,
|
||||
|
||||
set_block_reason: needsBlockReasonUpdate || !parsed.controllerEnabled,
|
||||
block_reason: decision.nextBlockReason,
|
||||
|
||||
set_blocked_until: true,
|
||||
blocked_until: blockedUntilToWrite,
|
||||
|
||||
dynamic_ok: decision.dynamicOk,
|
||||
must_stop: decision.mustStop,
|
||||
|
||||
short_reason: shortReason,
|
||||
reason,
|
||||
signature,
|
||||
signature_changed: signatureChanged,
|
||||
|
||||
should_notify: notifyWanted,
|
||||
notify_title: notifyTitle,
|
||||
notify_message: notifyMessage,
|
||||
|
||||
evcs_priority_active: evcsPriorityActive,
|
||||
energy_priority_mode: energyPriorityMode,
|
||||
energy_priority_reason: energyPriorityReason,
|
||||
evcs_priority_until: evcsPriorityUntil,
|
||||
evcs_priority_source: evcsPrioritySource,
|
||||
},
|
||||
|
||||
ha_service_calls: {
|
||||
helper_state: {
|
||||
execute: true,
|
||||
domain: 'input_text',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_text.victron_evcs_surplus_state',
|
||||
value: decision.state
|
||||
}
|
||||
},
|
||||
|
||||
helper_current_decision: {
|
||||
execute: true,
|
||||
domain: 'input_text',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_text.victron_evcs_surplus_current_decision',
|
||||
value: decision.currentDecision
|
||||
}
|
||||
},
|
||||
|
||||
helper_reason: {
|
||||
execute: true,
|
||||
domain: 'input_text',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_text.victron_evcs_surplus_reason',
|
||||
value: shortReason
|
||||
}
|
||||
},
|
||||
|
||||
helper_operating_mode: {
|
||||
execute: true,
|
||||
domain: 'input_text',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_text.victron_evcs_operating_mode',
|
||||
value: context.operatingMode
|
||||
}
|
||||
},
|
||||
|
||||
helper_source_mode: {
|
||||
execute: true,
|
||||
domain: 'input_text',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_text.victron_evcs_source_mode',
|
||||
value: sourceModeLabel
|
||||
}
|
||||
},
|
||||
|
||||
helper_target_current: {
|
||||
execute: true,
|
||||
domain: 'input_number',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_number.victron_evcs_target_current_auto',
|
||||
value: round1(desiredCurrentA)
|
||||
}
|
||||
},
|
||||
|
||||
helper_budget_remaining: {
|
||||
execute: true,
|
||||
domain: 'input_number',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_number.victron_evcs_budget_remaining_kwh',
|
||||
value: round2(derived.forecastBufferKwh)
|
||||
}
|
||||
},
|
||||
|
||||
helper_projected_soc: {
|
||||
execute: true,
|
||||
domain: 'input_number',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_number.victron_evcs_projected_end_soc_after_charge',
|
||||
value: round1(derived.projectedEndSocAfterCharge)
|
||||
}
|
||||
},
|
||||
|
||||
helper_cloud_debt: {
|
||||
execute: true,
|
||||
domain: 'input_number',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_number.victron_evcs_cloud_debt_kwh',
|
||||
value: round2(cloud.cloudDebtNextKwh)
|
||||
}
|
||||
},
|
||||
|
||||
helper_dynamic_ok: {
|
||||
execute: true,
|
||||
domain: 'input_boolean',
|
||||
service: decision.dynamicOk ? 'turn_on' : 'turn_off',
|
||||
data: {
|
||||
entity_id: 'input_boolean.victron_evcs_dynamic_ok'
|
||||
}
|
||||
},
|
||||
|
||||
helper_must_stop: {
|
||||
execute: true,
|
||||
domain: 'input_boolean',
|
||||
service: decision.mustStop ? 'turn_on' : 'turn_off',
|
||||
data: {
|
||||
entity_id: 'input_boolean.victron_evcs_must_stop'
|
||||
}
|
||||
},
|
||||
|
||||
helper_cloud_debt_started_at: {
|
||||
execute: true,
|
||||
domain: 'input_datetime',
|
||||
service: 'set_datetime',
|
||||
data: {
|
||||
entity_id: 'input_datetime.victron_evcs_cloud_debt_started_at',
|
||||
datetime: cloudDebtStartedAtToWrite
|
||||
}
|
||||
},
|
||||
|
||||
helper_last_current_change_at: {
|
||||
execute: setLastCurrentChangeAt,
|
||||
domain: 'input_datetime',
|
||||
service: 'set_datetime',
|
||||
data: {
|
||||
entity_id: 'input_datetime.victron_evcs_last_current_change_at',
|
||||
datetime: lastCurrentChangeAtToWrite
|
||||
}
|
||||
},
|
||||
|
||||
helper_last_start_at: {
|
||||
execute: setLastStartAt,
|
||||
domain: 'input_datetime',
|
||||
service: 'set_datetime',
|
||||
data: {
|
||||
entity_id: 'input_datetime.victron_evcs_last_start_at',
|
||||
datetime: lastStartAtToWrite
|
||||
}
|
||||
},
|
||||
Reference in New Issue
Block a user