logique de traitement erron

This commit is contained in:
2026-05-01 17:38:40 +02:00
parent 874aca1afa
commit 5e6798b702
29 changed files with 9184 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
const root = $input.first().json;
const actions = [];
// Toujours mettre à jour état + raison
actions.push({
json: {
action: 'helper_state',
...root.ha_service_calls.helper_state
}
});
actions.push({
json: {
action: 'helper_reason',
...root.ha_service_calls.helper_reason
}
});
// Action réseau si nécessaire
if (root.decision.grid_action !== 'none') {
actions.push({
json: {
action: 'grid',
...root.ha_service_calls.grid
}
});
}
// Action latch si nécessaire
if (root.decision.latch_action !== 'none') {
actions.push({
json: {
action: 'helper_latch',
...root.ha_service_calls.helper_latch
}
});
}
// Timestamps si nécessaire
if (root.decision.set_last_on_at) {
actions.push({
json: {
action: 'helper_last_on_at',
...root.ha_service_calls.helper_last_on_at
}
});
}
if (root.decision.set_last_off_at) {
actions.push({
json: {
action: 'helper_last_off_at',
...root.ha_service_calls.helper_last_off_at
}
});
}
// Signature + logbook si changement
if (root.decision.signature_changed) {
actions.push({
json: {
action: 'helper_signature',
...root.ha_service_calls.helper_signature
}
});
actions.push({
json: {
action: 'logbook',
...root.ha_service_calls.logbook
}
});
}
// Notification si utile
if (root.decision.should_notify) {
actions.push({
json: {
action: 'mobile_notification',
...root.ha_service_calls.mobile_notification
}
});
}
return actions;