⏱️ Node-RED Triggerノード 完全ガイド

このガイドでは、Node-REDのTriggerノードについて、初心者の方でも理解できるように詳しく説明します。

📚 1. Triggerノードとは?

🤔 「Trigger」って何?

Triggerノードは、メッセージを受け取ったときに、時間差で2つの値を出力するノードです。 日常生活で例えると、自動ドアのセンサーのようなものです。

🚪 自動ドアに例えると:

📦 基本的な動作

Inject Trigger Debug

Triggerノードは、メッセージを受け取ると最初の値を即座に出力し、 指定した時間後に2つ目の値を出力します。 LED点滅、タイムアウト検知、ウォッチドッグタイマーなど様々な用途に使えます。

⏱️ Triggerノードの動作タイムライン:

入力
IN
0秒
出力
1
0
0秒 待機中... 2秒後

⚙️ 2. Triggerノードの動作モード

基本 ワンショット

入力で1つ目の値、時間後に2つ目の値を出力

用途: LED点滅、一時的な状態変更 例: "1" → 2秒後 → "0"

監視 ウォッチドッグ

一定時間メッセージがないときに警告を出力

用途: 接続監視、生存確認 例: 5秒間無入力 → "timeout"

延長 タイマー延長

入力ごとにタイマーをリセット・延長

用途: 活動検知、自動ログアウト 例: 入力で延長、無入力で発火

再送 定期再送

指定間隔で繰り返しメッセージを送信

用途: キープアライブ、定期通知 例: 無入力時に1秒ごとに"0"を送信

📋 設定項目一覧

設定項目 説明 選択肢/例
送信データ(1つ目) 最初に送信する値 ペイロード / 文字列 / 数値 / 何も送らない
送信データ(2つ目) 時間後に送信する値 ペイロード / 文字列 / 数値 / 何も送らない
時間間隔 1つ目と2つ目の間の時間 ミリ秒 / 秒 / 分 / 時間
延長 新しいメッセージでタイマーをリセット 有効 / 無効
遅延の上書き 受信メッセージで遅延時間を上書き可能にする 有効 / 無効
初期化条件 タイマーをリセットするpayload値 任意の文字列(例: "reset")
トピック別処理 トピックごとに独立したタイマーを管理 全メッセージ / トピック別
出力ポート 2つ目のメッセージの出力先 同じ出力 / 別の出力(2ポート)

🎯 送信データの型

内部値 説明
ペイロードpay入力メッセージのpayloadをそのまま送信
文字列str指定した文字列を送信
数値num指定した数値を送信
真偽値booltrue または false を送信
何も送らないnulメッセージを送信しない
元のmsg全体msg入力メッセージ全体を送信

🎯 3. 実用的な使用パターン

📥 サンプルフローのインポート方法:

  1. 下のサンプルフローJSONをコピー
  2. Node-REDエディタで メニュー → 読み込み を選択
  3. JSONをペーストして「読み込み」をクリック

このサンプルフローには、以下で説明する全パターンの実例が含まれています。

📋 サンプルフロー(クリックで展開)

参照元:NodeREDエディター内サンプルフロー

