onto_function_create
RECHENREGEL anlegen: eine Function. Anders als ein Trigger hat sie EINGABEN und einen AUSDRUCK — sie rechnet, statt nur zu reagieren. "inputs": Liste von {key, type, required}; Typen: object, string, int, float, bool, datetime, list. "body": der Ausdruck. body-Format: {"inputs":[{"key":"kmStand","type":"int","required":true}],"body":{"if":[{">":[{"field":["kmStand"]},{"field":["letzterService"]}]},"faellig","ok"]},"effects":[]}. Der Ausdruck AST hat IMMER die Form {"operator":[argumente]} — also {"-":[a,b]} fuer a minus b, nicht {"op":...}. Operatoren u.a.: field/var, source, link, linklist, and/or/!/if, ==/!=/</<=/>/>=/in/notin/empty/notempty/matches, +/-/*///%/min/max/abs/round, cat/lower/upper/len/trim, count_of/sum_of/max_of/min_of. Kein eval — nur diese Operatoren. Das Ergebnis steht als {result} bereit und wird in Regeln per run_function genutzt. Optional "effects" (set_property/create_object/create_link). RECHTE: scope_id muss ein Scope sein, den du VERWALTEST (can_manage_scope=1). | EN: function, automation, expression, script, effect
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Technischer Schluessel (a-zA-Z0-9_). Ohne Angabe = name. | |
| body | Yes | Die Definition als Objekt oder JSON-String. body-Format: {"inputs":[{"key":"kmStand","type":"int","required":true}],"body":{"if":[{">":[{"field":["kmStand"]},{"field":["letzterService"]}]},"faellig","ok"]},"effects":[]}. Der Ausdruck AST hat IMMER die Form {"operator":[argumente]} — also {"-":[a,b]} fuer a minus b, nicht {"op":...}. Operatoren u.a.: field/var, source, link, linklist, and/or/!/if, ==/!=/</<=/>/>=/in/notin/empty/notempty/matches, +/-/*///%/min/max/abs/round, cat/lower/upper/len/trim, count_of/sum_of/max_of/min_of. Kein eval — nur diese Operatoren. Das Ergebnis steht als {result} bereit und wird in Regeln per run_function genutzt. | |
| name | Yes | Anzeigename (z.B. 'Wartung faellig?') | |
| label | No | Anzeigetext | |
| scope_id | Yes | Ziel-Scope. Du musst dort Manager sein (can_manage_scope). | |
| description | No | Beschreibung (optional) |