@renegade-0 sagte in Lichtwecker mit alexa2:
@mickym
OK, hast du mal eine vernünftige wiki für JSONata?
nur das; https://docs.jsonata.org/overview
Das hast Du sicher schon gefunden. Das try Ding nutze ich aber oft. Aber in Deinem Fall ist nicht viel zu tun.
Einfach Eigenschaft der Nachricht *+-/ andere Eigenschaft der Nachricht usw.
Also wenn Du Dein 1. Beispiel nimmst und die Eigenschaften: msg.pre_time = 10, msg.start = 20, msg.ende = 80 ist, dann berechnest Du das Delta pro Minute einfach
ed402842-616b-4f2c-9e52-79e19aa9ee5e-image.png
Spoiler
[
{
"id": "7ee6cbae1ec58d73",
"type": "change",
"z": "289f539dcc33814e",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "(ende-start)/pre_time",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 570,
"y": 320,
"wires": [
[
"817491f5d7cea76b"
]
]
},
{
"id": "182d6f4da623b547",
"type": "inject",
"z": "289f539dcc33814e",
"name": "",
"props": [
{
"p": "pre_time",
"v": "10",
"vt": "num"
},
{
"p": "start",
"v": "20",
"vt": "num"
},
{
"p": "ende",
"v": "80",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 370,
"y": 320,
"wires": [
[
"7ee6cbae1ec58d73",
"e553c3b2eee51e91"
]
]
},
{
"id": "817491f5d7cea76b",
"type": "debug",
"z": "289f539dcc33814e",
"name": "Delta/Min",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 760,
"y": 320,
"wires": []
},
{
"id": "e553c3b2eee51e91",
"type": "debug",
"z": "289f539dcc33814e",
"name": "Eingabe",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 560,
"y": 260,
"wires": []
}
]