- Home
- Deutsch
- Skripten / Logik
- Node-Red
- [gelöst] http request mit 2-facher Ausgabe
[gelöst] http request mit 2-facher Ausgabe
-
Ich wünsche Euch ein gutes neues Jahr.
Mein Flow ermittelt die Feiertage im Kalenderjahr über die openholidaysapi: https://www.openholidaysapi.org/en/.
Wenn der aktuelle Tag mit einem Feiertag übereinstimmt, wird in eine Variable ein true und ansonsten ein false zurückgegeben.
Ich verstehe nur nicht, dass der payload immer 2-fach ausgegeben wird.
Ein delay nach dem http request ändert daran nichts.
Und über die node-red-contrib-deduplicate wird nur die zweite Ausgabe unterbunden.
Die zweite Ausgabe enthält aber erst das korrekte Ergebnis.Habt ihr eine Idee, woran das liegen könnte, bzw. wie ich das unterbinden kann?
[ { "id": "d7ab92de65468601", "type": "group", "z": "2a5d5250.f178be", "style": { "stroke": "#999999", "stroke-opacity": "1", "fill": "none", "fill-opacity": "1", "label": true, "label-position": "nw", "color": "#a4a4a4" }, "nodes": [ "78da17c158e6bef1", "3ccc3f42a2375b34", "600b30b2fa735916", "e91f95671148e3f8", "ea826efb6416a0e2", "7654c97d19b712d2", "c67025781db415b3", "3174341e61111e98", "a32311fe3f57f596", "7a2a6e9862f4b65b", "f6e38c9bba13e173", "70661c26e7a597bd", "6a58ba98af5e39c8", "065f77b5ca36d548", "f7616b34b78f0752", "c277e4c9946def8d", "046cbd62d6d59850", "32e9962567fafd2e", "23232d4ed4efc0cb", "b73fa371cde46fa6", "c045023939e591be", "04c119132bb79324", "ca46e7a0adebd311", "f61b17dbcca75559", "3da2e65605823f27", "4ea3728856684ee3" ], "x": 1454, "y": 779, "w": 1172, "h": 562 }, { "id": "78da17c158e6bef1", "type": "http request", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "", "method": "GET", "ret": "obj", "paytoqs": "body", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 1970, "y": 860, "wires": [ [ "f61b17dbcca75559" ] ] }, { "id": "3ccc3f42a2375b34", "type": "inject", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Abfrage", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "05 00 * * *", "once": true, "onceDelay": "0.5", "topic": "", "payload": "", "payloadType": "date", "x": 1560, "y": 820, "wires": [ [ "ea826efb6416a0e2", "e91f95671148e3f8" ] ] }, { "id": "600b30b2fa735916", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Neujahr", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Neujahr", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[0].startDate,'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "(\t $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); \t $b := $moment(date,['DD.MM.YYYY','x'],'de'); \t $a.isSame($b); \t )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2180, "y": 820, "wires": [ [ "c045023939e591be" ] ] }, { "id": "e91f95671148e3f8", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Jahr", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Jahr", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "$moment().year() ", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "$string(payload)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1770, "y": 860, "wires": [ [ "ea826efb6416a0e2" ] ] }, { "id": "ea826efb6416a0e2", "type": "function", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Url", "func": "msg.payload = `https://openholidaysapi.org/PublicHolidays?countryIsoCode=DE&validFrom=${msg.payload}-01-01&validTo=${msg.payload}-12-31&languageIsoCode=DE&subdivisionCode=DE-BY`;\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1770, "y": 820, "wires": [ [ "7654c97d19b712d2" ] ] }, { "id": "7654c97d19b712d2", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "", "rules": [ { "t": "set", "p": "url", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "url", "pt": "msg", "to": "$.url", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1950, "y": 820, "wires": [ [ "78da17c158e6bef1" ] ] }, { "id": "c67025781db415b3", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Heilige Drei Könige", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Heilige Drei Könige", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[1].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2210, "y": 860, "wires": [ [ "c045023939e591be" ] ] }, { "id": "3174341e61111e98", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Karfreitag", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Karfreitag", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[2].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2180, "y": 900, "wires": [ [ "c045023939e591be" ] ] }, { "id": "a32311fe3f57f596", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Ostermontag", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Ostermontag", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[3].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2200, "y": 940, "wires": [ [ "c045023939e591be" ] ] }, { "id": "7a2a6e9862f4b65b", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Tag der Arbeit", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Tag der Arbeit", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[4].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2200, "y": 980, "wires": [ [ "c045023939e591be" ] ] }, { "id": "f6e38c9bba13e173", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Christi Himmelfahrt", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Christi Himmelfahrt", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[5].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2210, "y": 1020, "wires": [ [ "c045023939e591be" ] ] }, { "id": "70661c26e7a597bd", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Pfingstmontag", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Pfingstmontag", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[6].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2200, "y": 1060, "wires": [ [ "c045023939e591be" ] ] }, { "id": "6a58ba98af5e39c8", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Fronleichnam", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Fronleichnam", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[7].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2200, "y": 1100, "wires": [ [ "c045023939e591be" ] ] }, { "id": "065f77b5ca36d548", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Mariä Himmelfahrt", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Mariä Himmelfahrt", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[9].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2210, "y": 1140, "wires": [ [ "c045023939e591be" ] ] }, { "id": "f7616b34b78f0752", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Tag der Deutschen Einheit", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Tag der Deutschen Einheit", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[10].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2240, "y": 1180, "wires": [ [ "c045023939e591be" ] ] }, { "id": "c277e4c9946def8d", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Allerheiligen", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Allerheiligen", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[11].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2190, "y": 1220, "wires": [ [ "c045023939e591be" ] ] }, { "id": "046cbd62d6d59850", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "1. Weihnachtsfeiertag", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "1. Weihnachtsfeiertag", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[12].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2220, "y": 1260, "wires": [ [ "c045023939e591be" ] ] }, { "id": "32e9962567fafd2e", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "2. Weihnachtsfeiertag", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "2. Weihnachtsfeiertag", "tot": "str" }, { "t": "set", "p": "date", "pt": "msg", "to": "$moment(payload[13].startDate, 'YYYY-MM-DD').format('DD.MM.YYYY') ", "tot": "jsonata" }, { "t": "set", "p": "date_today", "pt": "msg", "to": "$moment().format('DD.MM.YYYY')", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "( $a := $moment(date_today,['DD.MM.YYYY','x'],'de'); $b := $moment(date,['DD.MM.YYYY','x'],'de'); $a.isSame($b); )", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2220, "y": 1300, "wires": [ [ "c045023939e591be" ] ] }, { "id": "23232d4ed4efc0cb", "type": "inject", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Global:Feiertag", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "06 00 * * *", "once": true, "onceDelay": "0.5", "topic": "", "payload": "Feiertag", "payloadType": "global", "x": 1590, "y": 920, "wires": [ [ "b73fa371cde46fa6" ] ] }, { "id": "b73fa371cde46fa6", "type": "debug", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Info", "active": true, "tosidebar": false, "console": false, "tostatus": true, "complete": "true", "targetType": "full", "statusVal": "payload", "statusType": "auto", "x": 1770, "y": 920, "wires": [] }, { "id": "c045023939e591be", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Feiertag", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2490, "y": 820, "wires": [ [ "04c119132bb79324" ] ] }, { "id": "04c119132bb79324", "type": "join", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "", "mode": "custom", "build": "array", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "13", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 2530, "y": 860, "wires": [ [ "ca46e7a0adebd311" ] ] }, { "id": "ca46e7a0adebd311", "type": "function", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "date = today", "func": "const Feiertag = msg.payload;\nmsg.payload = Feiertag.includes(true);\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2510, "y": 900, "wires": [ [ "3da2e65605823f27" ] ] }, { "id": "f61b17dbcca75559", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Remove", "rules": [ { "t": "delete", "p": "headers", "pt": "msg" }, { "t": "delete", "p": "statusCode", "pt": "msg" }, { "t": "delete", "p": "url", "pt": "msg" }, { "t": "delete", "p": "responseUrl", "pt": "msg" }, { "t": "delete", "p": "retry", "pt": "msg" }, { "t": "delete", "p": "redirectList", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1980, "y": 900, "wires": [ [ "600b30b2fa735916", "c67025781db415b3", "3174341e61111e98", "a32311fe3f57f596", "7a2a6e9862f4b65b", "f6e38c9bba13e173", "70661c26e7a597bd", "6a58ba98af5e39c8", "065f77b5ca36d548", "f7616b34b78f0752", "c277e4c9946def8d", "046cbd62d6d59850", "32e9962567fafd2e" ] ] }, { "id": "3da2e65605823f27", "type": "change", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Feiertag", "rules": [ { "t": "set", "p": "Feiertag", "pt": "global", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2520, "y": 940, "wires": [ [ "4ea3728856684ee3" ] ] }, { "id": "4ea3728856684ee3", "type": "debug", "z": "2a5d5250.f178be", "g": "d7ab92de65468601", "name": "Info", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 2530, "y": 980, "wires": [] } ]
-
Du hast 2 Info nodes?
-
@oliverio said in http request mit 2-facher Ausgabe:
Du hast 2 Info nodes?
Ja, die 1. gibt das Ergebnis der Variable bei inject wieder (zum Test) und die 2. das Ergebnis des flows.
In welchem Zusammenhang sollte das mit der Ausgabe stehen? -
@mage Das Problem ist meines Erachtens ganz simple und ich verstehe auch nicht, warum man das macht.
In dem Du aus der 1. Inject Node 2 Kabel schickst, verdoppelst Du die Anzahl Nachrichten.
Wenn Du also die Nachricht nicht verdoppelst, dann kommt auch nur EINE Nachricht raus.
-
@mickym said in http request mit 2-facher Ausgabe:
@mage Das Problem ist meines Erachtens ganz simple und ich verstehe auch nicht, warum man das macht.
In dem Du aus der 1. Inject Node 2 Kabel schickst, verdoppelst Du die Anzahl Nachrichten.
Wenn Du also die Nachricht nicht verdoppelst, dann kommt auch nur EINE Nachricht raus.
Vielen lieben Dank. Die doppelte Verbindung hatte ich total übersehen.
Jetzt funktioniert es wie es soll.