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:
158
archive/decoupesurplus/V2/HASERVICEOUTPUTP4.js
Normal file
158
archive/decoupesurplus/V2/HASERVICEOUTPUTP4.js
Normal file
@@ -0,0 +1,158 @@
|
||||
helper_last_stop_at: {
|
||||
execute: setLastStopAt,
|
||||
domain: 'input_datetime',
|
||||
service: 'set_datetime',
|
||||
data: {
|
||||
entity_id: 'input_datetime.victron_evcs_last_stop_at',
|
||||
datetime: lastStopAtToWrite
|
||||
}
|
||||
},
|
||||
|
||||
helper_signature: {
|
||||
execute: true,
|
||||
domain: 'input_text',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_text.victron_evcs_control_last_signature',
|
||||
value: signature
|
||||
}
|
||||
},
|
||||
|
||||
helper_block_reason: {
|
||||
execute: needsBlockReasonUpdate || !parsed.controllerEnabled,
|
||||
domain: 'input_text',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_text.victron_evcs_last_block_reason',
|
||||
value: decision.nextBlockReason
|
||||
}
|
||||
},
|
||||
|
||||
helper_blocked_until: {
|
||||
execute: true,
|
||||
domain: 'input_datetime',
|
||||
service: 'set_datetime',
|
||||
data: {
|
||||
entity_id: 'input_datetime.victron_evcs_blocked_until',
|
||||
datetime: blockedUntilToWrite
|
||||
}
|
||||
},
|
||||
|
||||
helper_probe_started_at: {
|
||||
execute: decision.setProbeStartedAt,
|
||||
domain: 'input_datetime',
|
||||
service: 'set_datetime',
|
||||
data: {
|
||||
entity_id: 'input_datetime.victron_evcs_probe_started_at',
|
||||
datetime: probeStartedAtToWrite
|
||||
}
|
||||
},
|
||||
|
||||
helper_evcs_priority_active: {
|
||||
execute: true,
|
||||
domain: 'input_boolean',
|
||||
service: evcsPriorityActive ? 'turn_on' : 'turn_off',
|
||||
data: {
|
||||
entity_id: 'input_boolean.victron_evcs_priority_active'
|
||||
}
|
||||
},
|
||||
|
||||
helper_energy_priority_mode: {
|
||||
execute: true,
|
||||
domain: 'input_select',
|
||||
service: 'select_option',
|
||||
data: {
|
||||
entity_id: 'input_select.victron_energy_priority_mode',
|
||||
option: energyPriorityMode
|
||||
}
|
||||
},
|
||||
|
||||
helper_energy_priority_reason: {
|
||||
execute: true,
|
||||
domain: 'input_text',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'input_text.victron_energy_priority_reason',
|
||||
value: energyPriorityReason
|
||||
}
|
||||
},
|
||||
|
||||
helper_evcs_priority_until: {
|
||||
execute: true,
|
||||
domain: 'input_datetime',
|
||||
service: 'set_datetime',
|
||||
data: {
|
||||
entity_id: 'input_datetime.victron_evcs_priority_until',
|
||||
datetime: evcsPriorityUntil
|
||||
}
|
||||
},
|
||||
|
||||
evcs_auto_start_off: {
|
||||
execute: autoStartAction === 'turn_off',
|
||||
domain: 'switch',
|
||||
service: 'turn_off',
|
||||
data: {
|
||||
entity_id: 'switch.victron_evcs_auto_start'
|
||||
}
|
||||
},
|
||||
|
||||
evcs_charging: {
|
||||
execute: chargingAction !== 'none',
|
||||
domain: 'switch',
|
||||
service: decision.desiredCharging ? 'turn_on' : 'turn_off',
|
||||
data: {
|
||||
entity_id: 'switch.victron_evcs_charging'
|
||||
}
|
||||
},
|
||||
|
||||
helper_permission: {
|
||||
execute: permissionAction !== 'none',
|
||||
domain: 'input_boolean',
|
||||
service: decision.desiredPermission ? 'turn_on' : 'turn_off',
|
||||
data: {
|
||||
entity_id: 'input_boolean.victron_evcs_charge_permission_now'
|
||||
}
|
||||
},
|
||||
|
||||
helper_latch: {
|
||||
execute: latchAction !== 'none',
|
||||
domain: 'input_boolean',
|
||||
service: decision.desiredLatch ? 'turn_on' : 'turn_off',
|
||||
data: {
|
||||
entity_id: 'input_boolean.victron_evcs_control_latch'
|
||||
}
|
||||
},
|
||||
|
||||
evcs_set_current: {
|
||||
execute: currentAction === 'set',
|
||||
domain: 'number',
|
||||
service: 'set_value',
|
||||
data: {
|
||||
entity_id: 'number.victron_evcs_set_current_command',
|
||||
value: round1(desiredCurrentA)
|
||||
}
|
||||
},
|
||||
|
||||
logbook: {
|
||||
execute: signatureChanged,
|
||||
domain: 'logbook',
|
||||
service: 'log',
|
||||
data: {
|
||||
name: 'Victron EVCS Surplus',
|
||||
message: shortReason
|
||||
}
|
||||
},
|
||||
|
||||
mobile_notification: {
|
||||
execute: notifyWanted,
|
||||
domain: cfg.mobileNotifyDomain,
|
||||
service: cfg.mobileNotifyService,
|
||||
data: {
|
||||
title: notifyTitle,
|
||||
message: notifyMessage || shortReason
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user