[ { "id": "fb1ddbf0a34af21e", "type": "tab", "label": "trigger", "disabled": false, "info": "", "env": [] }, { "id": "ec5a531b.68b65", "type": "inject", "z": "fb1ddbf0a34af21e", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 220, "y": 120, "wires": [ [ "cb5e0c78.4bf3d" ] ] }, { "id": "1b0f8c3e.1fd7e4", "type": "debug", "z": "fb1ddbf0a34af21e", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 550, "y": 120, "wires": [] }, { "id": "cb5e0c78.4bf3d", "type": "trigger", "z": "fb1ddbf0a34af21e", "name": "", "op1": "1", "op2": "0", "op1type": "str", "op2type": "str", "duration": "2", "extend": "false", "overrideDelay": "false", "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 380, "y": 120, "wires": [ [ "1b0f8c3e.1fd7e4" ] ] }, { "id": "4e5bf6b2.b4dd58", "type": "comment", "z": "fb1ddbf0a34af21e", "name": "Oputputs two values with interval", "info": "Outputs 1. Then output 0 after a certain period of time.\n\n*This could be used, for example, to blink an LED attached to a Raspberry Pi GPIO pin.*", "x": 230, "y": 60, "wires": [] }, { "id": "2751bcdba6c887ed", "type": "comment", "z": "fb1ddbf0a34af21e", "name": "Trigger a flow if a message isn't received after a defined time", "info": "Trigger node can be used to wait a specified amount of time to send a message.\n\nSee Node-RED [cookbook](https://cookbook.nodered.org/basic/trigger-timeout).", "x": 320, "y": 200, "wires": [] }, { "id": "9bac75033492118c", "type": "debug", "z": "fb1ddbf0a34af21e", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 570, "y": 260, "wires": [] }, { "id": "fdf7852aab7dded8", "type": "inject", "z": "fb1ddbf0a34af21e", "name": "", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 220, "y": 260, "wires": [ [ "e4113ea63be8c6aa", "9bac75033492118c" ] ] }, { "id": "e4113ea63be8c6aa", "type": "trigger", "z": "fb1ddbf0a34af21e", "name": "Watchdog", "op1": "", "op2": "timeout", "op1type": "nul", "op2type": "str", "duration": "5", "extend": "true", "overrideDelay": "false", "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 390, "y": 300, "wires": [ [ "579925f927a3db7e" ] ] }, { "id": "579925f927a3db7e", "type": "debug", "z": "fb1ddbf0a34af21e", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 570, "y": 300, "wires": [] }, { "id": "d55745be.e4ecd8", "type": "inject", "z": "fb1ddbf0a34af21e", "name": "", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 220, "y": 420, "wires": [ [ "ecac46bf.9751c8", "cf35bbed.ce1298" ] ] }, { "id": "ecac46bf.9751c8", "type": "debug", "z": "fb1ddbf0a34af21e", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 730, "y": 420, "wires": [] }, { "id": "cf35bbed.ce1298", "type": "trigger", "z": "fb1ddbf0a34af21e", "name": "", "op1": "reset", "op2": "true", "op1type": "str", "op2type": "bool", "duration": "2", "extend": "true", "overrideDelay": "false", "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 380, "y": 460, "wires": [ [ "febbebba.455238" ] ] }, { "id": "febbebba.455238", "type": "trigger", "z": "fb1ddbf0a34af21e", "name": "", "op1": "0", "op2": "0", "op1type": "num", "op2type": "str", "duration": "-2", "extend": "false", "overrideDelay": "false", "units": "s", "reset": "reset", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 540, "y": 460, "wires": [ [ "ecac46bf.9751c8" ] ] }, { "id": "4bad6a7.9a1d194", "type": "comment", "z": "fb1ddbf0a34af21e", "name": "Send placeholder messages when a stream stops sending", "info": "Trigger node can be used to detect when a message has not arrived after a defined interval and a second Trigger node to send the placeholder messages at a regular interval..\n\nSee Node-RED [cookbook](https://cookbook.nodered.org/basic/trigger-placeholder).", "x": 310, "y": 360, "wires": [] }, { "id": "d24083e7.fedc7", "type": "comment", "z": "fb1ddbf0a34af21e", "name": "Timeout processing using trigger node", "info": "It is possible to configure timeout processing by combining two Trigger nodes. \n\nIn the first Trigger node settings panel, `send second message to separate output` checkbox is checked. With this specification, this trigger node will have two output ports. When the node receives an input message, it outputs the message to the first port, and after a specified period of time, it outputs the specified message to the second port.\n\nThe second trigger node is specified to handle each message ID (`msg._msgid`). This means that only the first received message among the messages with the same ID is transmitted. The time specified for it represents the retention time of information for message filtering and must be longer than the processing time for the timeout.\n", "x": 250, "y": 540, "wires": [] }, { "id": "8dcb51d5.90fbb", "type": "inject", "z": "fb1ddbf0a34af21e", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "1", "payloadType": "num", "x": 210, "y": 640, "wires": [ [ "69b526f1.347808" ] ] }, { "id": "3b2238f8.71f6c8", "type": "debug", "z": "fb1ddbf0a34af21e", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 930, "y": 680, "wires": [] }, { "id": "69b526f1.347808", "type": "trigger", "z": "fb1ddbf0a34af21e", "name": "", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "3", "extend": "false", "overrideDelay": "false", "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 2, "x": 380, "y": 680, "wires": [ [ "3802c45b.84121c" ], [ "a3c01d51.86cbb" ] ] }, { "id": "7096b59a.c265fc", "type": "trigger", "z": "fb1ddbf0a34af21e", "name": "", "op1": "", "op2": "", "op1type": "pay", "op2type": "nul", "duration": "10", "extend": "false", "overrideDelay": "false", "units": "s", "reset": "", "bytopic": "topic", "topic": "_msgid", "outputs": 1, "x": 750, "y": 680, "wires": [ [ "3b2238f8.71f6c8" ] ] }, { "id": "3802c45b.84121c", "type": "function", "z": "fb1ddbf0a34af21e", "name": "Target Process", "func": "// Wait for a specified time period, then send a message.\n// Must preserve incoming message id.\nvar wait = msg.payload;\nsetTimeout(function() {\n msg.payload = \"done: \"+wait+\"s\";\n node.send(msg);\n}, wait*1000);\n", "outputs": 1, "timeout": 0, "initialize": "", "finalize": "", "libs": [], "x": 560, "y": 600, "wires": [ [ "7096b59a.c265fc" ] ] }, { "id": "a3c01d51.86cbb", "type": "change", "z": "fb1ddbf0a34af21e", "name": "Set timeout flag", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "timeout", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 560, "y": 720, "wires": [ [ "7096b59a.c265fc" ] ] }, { "id": "ae217597.bedf88", "type": "inject", "z": "fb1ddbf0a34af21e", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "5", "payloadType": "num", "x": 210, "y": 720, "wires": [ [ "69b526f1.347808" ] ] }, { "id": "dc6f5bbe.dc8bd8", "type": "comment", "z": "fb1ddbf0a34af21e", "name": "↓ target process", "info": "", "x": 560, "y": 560, "wires": [] }, { "id": "fe41a803.a14158", "type": "comment", "z": "fb1ddbf0a34af21e", "name": "↓ send second message after specified time", "info": "", "x": 490, "y": 640, "wires": [] }, { "id": "fbb2dff0.0bacb", "type": "comment", "z": "fb1ddbf0a34af21e", "name": "↓ pass first message with same ID", "info": "", "x": 820, "y": 640, "wires": [] } ]

パターン1: ワンショット出力(LED点滅)

用途: 入力で"1"を出力し、一定時間後に"0"を出力

Inject Trigger
("1"→2秒後→"0")
Debug

🔄 動作の流れ:

入力
メッセージ
Trigger
2秒待機
1 即座に "1" を出力
2 2秒後に "0" を出力

📌 Raspberry Pi LEDの点滅例:

設定例:

送信データ(1つ目): 文字列 "1" 送信データ(2つ目): 文字列 "0" 待機時間: 2秒 延長: 無効 出力: 1ポート(同じ出力)

パターン2: ウォッチドッグタイマー

用途: 一定時間メッセージがない場合にタイムアウトを検知

ハートビート Watchdog
(5秒延長)
Timeout!

⏱️ 延長モードの動作:

入力
1
2
3
0秒 2秒 4秒
タイマー
!
9秒
タイムアウト

⚠️ 「延長」オプションの重要性:

設定例:

送信データ(1つ目): 何も送らない 送信データ(2つ目): 文字列 "timeout" 待機時間: 5秒 延長: ✓ 有効(入力ごとにタイマーリセット) 動作: 5秒間入力がない → "timeout"を出力

パターン3: ストリーム停止検知と定期送信

用途: データストリームが停止したらプレースホルダーを定期送信

データ 検知
(2秒)
定期送信
(2秒毎)
出力

📌 2つのTriggerノードの連携:

  1. 1つ目: ストリーム停止を検知(延長モード)
    • 入力あり → "reset"を出力(2つ目のTriggerをリセット)
    • 2秒間入力なし → trueを出力(定期送信開始)
  2. 2つ目: 定期的にプレースホルダーを送信
    • "reset"受信 → 定期送信を停止
    • true受信 → 2秒ごとに"0"を送信

設定例(1つ目 - 検知):

送信データ(1つ目): 文字列 "reset" 送信データ(2つ目): 真偽値 true 待機時間: 2秒 延長: ✓ 有効

設定例(2つ目 - 定期送信):

送信データ(1つ目): 数値 0 送信データ(2つ目): 文字列 "0" 待機時間: -2秒(負の値 = 繰り返し送信) リセット: "reset"

パターン4: タイムアウト処理(2出力)

用途: 処理の完了またはタイムアウトを検知

処理開始 Trigger
(2出力)
処理 結果

🔀 2出力モードの動作:

入力
Trigger
3秒タイムアウト
1 出力1: 即座にpayloadを送信 → 処理へ
2 出力2: 3秒後に"timeout"を送信

設定例:

送信データ(1つ目): ペイロード(入力値をそのまま) 送信データ(2つ目): 文字列 "0"(または"timeout") 待機時間: 3秒 出力: 別の出力に送信(2ポート) 出力1 → 処理フローへ(即座) 出力2 → タイムアウト処理へ(3秒後)

🏋️ 4. 実践演習

演習1: 簡単なワンショット初級

📝 課題:

ボタンを押すと"ON"を出力し、3秒後に"OFF"を出力するフローを作成してください。

🎯 要求仕様:

📊 期待される動作:

✅ 成功の条件:

💡 ヒント

Triggerノードの設定:

  • 送信データ(1つ目): 文字列 "ON"
  • 送信データ(2つ目): 文字列 "OFF"
  • 待機時間: 3秒
✅ 解答例フロー
[ { "id": "ex1_inject", "type": "inject", "name": "スイッチ", "props": [{"p": "payload"}], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 160, "y": 100, "wires": [["ex1_trigger"]] }, { "id": "ex1_trigger", "type": "trigger", "name": "ON/OFF", "op1": "ON", "op2": "OFF", "op1type": "str", "op2type": "str", "duration": "3", "extend": "false", "overrideDelay": "false", "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 330, "y": 100, "wires": [["ex1_debug"]] }, { "id": "ex1_debug", "type": "debug", "name": "状態", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "x": 490, "y": 100, "wires": [] } ]

演習2: センサー監視中級

📝 課題:

センサーからの信号が10秒以上途切れたら「センサー異常」を出力するウォッチドッグを作成してください。

🎯 要求仕様:

📊 期待される動作:

✅ 成功の条件:

💡 ヒント

Triggerノードの設定:

  • 送信データ(1つ目): 何も送らない(センサー正常時は何も出力しない)
  • 送信データ(2つ目): 文字列 "センサー異常"
  • 待機時間: 10秒
  • 延長: ✓ 有効(重要!)
✅ 解答例フロー
[ { "id": "ex2_inject", "type": "inject", "name": "センサー信号", "props": [{"p": "payload"}], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "OK", "payloadType": "str", "x": 180, "y": 100, "wires": [["ex2_trigger", "ex2_debug_ok"]] }, { "id": "ex2_trigger", "type": "trigger", "name": "ウォッチドッグ", "op1": "", "op2": "センサー異常", "op1type": "nul", "op2type": "str", "duration": "10", "extend": "true", "overrideDelay": "false", "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 380, "y": 100, "wires": [["ex2_debug_alert"]] }, { "id": "ex2_debug_ok", "type": "debug", "name": "センサーOK", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "x": 390, "y": 160, "wires": [] }, { "id": "ex2_debug_alert", "type": "debug", "name": "アラート", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "x": 560, "y": 100, "wires": [] } ]

演習3: 自動ログアウト中級

📝 課題:

ユーザーアクティビティがない状態が5秒続いたら「ログアウト」メッセージを出力するフローを作成してください。

🎯 要求仕様:

✅ 成功の条件:

💡 ヒント

Triggerノードの設定:

  • 送信データ(1つ目): 文字列 "アクティブ"
  • 送信データ(2つ目): 文字列 "ログアウト"
  • 待機時間: 5秒
  • 延長: ✓ 有効
  • リセット: "logout"
✅ 解答例フロー
[ { "id": "ex3_inject_activity", "type": "inject", "name": "アクティビティ", "props": [{"p": "payload"}], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 180, "y": 80, "wires": [["ex3_trigger"]] }, { "id": "ex3_inject_logout", "type": "inject", "name": "強制ログアウト", "props": [{"p": "payload"}], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "logout", "payloadType": "str", "x": 200, "y": 140, "wires": [["ex3_trigger"]] }, { "id": "ex3_trigger", "type": "trigger", "name": "セッション管理", "op1": "アクティブ", "op2": "ログアウト", "op1type": "str", "op2type": "str", "duration": "5", "extend": "true", "overrideDelay": "false", "units": "s", "reset": "logout", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 400, "y": 100, "wires": [["ex3_debug"]] }, { "id": "ex3_debug", "type": "debug", "name": "状態", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "x": 570, "y": 100, "wires": [] } ]

演習4: 処理タイムアウト上級

📝 課題:

処理を開始し、3秒以内に完了しなければタイムアウトとするフローを作成してください。2出力モードを使用します。

🎯 要求仕様:

📊 期待される動作:

✅ 成功の条件:

💡 ヒント

フローの構成:

  1. Triggerノード: 2出力モード、3秒タイムアウト
  2. 出力1 → Functionノード(遅延処理)→ 結果へ
  3. 出力2 → Changeノード("timeout"設定)→ 結果へ
  4. 結果用Triggerノード: msg._msgidで重複排除

重複排除のTrigger設定:

  • 送信データ(1つ目): ペイロード
  • 送信データ(2つ目): 何も送らない
  • トピック別: msg._msgid
  • 待機時間: 10秒(処理時間より長く)
✅ 解答例フロー
[ { "id": "ex4_inject_1s", "type": "inject", "name": "1秒処理", "props": [{"p": "payload"}], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "1", "payloadType": "num", "x": 160, "y": 80, "wires": [["ex4_trigger_timeout"]] }, { "id": "ex4_inject_5s", "type": "inject", "name": "5秒処理(タイムアウト)", "props": [{"p": "payload"}], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "5", "payloadType": "num", "x": 200, "y": 140, "wires": [["ex4_trigger_timeout"]] }, { "id": "ex4_trigger_timeout", "type": "trigger", "name": "3秒タイムアウト", "op1": "", "op2": "timeout", "op1type": "pay", "op2type": "str", "duration": "3", "extend": "false", "overrideDelay": "false", "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 2, "x": 400, "y": 100, "wires": [["ex4_function"], ["ex4_change"]] }, { "id": "ex4_function", "type": "function", "name": "処理実行", "func": "var wait = msg.payload;\nsetTimeout(function() {\n msg.payload = \"done: \" + wait + \"s\";\n node.send(msg);\n}, wait * 1000);", "outputs": 1, "timeout": 0, "initialize": "", "finalize": "", "libs": [], "x": 580, "y": 60, "wires": [["ex4_trigger_dedup"]] }, { "id": "ex4_change", "type": "change", "name": "タイムアウト設定", "rules": [{"t": "set", "p": "payload", "pt": "msg", "to": "timeout", "tot": "str"}], "x": 600, "y": 140, "wires": [["ex4_trigger_dedup"]] }, { "id": "ex4_trigger_dedup", "type": "trigger", "name": "重複排除", "op1": "", "op2": "", "op1type": "pay", "op2type": "nul", "duration": "10", "extend": "false", "overrideDelay": "false", "units": "s", "reset": "", "bytopic": "topic", "topic": "_msgid", "outputs": 1, "x": 780, "y": 100, "wires": [["ex4_debug"]] }, { "id": "ex4_debug", "type": "debug", "name": "結果", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "x": 930, "y": 100, "wires": [] } ]

🎓 5. まとめ

Triggerノードの重要ポイント

⚠️ よくある間違い

📚 次のステップ

Triggerノードをマスターしたら、以下のノードも学んでみましょう:

🔧 6. トラブルシューティング

よくある問題と解決方法

問題 原因 解決方法
ウォッチドッグが毎回発火する 延長が無効 「延長」オプションを有効にする
リセットが効かない リセット値の不一致 リセット条件の値を正確に設定
2つ目の出力がない 「何も送らない」設定 op2typeを確認、必要な値を設定
タイマーが重複 トピック別の誤設定 トピック別処理の設定を確認
メッセージが繰り返される 負の時間設定 時間を正の値に変更
即座の出力がない op1が「何も送らない」 op1typeを確認、必要な値を設定

💡 7. 実務での活用例

ケース1: IoTデバイスのハートビート監視

MQTTでデバイスからハートビート受信 ↓ Triggerノード(延長モード) - 1つ目: 何も送らない - 2つ目: "offline" - 待機時間: 30秒 - 延長: 有効 ↓ 30秒間ハートビートなし ↓ "offline"出力 → アラート送信 ※ デバイスの生存監視

ケース2: LEDインジケータ制御

ボタン押下 or センサーイベント ↓ Triggerノード - 1つ目: 1 - 2つ目: 0 - 待機時間: 2秒 ↓ GPIO出力ノード ↓ LEDが2秒間点灯して消灯 ※ Raspberry PiのLED制御

ケース3: 自動セッションタイムアウト

ユーザーアクティビティ(API呼び出し等) ↓ Triggerノード(延長モード) - 1つ目: 何も送らない - 2つ目: "session_timeout" - 待機時間: 15分 - 延長: 有効 ↓ 15分間アクティビティなし ↓ セッション無効化処理 ※ Webアプリケーションのセッション管理

ケース4: 処理タイムアウトと自動リトライ

API呼び出し要求 ↓ Triggerノード(2出力) - 出力1: 即座にAPIへ - 出力2: 5秒後にタイムアウト ↓ ├─ 出力1 → HTTP Requestノード → 成功処理 └─ 出力2 → リトライカウンター → 再試行 ※ API呼び出しのタイムアウト処理

📖 8. 設定値詳細リファレンス

待機時間の単位

単位 内部値 説明
ミリ秒ms1/1000秒
s1秒
min60秒
時間hr3600秒

特殊な時間設定

設定 動作
正の値(例: 2) 指定時間後に2つ目を出力して終了
負の値(例: -2) 指定間隔で2つ目を繰り返し出力
0 即座に2つ目を出力

🔗 9. 追加リソース


このガイドが役に立ちましたら、実際のプロジェクトで練習してみてください!
Triggerノードはタイミング制御の強力なツールです。

参照元:NodeREDエディター内サンプルフロー

🏠