🎮 Node-RED Dashboard 2.0 入力系ウィジェット ガイド

このガイドでは、Dashboard 2.0の入力系ウィジェットについて詳しく解説します。これらのウィジェットは、ユーザーからの入力を受け付けてフローに送信するために使用します。

📌 このガイドで学べること:

📑 目次

  1. 入力系ウィジェットの概要
  2. サンプルフロー
  3. button(ボタン)
  4. switch(スイッチ)
  5. slider(スライダー)
  6. dropdown(ドロップダウン)
  7. text-input(テキスト入力)
  8. form(フォーム)
  9. radio-group(ラジオボタン)
  10. button-group(ボタングループ)
  11. 実践演習
  12. まとめ
  13. トラブルシューティング
  14. 実務での活用例
  15. 追加リソース

🎯 1. 入力系ウィジェットの概要

🤔 入力系ウィジェットとは?

入力系ウィジェットは、ユーザーからの入力を受け付けてNode-REDフローに送信するためのウィジェットです。 日常生活で例えると、リモコンや操作パネルのようなものです。

🎮 ゲームコントローラーに例えると:

📊 入力系ウィジェット一覧

ウィジェット 用途 出力値の型 入力受付
button クリックでアクション実行 設定値(任意) 状態更新可
switch ON/OFF切り替え boolean / 設定値
slider 数値の範囲入力 number
dropdown リストから選択 選択した値
text-input テキスト入力 string / number
form 複数フィールド入力 object
radio-group 排他的選択 選択した値
button-group ボタン群から選択 選択した値

🔥 2. サンプルフロー

📥 まずサンプルフローをインポートしましょう!

以下のサンプルフローには、このガイドで説明する全パターンの実例が含まれています。
先にインポートして、実際に動作を確認しながら読み進めると理解が深まります。

  1. 下のサンプルフローJSONをコピー
  2. Node-REDエディタで メニュー → 読み込み を選択
  3. JSONをペーストして「読み込み」をクリック
  4. デプロイしてダッシュボードで動作確認
📋 入力系ウィジェット サンプルフロー(クリックで展開)

このサンプルには ui-button, ui-switch, ui-slider, ui-dropdown, ui-text-input, ui-form, ui-radio-group, ui-button-group の全パターンが含まれています

[ { "id": "dc9d5574040bffd4", "type": "tab", "label": "入力系ウィジェット", "disabled": false, "info": "Dashboard 2.0 入力系ウィジェットのサンプル" }, { "id": "be670a85ab841705", "type": "comment", "z": "dc9d5574040bffd4", "name": "━━━ 🔘 ui-button サンプル ━━━", "info": "", "x": 160, "y": 40, "wires": [] }, { "id": "ece91638e37ec853", "type": "ui-button", "z": "dc9d5574040bffd4", "group": "input_ui_group_button", "name": "シンプルボタン", "label": "クリック", "order": 1, "width": 0, "height": 0, "emulateClick": false, "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "ボタンが押されました", "payloadType": "str", "topic": "button", "topicType": "str", "buttonColor": "", "textColor": "", "iconColor": "", "x": 140, "y": 100, "wires": [ [ "a2ed2e2ca5aa8e31" ] ] }, { "id": "4225585b61928a55", "type": "ui-button", "z": "dc9d5574040bffd4", "group": "input_ui_group_button", "name": "アイコンボタン", "label": "電源", "order": 2, "width": 0, "height": 0, "emulateClick": false, "color": "", "bgcolor": "", "className": "", "icon": "mdi-power", "iconPosition": "left", "payload": "power_toggle", "payloadType": "str", "topic": "power", "topicType": "str", "buttonColor": "", "textColor": "", "iconColor": "", "x": 140, "y": 160, "wires": [ [ "a2ed2e2ca5aa8e31" ] ] }, { "id": "d8874e2fef2314b7", "type": "ui-button", "z": "dc9d5574040bffd4", "group": "input_ui_group_button", "name": "スタイル付きボタン", "label": "緊急停止", "order": 3, "width": 0, "height": 0, "emulateClick": false, "color": "#ffffff", "bgcolor": "#f44336", "className": "", "icon": "mdi-alert-octagon", "iconPosition": "left", "payload": "emergency_stop", "payloadType": "str", "topic": "emergency", "topicType": "str", "buttonColor": "#f44336", "textColor": "#ffffff", "iconColor": "#ffffff", "x": 150, "y": 220, "wires": [ [ "a2ed2e2ca5aa8e31" ] ] }, { "id": "a2ed2e2ca5aa8e31", "type": "debug", "z": "dc9d5574040bffd4", "name": "ボタン出力", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 370, "y": 160, "wires": [] }, { "id": "d1ca70d8bde0cc9d", "type": "comment", "z": "dc9d5574040bffd4", "name": "━━━ 🔛 ui-switch サンプル ━━━", "info": "", "x": 160, "y": 300, "wires": [] }, { "id": "00fcb50fa09dd2ac", "type": "ui-switch", "z": "dc9d5574040bffd4", "name": "シンプルスイッチ", "label": "LEDライト", "group": "input_ui_group_switch", "order": 1, "width": 0, "height": 0, "passthru": false, "decouple": false, "topic": "led", "topicType": "str", "className": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 150, "y": 360, "wires": [ [ "238baaea30514539" ] ] }, { "id": "91c32f80c0b6e1c1", "type": "ui-switch", "z": "dc9d5574040bffd4", "name": "カスタム値スイッチ", "label": "モーター", "group": "input_ui_group_switch", "order": 2, "width": 0, "height": 0, "passthru": false, "decouple": false, "topic": "motor", "topicType": "str", "className": "", "onvalue": "running", "onvalueType": "str", "onicon": "mdi-play", "oncolor": "#4caf50", "offvalue": "stopped", "offvalueType": "str", "officon": "mdi-stop", "offcolor": "#f44336", "x": 160, "y": 420, "wires": [ [ "238baaea30514539" ] ] }, { "id": "620f3ae577d53309", "type": "inject", "z": "dc9d5574040bffd4", "name": "ON", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "true", "payloadType": "bool", "x": 110, "y": 480, "wires": [ [ "00fcb50fa09dd2ac" ] ] }, { "id": "37f962b4b904eddc", "type": "inject", "z": "dc9d5574040bffd4", "name": "OFF", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "false", "payloadType": "bool", "x": 110, "y": 520, "wires": [ [ "00fcb50fa09dd2ac" ] ] }, { "id": "238baaea30514539", "type": "debug", "z": "dc9d5574040bffd4", "name": "スイッチ出力", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 390, "y": 390, "wires": [] }, { "id": "468c322b2e538d5a", "type": "comment", "z": "dc9d5574040bffd4", "name": "━━━ 🎚️ ui-slider サンプル ━━━", "info": "", "x": 160, "y": 600, "wires": [] }, { "id": "6a66ddbd42f6407b", "type": "ui-slider", "z": "dc9d5574040bffd4", "group": "input_ui_group_slider", "name": "音量スライダー", "label": "音量", "order": 1, "width": 0, "height": 0, "passthru": false, "outs": "all", "topic": "volume", "topicType": "str", "showTicks": "always", "min": 0, "max": 100, "step": 1, "className": "", "iconPrepend": "", "iconAppend": "", "color": "", "x": 160, "y": 660, "wires": [ [ "af3a4d9e66ee60b8" ] ] }, { "id": "93f40d44ae6feb64", "type": "ui-slider", "z": "dc9d5574040bffd4", "group": "input_ui_group_slider", "name": "温度設定", "label": "設定温度", "order": 2, "width": 0, "height": 0, "passthru": false, "outs": "end", "topic": "temperature", "topicType": "str", "showTicks": "always", "min": 16, "max": 30, "step": 0.5, "className": "", "iconPrepend": "", "iconAppend": "", "color": "", "x": 140, "y": 720, "wires": [ [ "af3a4d9e66ee60b8" ] ] }, { "id": "25b20ed45938fd90", "type": "inject", "z": "dc9d5574040bffd4", "name": "50%", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "50", "payloadType": "num", "x": 110, "y": 780, "wires": [ [ "6a66ddbd42f6407b" ] ] }, { "id": "af3a4d9e66ee60b8", "type": "debug", "z": "dc9d5574040bffd4", "name": "スライダー出力", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 400, "y": 690, "wires": [] }, { "id": "5b6a7ff04b25578f", "type": "comment", "z": "dc9d5574040bffd4", "name": "━━━ 📋 ui-dropdown サンプル ━━━", "info": "", "x": 170, "y": 860, "wires": [] }, { "id": "12e94b91f71bbbcf", "type": "ui-dropdown", "z": "dc9d5574040bffd4", "group": "input_ui_group_select", "name": "複数選択", "label": "通知先", "order": 2, "width": 0, "height": 0, "passthru": false, "multiple": true, "chips": true, "clearable": true, "options": [ { "label": "メール", "value": "email", "type": "str" }, { "label": "Slack", "value": "slack", "type": "str" }, { "label": "LINE", "value": "line", "type": "str" }, { "label": "SMS", "value": "sms", "type": "str" } ], "topic": "notify", "topicType": "str", "className": "", "x": 140, "y": 980, "wires": [ [ "0b4c0c9ed1f1d045" ] ] }, { "id": "0b4c0c9ed1f1d045", "type": "debug", "z": "dc9d5574040bffd4", "name": "ドロップダウン出力", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 410, "y": 950, "wires": [] }, { "id": "c193745151fcb0b4", "type": "inject", "z": "dc9d5574040bffd4", "name": "地域オプション", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 160, "y": 1080, "wires": [ [ "d160c692c0ee4652" ] ] }, { "id": "d160c692c0ee4652", "type": "function", "z": "dc9d5574040bffd4", "name": "options生成", "func": "msg.options = [\n {\"label\": \"東京\", \"value\": \"tokyo\"},\n {\"label\": \"大阪\", \"value\": \"osaka\"},\n {\"label\": \"福岡\", \"value\": \"fukuoka\"}\n];\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 1080, "wires": [ [ "f5c5e9da805c49a3" ] ] }, { "id": "ade09c3acb1fe939", "type": "comment", "z": "dc9d5574040bffd4", "name": "━━━ ⌨️ ui-text-input サンプル ━━━", "info": "", "x": 180, "y": 1200, "wires": [] }, { "id": "b2b1827a4fa85257", "type": "ui-text-input", "z": "dc9d5574040bffd4", "group": "input_ui_group_text", "name": "名前入力", "label": "お名前", "order": 1, "width": 0, "height": 0, "topic": "name", "topicType": "str", "mode": "text", "delay": 300, "passthru": false, "sendOnBlur": true, "sendOnEnter": true, "className": "", "x": 160, "y": 1240, "wires": [ [ "b3dafd0ddf1ea511" ] ] }, { "id": "748bbaef47aee09f", "type": "ui-text-input", "z": "dc9d5574040bffd4", "group": "input_ui_group_text", "name": "数値入力", "label": "数量", "order": 2, "width": 0, "height": 0, "topic": "quantity", "topicType": "str", "mode": "number", "delay": 300, "passthru": false, "sendOnBlur": true, "sendOnEnter": true, "className": "", "x": 160, "y": 1300, "wires": [ [ "b3dafd0ddf1ea511" ] ] }, { "id": "0616f421b8a4a8df", "type": "ui-text-input", "z": "dc9d5574040bffd4", "group": "input_ui_group_text", "name": "パスワード入力", "label": "パスワード", "order": 3, "width": 0, "height": 0, "topic": "password", "topicType": "str", "mode": "password", "delay": 300, "passthru": false, "sendOnBlur": true, "sendOnEnter": true, "className": "", "x": 180, "y": 1360, "wires": [ [ "b3dafd0ddf1ea511" ] ] }, { "id": "b3dafd0ddf1ea511", "type": "debug", "z": "dc9d5574040bffd4", "name": "テキスト入力出力", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 430, "y": 1300, "wires": [] }, { "id": "47ba59b4af0b82be", "type": "comment", "z": "dc9d5574040bffd4", "name": "━━━ 📝 ui-form サンプル ━━━", "info": "", "x": 160, "y": 1440, "wires": [] }, { "id": "421878c92ed51ea6", "type": "ui-form", "z": "dc9d5574040bffd4", "name": "ユーザー登録フォーム", "group": "input_ui_group_form", "label": "", "order": 1, "width": 0, "height": 0, "options": [ { "label": "名前", "key": "name", "type": "text", "required": true, "rows": null }, { "label": "メール", "key": "email", "type": "email", "required": true, "rows": null }, { "label": "年齢", "key": "age", "type": "number", "required": false, "rows": null }, { "label": "コメント", "key": "comment", "type": "multiline", "required": false, "rows": 3 } ], "resetOnSubmit": true, "topic": "user_registration", "topicType": "str", "splitLayout": false, "className": "", "x": 200, "y": 1500, "wires": [ [ "596b1eee63dc8533" ] ] }, { "id": "596b1eee63dc8533", "type": "debug", "z": "dc9d5574040bffd4", "name": "フォーム出力", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 430, "y": 1500, "wires": [] }, { "id": "comment_radio_group", "type": "comment", "z": "dc9d5574040bffd4", "name": "━━━ 🔘 ui-radio-group サンプル ━━━", "info": "", "x": 180, "y": 1580, "wires": [] }, { "id": "ui_radio_priority", "type": "ui-radio-group", "z": "dc9d5574040bffd4", "group": "input_ui_group_radio", "name": "優先度選択", "label": "優先度", "order": 1, "width": 0, "height": 0, "topic": "priority", "topicType": "str", "passthru": false, "options": [ { "label": "🔴 高", "value": "high" }, { "label": "🟡 中", "value": "medium" }, { "label": "🟢 低", "value": "low" } ], "className": "", "x": 160, "y": 1640, "wires": [ [ "debug_radio_group" ] ] }, { "id": "debug_radio_group", "type": "debug", "z": "dc9d5574040bffd4", "name": "ラジオ出力", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 370, "y": 1640, "wires": [] }, { "id": "comment_button_group", "type": "comment", "z": "dc9d5574040bffd4", "name": "━━━ 🎛️ ui-button-group サンプル ━━━", "info": "", "x": 190, "y": 1720, "wires": [] }, { "id": "ui_button_group_mode", "type": "ui-button-group", "z": "dc9d5574040bffd4", "group": "input_ui_group_btngroup", "name": "表示モード", "label": "表示モード", "order": 1, "width": 0, "height": 0, "topic": "display_mode", "topicType": "str", "passthru": false, "options": [ { "label": "リスト", "value": "list", "icon": "mdi-format-list-bulleted", "color": "" }, { "label": "グリッド", "value": "grid", "icon": "mdi-grid", "color": "" }, { "label": "カード", "value": "card", "icon": "mdi-card-outline", "color": "" } ], "className": "", "x": 160, "y": 1780, "wires": [ [ "debug_button_group" ] ] }, { "id": "debug_button_group", "type": "debug", "z": "dc9d5574040bffd4", "name": "ボタングループ出力", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 410, "y": 1780, "wires": [] }, { "id": "f5c5e9da805c49a3", "type": "ui-dropdown", "z": "dc9d5574040bffd4", "group": "input_ui_group_select", "name": "動作モード(動的)", "label": "動的オプション", "order": 3, "width": 0, "height": 0, "passthru": false, "multiple": false, "chips": false, "clearable": false, "options": [ { "label": "自動", "value": "auto", "type": "str" }, { "label": "手動", "value": "manual", "type": "str" }, { "label": "停止", "value": "stop", "type": "str" } ], "topic": "mode", "topicType": "str", "className": "", "typeIsComboBox": true, "msgTrigger": "onChange", "x": 560, "y": 1080, "wires": [ [ "0b4c0c9ed1f1d045" ] ] }, { "id": "7084e3a37c4c1ea5", "type": "ui-dropdown", "z": "dc9d5574040bffd4", "group": "input_ui_group_select", "name": "動作モード", "label": "動作モード", "order": 1, "width": 0, "height": 0, "passthru": false, "multiple": false, "chips": false, "clearable": false, "options": [ { "label": "自動", "value": "auto", "type": "str" }, { "label": "手動", "value": "manual", "type": "str" }, { "label": "停止", "value": "stop", "type": "str" } ], "payload": "", "topic": "topic", "topicType": "msg", "className": "", "typeIsComboBox": true, "msgTrigger": "onChange", "x": 150, "y": 940, "wires": [ [ "0b4c0c9ed1f1d045" ] ] }, { "id": "input_ui_group_radio", "type": "ui-group", "name": "🔘 ラジオボタン", "page": "input_ui_page", "width": "6", "height": "4", "order": 7, "showTitle": true, "className": "", "visible": true, "disabled": false, "groupType": "default" }, { "id": "input_ui_group_btngroup", "type": "ui-group", "name": "🎛️ ボタングループ", "page": "input_ui_page", "width": "6", "height": "4", "order": 8, "showTitle": true, "className": "", "visible": true, "disabled": false, "groupType": "default" }, { "id": "input_ui_group_button", "type": "ui-group", "name": "🔘 ボタン", "page": "input_ui_page", "width": "6", "height": "4", "order": 1, "showTitle": true, "className": "", "visible": true, "disabled": false, "groupType": "default" }, { "id": "input_ui_group_switch", "type": "ui-group", "name": "🔛 スイッチ", "page": "input_ui_page", "width": "6", "height": "4", "order": 2, "showTitle": true, "className": "", "visible": true, "disabled": false, "groupType": "default" }, { "id": "input_ui_group_slider", "type": "ui-group", "name": "🎚️ スライダー", "page": "input_ui_page", "width": "6", "height": "4", "order": 3, "showTitle": true, "className": "", "visible": true, "disabled": false, "groupType": "default" }, { "id": "input_ui_group_select", "type": "ui-group", "name": "📋 選択系", "page": "input_ui_page", "width": "6", "height": "6", "order": 4, "showTitle": true, "className": "", "visible": true, "disabled": false, "groupType": "default" }, { "id": "input_ui_group_text", "type": "ui-group", "name": "⌨️ テキスト入力", "page": "input_ui_page", "width": "6", "height": "6", "order": 5, "showTitle": true, "className": "", "visible": true, "disabled": false, "groupType": "default" }, { "id": "input_ui_group_form", "type": "ui-group", "name": "📝 フォーム", "page": "input_ui_page", "width": "6", "height": "8", "order": 6, "showTitle": true, "className": "", "visible": true, "disabled": false, "groupType": "default" }, { "id": "input_ui_page", "type": "ui-page", "name": "入力系サンプル", "ui": "6692685697ac2af1", "path": "/input-widgets", "icon": "mdi-gamepad-variant", "layout": "grid", "theme": "input_ui_theme", "breakpoints": [ { "name": "Default", "px": 0, "cols": 3 }, { "name": "Tablet", "px": 576, "cols": 6 }, { "name": "Small Desktop", "px": 768, "cols": 9 }, { "name": "Desktop", "px": 1024, "cols": 12 } ], "order": 2, "className": "", "visible": "true", "disabled": "false" }, { "id": "6692685697ac2af1", "type": "ui-base", "name": "My Dashboard", "path": "/dashboard", "appIcon": "", "includeClientData": true, "acceptsClientConfig": [ "ui-notification", "ui-control" ], "showPathInSidebar": false, "headerContent": "page", "navigationStyle": "default", "titleBarStyle": "default", "showPageTitle": true, "showReconnectNotification": true, "notificationDisplayTime": 1, "showDisconnectNotification": true, "allowInstall": false }, { "id": "input_ui_theme", "type": "ui-theme", "name": "Default Theme", "colors": { "surface": "#ffffff", "primary": "#b92d5d", "bgPage": "#eeeeee", "groupBg": "#ffffff", "groupOutline": "#cccccc" }, "sizes": { "pagePadding": "12px", "groupGap": "12px", "groupBorderRadius": "4px", "widgetGap": "12px", "density": "default" } }, { "id": "012aac34447c496d", "type": "global-config", "env": [], "modules": { "@flowfuse/node-red-dashboard": "1.29.0" } } ]

🔘 3. button(ボタン)

入力 button ウィジェット

クリックすると設定した値をmsg.payloadとして送信するボタンです。アイコン、色などをカスタマイズできます。

📋 主要プロパティ

プロパティ 説明 デフォルト
Label ボタンに表示するテキスト "Button"
Icon Material Design Icons(mdi-xxx形式) なし
Icon Position アイコンの位置(left/right) left
Payload クリック時に送信する値 タイムスタンプ
Topic msg.topicに設定する値
Background Color ボタンの背景色 テーマ色
Text Color ボタンのテキスト色 自動
Emulate Click 入力メッセージでクリックをエミュレート false
Payload Type Payloadの値タイプ(str/num/json等) str
Topic Type Topicの値タイプ msg
Button Color ボタンの背景色
Icon Color アイコンの色
Enable Click クリックイベントの有効/無効 true
Enable Pointerdown ボタン押下イベントの有効/無効 false
Pointerdown Payload ボタン押下時に送信する値
Pointerdown Payload Type 押下Payloadの値タイプ str
Enable Pointerup ボタン離上イベントの有効/無効 false
Pointerup Payload ボタン離上時に送信する値
Pointerup Payload Type 離上Payloadの値タイプ str
Class CSSクラス名

🎯 使用パターン

パターン1: シンプルなボタン

基本的なボタンで固定値を送信します。

ui-button Debug
// クリック時の出力 msg.payload = "ボタンが押されました" msg.topic = "button"

パターン2: アイコン付きボタン

アイコンを表示したボタンです。アイコンはMaterial Design Iconsから選択でき、mdi-プレフィックスを付けて指定します。

ui-button
🔌 電源
Debug
// アイコン: mdi-power // Payload: "power_toggle" // クリック時の出力 msg.payload = "power_toggle" msg.topic = "power"

パターン3: スタイル付きボタン

背景色・テキスト色をカスタマイズした目立つボタンです。

ui-button
⚠️ 緊急停止
Function Debug
// 設定 Background Color: #f44336 (赤) Text Color: #ffffff (白) Icon: mdi-alert-octagon

💡 動的プロパティ更新:

msg.ui_updateでボタンの外観を動的に変更できます。

msg.ui_update = { "label": "処理中...", "icon": "mdi-loading", "buttonColor": "#ff9800" }

🔛 4. switch(スイッチ)

入出力 switch ウィジェット

ON/OFFを切り替えるトグルスイッチです。状態を表示しつつ、ユーザーの操作で値を送信します。msg.payloadで状態を設定することもできます。

📋 主要プロパティ

プロパティ 説明 デフォルト
Label スイッチの横に表示するラベル
On Value ON状態で送信する値 true
Off Value OFF状態で送信する値 false
On Color ON状態の色 テーマ色
Off Color OFF状態の色 グレー
On Icon ON状態のアイコン なし
Off Icon OFF状態のアイコン なし
Pass Through 入力メッセージをそのまま出力に流す false
Decouple 入力と出力を分離(入力で状態変更時に出力しない) false
Topic msg.topicに設定する値 topic
Topic Type Topicの値タイプ msg
Layout ラベルとスイッチの配置方法 row-spread
Clickable Area クリック可能な範囲(switch/widget) switch
On Value Type ON値のタイプ bool
Off Value Type OFF値のタイプ bool
Class CSSクラス名

🎯 使用パターン

パターン1: シンプルなON/OFFスイッチ

boolean値(true/false)を送信する基本的なスイッチです。

ui-switch
LEDライト
Debug
// ON時: msg.payload = true // OFF時: msg.payload = false

パターン2: カスタム値スイッチ

ON/OFFで異なる文字列を送信し、アイコン・色も変更します。アイコンはMaterial Design Iconsから選択できます。

ui-switch
モーター
Switch Function
// 設定 On Value: "running" (文字列) Off Value: "stopped" (文字列) On Color: #4caf50 (緑) Off Color: #f44336 (赤) On Icon: mdi-play Off Icon: mdi-stop

パターン3: 外部からの状態制御

Injectノードなどから状態を設定できます。

Inject
true
ui-switch Debug
// スイッチをONにする msg.payload = true // スイッチをOFFにする msg.payload = false

⚠️ Pass ThroughとDecoupleの違い:

🎚️ 5. slider(スライダー)

入出力 slider ウィジェット

スライダーをドラッグして数値を入力します。音量、明るさ、温度設定などに最適です。

📋 主要プロパティ

プロパティ 説明 デフォルト
Label スライダーの上に表示するラベル
Min 最小値 0
Max 最大値 100
Step 刻み幅 1
Output 出力タイミング(all: 操作中常時 / end: 操作完了時のみ) all
Show Value 現在値を表示 true
Show Ticks 目盛りの表示(always/drag/never) always
Pass Through 入力メッセージを出力にパススルー(値更新と同時に元のmsg全体を出力) false
Topic msg.topicに設定する値 topic
Topic Type Topicの値タイプ msg
Icon Prepend スライダー左側に表示するアイコン
Icon Append スライダー右側に表示するアイコン
Color スライダーの色
Color Track トラック部分の色
Color Thumb つまみ部分の色
Show Text Field 数値入力フィールドの表示 false
Class CSSクラス名

🎯 使用パターン

パターン1: 音量スライダー(0-100)

操作中にリアルタイムで値を送信します。

ui-slider
音量: 0-100
Debug
// 設定 Min: 0, Max: 100, Step: 1 Output: all (操作中常時送信) // 出力: msg.payload = 75

パターン2: 温度設定スライダー(小数点対応)

0.5度刻みで設定でき、操作完了時のみ送信します。

ui-slider
温度: 16-30℃
Function Debug
// 設定 Min: 16, Max: 30, Step: 0.5 Output: end (操作完了時のみ) // 出力: msg.payload = 25.5

パターン3: 外部からの値設定

msg.payloadでスライダーの値を設定できます。

Inject
50
ui-slider
// スライダーを50%に設定 msg.payload = 50

💡 Outputオプションの使い分け:

💡 Pass Through: 有効にすると、入力メッセージで値を更新した際に、元のメッセージ全体(msg.topicなど他のプロパティも含む)を出力に流します。

📋 6. dropdown(ドロップダウン)

入出力 dropdown ウィジェット

ドロップダウンリストから選択します。単一選択と複数選択に対応しています。

📋 主要プロパティ

プロパティ 説明 デフォルト
Label ドロップダウンのラベル
Options 選択肢のリスト(label/value/type) []
Multiple 複数選択を許可 false
Chips 選択項目をチップ形式で表示(複数選択時) false
Clearable 選択解除ボタンを表示 false
Pass Through 入力メッセージを出力にパススルー(値更新と同時に元のmsg全体を出力) false
Payload 初期選択値
Topic msg.topicに設定する値 topic
Topic Type Topicの値タイプ msg
Type Is ComboBox コンボボックスとして動作(テキスト入力可) true
Msg Trigger メッセージ送信のトリガー条件 onChange
Class CSSクラス名

🎯 使用パターン

パターン1: 単一選択ドロップダウン

モード選択など、1つだけ選ぶ場合に使用します。

ui-dropdown
動作モード
Switch Function
// Options設定 [ {"label": "自動", "value": "auto", "type": "str"}, {"label": "手動", "value": "manual", "type": "str"}, {"label": "停止", "value": "stop", "type": "str"} ] // 出力: msg.payload = "auto"

パターン2: 複数選択ドロップダウン

複数の項目を選択可能です。チップ表示で見やすくなります。

ui-dropdown
通知先(複数可)
Function Debug
// 設定 Multiple: true Chips: true Clearable: true // 出力: msg.payload = ["email", "slack", "line"]

パターン3: 動的にオプションを変更

msg.optionsでドロップダウンの選択肢を動的に変更できます。

Inject Function
options生成
ui-dropdown
// Functionノードで動的オプション生成 msg.options = [ {"label": "東京", "value": "tokyo"}, {"label": "大阪", "value": "osaka"}, {"label": "福岡", "value": "fukuoka"} ]; return msg;

💡 Pass Through: 有効にすると、入力メッセージで選択値を更新した際に、元のメッセージ全体を出力に流します。msg.optionsで選択肢を動的に変更する際に、他のプロパティを維持したい場合に便利です。

⌨️ 7. text-input(テキスト入力)

入出力 text-input ウィジェット

テキスト、数値、パスワードなど様々な形式の入力を受け付けます。

📋 主要プロパティ

プロパティ 説明 デフォルト
Label 入力フィールドのラベル
Mode 入力モード(text/number/password/email/tel/color/date/time/week/month) text
Delay 入力後の送信遅延(ms) 300
Send On Blur フォーカスが外れた時に送信 true
Send On Enter Enterキーで送信 true
Clear On Submit 送信後に入力をクリア false
Pass Through 入力メッセージを出力にパススルー(値更新と同時に元のmsg全体を出力) false
Topic msg.topicに設定する値 topic
Topic Type Topicの値タイプ msg
Tooltip ホバー時に表示するツールチップ
Send On Delay 遅延後に自動送信の有効/無効 false
Clearable クリアボタンの表示 false
Send On Clear クリア時にメッセージを送信 false
Icon 入力フィールドに表示するアイコン
Icon Position アイコンの位置(left/right) left
Icon Inner Position アイコンの内側/外側配置 inside
Class CSSクラス名

🎯 入力モード一覧

text

通常のテキスト入力

msg.payload = "Hello"

number

数値入力(数値型で出力)

msg.payload = 42

password

パスワード入力(マスク表示)

msg.payload = "secret123"

email

メールアドレス入力

msg.payload = "[email protected]"

date

日付選択

msg.payload = "2024-01-15"

color

カラーピッカー

msg.payload = "#ff5722"

🎯 使用パターン

パターン1: 名前入力フィールド

ui-text-input
お名前
Debug
// 設定 Mode: text Send On Enter: true Send On Blur: true

パターン2: 数量入力フィールド

ui-text-input
数量
Function Debug
// 設定 Mode: number // 出力は数値型 msg.payload = 10 // typeof === "number"

パターン3: 入力値のクリア

msg.payload = ""を送ると入力フィールドをクリアできます。

Inject
""
ui-text-input

💡 Pass Through: 有効にすると、入力メッセージでテキスト値を更新した際に、元のメッセージ全体を出力に流します。

📝 8. form(フォーム)

入力 form ウィジェット

複数の入力フィールドをまとめたフォームです。送信ボタンをクリックすると、全フィールドの値がオブジェクトとして送信されます。

📋 主要プロパティ

プロパティ 説明 デフォルト
Label フォームのラベル
Options フォームフィールドの定義リスト [{value, label, type, required}]
Submit 送信ボタンのテキスト "Submit"
Cancel キャンセルボタンのテキスト "Cancel"
Reset On Submit 送信後にフォームをリセット true
Topic msg.topicに設定する値 topic
Topic Type Topicの値タイプ msg
Split Layout フォームを分割レイアウトで表示
Class CSSクラス名

📋 フィールドタイプ

タイプ 説明 出力値
text テキスト入力 string
number 数値入力 number
email メール入力 string
password パスワード入力 string
checkbox チェックボックス boolean
switch スイッチ boolean
date 日付選択 string (YYYY-MM-DD)
time 時刻選択 string (HH:MM)
multiline 複数行テキスト string

🎯 使用パターン

パターン1: ユーザー登録フォーム

ui-form
ユーザー登録
Function Debug
// フィールド設定 [ {"label": "名前", "key": "name", "type": "text", "required": true}, {"label": "メール", "key": "email", "type": "email", "required": true}, {"label": "年齢", "key": "age", "type": "number", "required": false}, {"label": "コメント", "key": "comment", "type": "multiline", "rows": 3} ] // 出力 msg.payload = { "name": "山田太郎", "email": "[email protected]", "age": 30, "comment": "よろしくお願いします" }

パターン2: 設定フォーム

ui-form
デバイス設定
Change Function
// フィールド設定 [ {"label": "デバイス名", "key": "deviceName", "type": "text", "required": true}, {"label": "IPアドレス", "key": "ip", "type": "text", "required": true}, {"label": "ポート", "key": "port", "type": "number", "required": true}, {"label": "有効化", "key": "enabled", "type": "switch", "required": false} ] // 出力 msg.payload = { "deviceName": "センサー1", "ip": "192.168.1.100", "port": 8080, "enabled": true }

💡 フォームの初期値設定:

msg.payloadにオブジェクトを送信すると、フォームの各フィールドに初期値を設定できます。

// フォームに初期値を設定 msg.payload = { "name": "デフォルト名", "email": "[email protected]" }; return msg;

🔘 9. radio-group(ラジオボタン)

入出力 radio-group ウィジェット

複数の選択肢から1つだけを選ぶラジオボタングループです。選択肢が少ない場合に視認性が高く便利です。

📋 主要プロパティ

プロパティ 説明 デフォルト
Label グループのラベル
Options 選択肢のリスト []
Columns 列数(横並び数) 1
Pass Through 入力メッセージを出力にパススルー false
Payload 初期選択値
Topic msg.topicに設定する値 topic
Topic Type Topicの値タイプ msg
Class CSSクラス名

使用例: 優先度選択

ui-radio-group
優先度
Debug
// Options設定 [ {"label": "🔴 高", "value": "high"}, {"label": "🟡 中", "value": "medium"}, {"label": "🟢 低", "value": "low"} ] // 出力: msg.payload = "high"

🎛️ 10. button-group(ボタングループ)

入出力 button-group ウィジェット

複数のボタンを横に並べたグループです。セグメントコントロールのような選択UIを作れます。

📋 主要プロパティ

プロパティ 説明 デフォルト
Label グループのラベル
Options ボタンのリスト(label/value/icon/color) []
Pass Through 入力メッセージを出力にパススルー false
Rounded ボタンの角を丸くする true
Use Theme Colors テーマカラーを使用 true
Topic msg.topicに設定する値 topic
Topic Type Topicの値タイプ msg
Class CSSクラス名

使用例: 表示モード切替

ui-button-group
表示モード
Switch Function
// Options設定 [ {"label": "リスト", "value": "list", "icon": "mdi-format-list-bulleted"}, {"label": "グリッド", "value": "grid", "icon": "mdi-view-grid"}, {"label": "テーブル", "value": "table", "icon": "mdi-table"} ] // 出力: msg.payload = "grid"

🏋️ 11. 実践演習

📝 演習の進め方:

🔘 button ウィジェット演習

演習 B-1: シンプルボタン初級

📝 課題:

クリックすると「ボタンが押されました」というメッセージを送信するシンプルなボタンを作成してください。

🎯 要求仕様:

📊 期待される出力:

msg.payload = "ボタンが押されました"
💡 ヒント

ui-buttonの設定:

  • Label: 「クリック」
  • Payload: 「ボタンが押されました」(string型)
  • Topic: 空欄のままでOK

Debugノードの設定:

  • 出力: msg.payload
  • 対象: デバッグウィンドウ
✅ 解答例フロー
[{"id":"b1_tab","type":"tab","label":"B-1: シンプルボタン"},{"id":"b1_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"b1_page","type":"ui-page","name":"ボタン演習","ui":"b1_base","path":"/b1","layout":"grid","theme":"b1_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"b1_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"b1_group","type":"ui-group","name":"🔘 ボタン","page":"b1_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"b1_button","type":"ui-button","z":"b1_tab","group":"b1_group","name":"シンプルボタン","label":"クリック","order":1,"width":0,"height":0,"emulateClick":false,"color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"ボタンが押されました","payloadType":"str","topic":"button","topicType":"str","buttonColor":"","textColor":"","iconColor":"","x":150,"y":100,"wires":[["b1_debug"]]},{"id":"b1_debug","type":"debug","z":"b1_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":350,"y":100,"wires":[]}]

演習 B-2: アイコン付きボタン中級

📝 課題:

電源アイコン付きのボタンを作成してください。

🎯 要求仕様:

📊 期待される出力:

msg.payload = "power_toggle" msg.topic = "power"
💡 ヒント

ui-buttonの設定:

  • Label: 「電源」
  • Icon: 「mdi-power」(Material Design Iconsから選択)
  • Icon Position: left
  • Payload: 「power_toggle」(string型)
  • Topic: 「power」
✅ 解答例フロー
[{"id":"b2_tab","type":"tab","label":"B-2: アイコン付きボタン"},{"id":"b2_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"b2_page","type":"ui-page","name":"ボタン演習","ui":"b2_base","path":"/b2","layout":"grid","theme":"b2_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"b2_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"b2_group","type":"ui-group","name":"🔌 電源コントロール","page":"b2_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"b2_button","type":"ui-button","z":"b2_tab","group":"b2_group","name":"電源ボタン","label":"電源","order":1,"width":0,"height":0,"emulateClick":false,"color":"","bgcolor":"","className":"","icon":"mdi-power","iconPosition":"left","payload":"power_toggle","payloadType":"str","topic":"power","topicType":"str","buttonColor":"","textColor":"","iconColor":"","x":150,"y":100,"wires":[["b2_debug"]]},{"id":"b2_debug","type":"debug","z":"b2_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":350,"y":100,"wires":[]}]

演習 B-3: 動的ボタン更新上級

📝 課題:

Injectノードからmsg.ui_updateを送信して、ボタンの外観(ラベル、アイコン、色)を動的に変更してください。

🎯 要求仕様:

💡 ヒント

Injectノードの設定(処理中):

  • msg.ui_update にオブジェクトを設定
  • 値: {"label":"処理中...","icon":"mdi-loading","buttonColor":"#ff9800"}

Injectノードの設定(完了):

  • msg.ui_update にオブジェクトを設定
  • 値: {"label":"完了","icon":"mdi-check","buttonColor":"#4caf50"}
✅ 解答例フロー
[{"id":"b3_tab","type":"tab","label":"B-3: 動的ボタン更新"},{"id":"b3_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"b3_page","type":"ui-page","name":"ボタン演習","ui":"b3_base","path":"/b3","layout":"grid","theme":"b3_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"b3_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"b3_group","type":"ui-group","name":"🔄 動的ボタン","page":"b3_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"b3_button","type":"ui-button","z":"b3_tab","group":"b3_group","name":"動的ボタン","label":"待機中","order":1,"width":0,"height":0,"emulateClick":false,"color":"","bgcolor":"","className":"","icon":"mdi-clock-outline","iconPosition":"left","payload":"clicked","payloadType":"str","topic":"","topicType":"str","buttonColor":"","textColor":"","iconColor":"","x":300,"y":100,"wires":[["b3_debug"]]},{"id":"b3_inject_processing","type":"inject","z":"b3_tab","name":"処理中","props":[{"p":"ui_update","v":"{\"label\":\"処理中...\",\"icon\":\"mdi-loading\",\"buttonColor\":\"#ff9800\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":60,"wires":[["b3_button"]]},{"id":"b3_inject_done","type":"inject","z":"b3_tab","name":"完了","props":[{"p":"ui_update","v":"{\"label\":\"完了\",\"icon\":\"mdi-check\",\"buttonColor\":\"#4caf50\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":140,"wires":[["b3_button"]]},{"id":"b3_debug","type":"debug","z":"b3_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":490,"y":100,"wires":[]}]

🔛 switch ウィジェット演習

演習 S-1: シンプルスイッチ初級

📝 課題:

ON/OFFを切り替えてboolean値を送信するシンプルなスイッチを作成してください。

🎯 要求仕様:

📊 期待される出力:

// ON時: msg.payload = true // OFF時: msg.payload = false
💡 ヒント

ui-switchの設定:

  • Label: 「LEDライト」
  • On Value: true (boolean型)
  • Off Value: false (boolean型)
  • Topic: 「led」
✅ 解答例フロー
[{"id":"s1_tab","type":"tab","label":"S-1: シンプルスイッチ"},{"id":"s1_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"s1_page","type":"ui-page","name":"スイッチ演習","ui":"s1_base","path":"/s1","layout":"grid","theme":"s1_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"s1_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"s1_group","type":"ui-group","name":"💡 LEDコントロール","page":"s1_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"s1_switch","type":"ui-switch","z":"s1_tab","group":"s1_group","name":"LEDスイッチ","label":"LEDライト","order":1,"width":0,"height":0,"passthru":false,"decouple":false,"topic":"led","topicType":"str","className":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":150,"y":100,"wires":[["s1_debug"]]},{"id":"s1_debug","type":"debug","z":"s1_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":350,"y":100,"wires":[]}]

演習 S-2: カスタム値スイッチ中級

📝 課題:

ON/OFFで異なる文字列値を送信し、アイコンと色も変更されるスイッチを作成してください。

🎯 要求仕様:

📊 期待される出力:

// ON時: msg.payload = "running" // OFF時: msg.payload = "stopped"
💡 ヒント

ui-switchの設定:

  • Label: 「モーター」
  • On Value: 「running」 (string型)
  • Off Value: 「stopped」 (string型)
  • On Color: #4caf50 (緑)
  • Off Color: #f44336 (赤)
  • On Icon: mdi-play
  • Off Icon: mdi-stop
✅ 解答例フロー
[{"id":"s2_tab","type":"tab","label":"S-2: カスタム値スイッチ"},{"id":"s2_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"s2_page","type":"ui-page","name":"スイッチ演習","ui":"s2_base","path":"/s2","layout":"grid","theme":"s2_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"s2_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"s2_group","type":"ui-group","name":"⚙️ モーターコントロール","page":"s2_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"s2_switch","type":"ui-switch","z":"s2_tab","group":"s2_group","name":"モータースイッチ","label":"モーター","order":1,"width":0,"height":0,"passthru":false,"decouple":false,"topic":"motor","topicType":"str","className":"","onvalue":"running","onvalueType":"str","onicon":"mdi-play","oncolor":"#4caf50","offvalue":"stopped","offvalueType":"str","officon":"mdi-stop","offcolor":"#f44336","x":170,"y":100,"wires":[["s2_debug"]]},{"id":"s2_debug","type":"debug","z":"s2_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":370,"y":100,"wires":[]}]

演習 S-3: 外部制御スイッチ中級

📝 課題:

Injectノードからスイッチの状態を外部から制御できるフローを作成してください。

🎯 要求仕様:

💡 ヒント

ui-switchの設定:

  • 「If msg arrives on input, pass through to output」にチェックを入れて有効にする
  • → これにより、Injectノードから送信した値がスイッチを通過してDebugに出力されます

Injectノードの設定(ON):

  • msg.payload: true (boolean型)

Injectノードの設定(OFF):

  • msg.payload: false (boolean型)

ポイント: Injectからui-switchにワイヤーを接続すると、スイッチの状態が変更されます。

✅ 解答例フロー
[{"id":"s3_tab","type":"tab","label":"S-3: 外部制御スイッチ"},{"id":"s3_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"s3_page","type":"ui-page","name":"スイッチ演習","ui":"s3_base","path":"/s3","layout":"grid","theme":"s3_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"s3_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"s3_group","type":"ui-group","name":"📡 リモート制御","page":"s3_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"s3_switch","type":"ui-switch","z":"s3_tab","group":"s3_group","name":"リモートスイッチ","label":"リモート制御","order":1,"width":0,"height":0,"passthru":true,"decouple":false,"topic":"remote","topicType":"str","className":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":300,"y":100,"wires":[["s3_debug"]]},{"id":"s3_inject_on","type":"inject","z":"s3_tab","name":"ON","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":110,"y":60,"wires":[["s3_switch"]]},{"id":"s3_inject_off","type":"inject","z":"s3_tab","name":"OFF","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":110,"y":140,"wires":[["s3_switch"]]},{"id":"s3_debug","type":"debug","z":"s3_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":490,"y":100,"wires":[]}]

🎚️ slider ウィジェット演習

演習 SL-1: 音量スライダー初級

📝 課題:

0〜100の範囲で音量を調整できるスライダーを作成してください。操作中にリアルタイムで値を送信します。

🎯 要求仕様:

📊 期待される出力:

msg.payload = 75 // スライダーの値
💡 ヒント

ui-sliderの設定:

  • Label: 「音量」
  • Min: 0, Max: 100, Step: 1
  • Output: all(操作中常時送信)
  • Topic: 「volume」
✅ 解答例フロー
[{"id":"sl1_tab","type":"tab","label":"SL-1: 音量スライダー"},{"id":"sl1_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"sl1_page","type":"ui-page","name":"スライダー演習","ui":"sl1_base","path":"/sl1","layout":"grid","theme":"sl1_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"sl1_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"sl1_group","type":"ui-group","name":"🔊 音量コントロール","page":"sl1_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"sl1_slider","type":"ui-slider","z":"sl1_tab","group":"sl1_group","name":"音量スライダー","label":"音量","order":1,"width":0,"height":0,"passthru":false,"outs":"all","topic":"volume","topicType":"str","showTicks":"always","min":0,"max":100,"step":1,"className":"","iconPrepend":"","iconAppend":"","color":"","x":170,"y":100,"wires":[["sl1_debug"]]},{"id":"sl1_debug","type":"debug","z":"sl1_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":370,"y":100,"wires":[]}]

演習 SL-2: 温度設定スライダー初級

📝 課題:

16〜30℃の範囲、0.5度刻みで温度を設定できるスライダーを作成してください。操作完了時のみ値を送信します。

🎯 要求仕様:

📊 期待される出力:

msg.payload = 25.5 // 小数点値
💡 ヒント

ui-sliderの設定:

  • Label: 「設定温度」
  • Min: 16, Max: 30, Step: 0.5
  • Output: end(操作完了時のみ)
  • Topic: 「temperature」
✅ 解答例フロー
[{"id":"sl2_tab","type":"tab","label":"SL-2: 温度設定スライダー"},{"id":"sl2_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"sl2_page","type":"ui-page","name":"スライダー演習","ui":"sl2_base","path":"/sl2","layout":"grid","theme":"sl2_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"sl2_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"sl2_group","type":"ui-group","name":"🌡️ 温度設定","page":"sl2_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"sl2_slider","type":"ui-slider","z":"sl2_tab","group":"sl2_group","name":"温度スライダー","label":"設定温度","order":1,"width":0,"height":0,"passthru":false,"outs":"end","topic":"temperature","topicType":"str","showTicks":"always","min":16,"max":30,"step":0.5,"className":"","iconPrepend":"","iconAppend":"","color":"","x":170,"y":100,"wires":[["sl2_debug"]]},{"id":"sl2_debug","type":"debug","z":"sl2_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":370,"y":100,"wires":[]}]

演習 SL-3: 外部制御スライダー中級

📝 課題:

Injectノードからスライダーの値を外部から設定できるフローを作成してください。

🎯 要求仕様:

💡 ヒント

ui-sliderの設定:

  • 「If msg arrives on input, pass through to output」にチェックを入れて有効にする
  • → これにより、Injectノードから送信した値がスライダーを通過してDebugに出力されます

Injectノードの設定:

  • msg.payload: 50 (number型)
  • Injectからui-sliderにワイヤーを接続
✅ 解答例フロー
[{"id":"sl3_tab","type":"tab","label":"SL-3: 外部制御スライダー"},{"id":"sl3_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"sl3_page","type":"ui-page","name":"スライダー演習","ui":"sl3_base","path":"/sl3","layout":"grid","theme":"sl3_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"sl3_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"sl3_group","type":"ui-group","name":"💡 明るさ調整","page":"sl3_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"sl3_slider","type":"ui-slider","z":"sl3_tab","group":"sl3_group","name":"明るさスライダー","label":"明るさ","order":1,"width":0,"height":0,"passthru":true,"outs":"end","topic":"brightness","topicType":"str","showTicks":"always","min":0,"max":100,"step":1,"className":"","iconPrepend":"","iconAppend":"","color":"","x":300,"y":100,"wires":[["sl3_debug"]]},{"id":"sl3_inject_50","type":"inject","z":"sl3_tab","name":"50%","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"50","payloadType":"num","x":110,"y":60,"wires":[["sl3_slider"]]},{"id":"sl3_inject_100","type":"inject","z":"sl3_tab","name":"100%","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":110,"y":140,"wires":[["sl3_slider"]]},{"id":"sl3_debug","type":"debug","z":"sl3_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":490,"y":100,"wires":[]}]

📋 dropdown ウィジェット演習

演習 D-1: 単一選択ドロップダウン初級

📝 課題:

動作モードを選択できる単一選択のドロップダウンを作成してください。

🎯 要求仕様:

📊 期待される出力:

msg.payload = "auto" // 選択した値
💡 ヒント

ui-dropdownの設定:

  • Label: 「動作モード」
  • Optionsに3つの選択肢を追加
  • 各選択肢にlabelとvalueを設定
✅ 解答例フロー
[{"id":"d1_tab","type":"tab","label":"D-1: 単一選択ドロップダウン"},{"id":"d1_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"d1_page","type":"ui-page","name":"ドロップダウン演習","ui":"d1_base","path":"/d1","layout":"grid","theme":"d1_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"d1_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"d1_group","type":"ui-group","name":"🔄 モード選択","page":"d1_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"d1_dropdown","type":"ui-dropdown","z":"d1_tab","group":"d1_group","name":"モード選択","label":"動作モード","order":1,"width":0,"height":0,"passthru":false,"multiple":false,"chips":false,"clearable":false,"options":[{"label":"自動","value":"auto","type":"str"},{"label":"手動","value":"manual","type":"str"},{"label":"停止","value":"stop","type":"str"}],"topic":"mode","topicType":"str","className":"","x":160,"y":100,"wires":[["d1_debug"]]},{"id":"d1_debug","type":"debug","z":"d1_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":370,"y":100,"wires":[]}]

演習 D-2: 複数選択ドロップダウン中級

📝 課題:

通知先を複数選択できるドロップダウンを作成してください。チップ表示で選択状態を見やすくします。

🎯 要求仕様:

📊 期待される出力:

msg.payload = ["email", "slack"] // 選択した値の配列
💡 ヒント

ui-dropdownの設定:

  • Label: 「通知先」
  • Multiple: チェックを入れる
  • Chips: チェックを入れる
  • Clearable: チェックを入れる
✅ 解答例フロー
[{"id":"d2_tab","type":"tab","label":"D-2: 複数選択ドロップダウン"},{"id":"d2_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"d2_page","type":"ui-page","name":"ドロップダウン演習","ui":"d2_base","path":"/d2","layout":"grid","theme":"d2_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"d2_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"d2_group","type":"ui-group","name":"🔔 通知設定","page":"d2_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"d2_dropdown","type":"ui-dropdown","z":"d2_tab","group":"d2_group","name":"通知先選択","label":"通知先","order":1,"width":0,"height":0,"passthru":false,"multiple":true,"chips":true,"clearable":true,"options":[{"label":"メール","value":"email","type":"str"},{"label":"Slack","value":"slack","type":"str"},{"label":"LINE","value":"line","type":"str"},{"label":"SMS","value":"sms","type":"str"}],"topic":"notify","topicType":"str","className":"","x":170,"y":100,"wires":[["d2_debug"]]},{"id":"d2_debug","type":"debug","z":"d2_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":390,"y":100,"wires":[]}]

演習 D-3: 動的オプション変更上級

📝 課題:

Functionノードでmsg.optionsを送信して、ドロップダウンの選択肢を動的に変更してください。

🎯 要求仕様:

💡 ヒント

Functionノードのコード:

msg.options = [ {"label": "東京", "value": "tokyo"}, {"label": "大阪", "value": "osaka"}, {"label": "福岡", "value": "fukuoka"} ]; return msg;
✅ 解答例フロー
[{"id":"d3_tab","type":"tab","label":"D-3: 動的オプション変更"},{"id":"d3_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"d3_page","type":"ui-page","name":"ドロップダウン演習","ui":"d3_base","path":"/d3","layout":"grid","theme":"d3_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"d3_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"d3_group","type":"ui-group","name":"🗺️ 地域選択","page":"d3_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"d3_inject","type":"inject","z":"d3_tab","name":"地域オプション","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":100,"wires":[["d3_func"]]},{"id":"d3_func","type":"function","z":"d3_tab","name":"options生成","func":"msg.options = [\n {\"label\": \"東京\", \"value\": \"tokyo\"},\n {\"label\": \"大阪\", \"value\": \"osaka\"},\n {\"label\": \"福岡\", \"value\": \"fukuoka\"}\n];\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":100,"wires":[["d3_dropdown"]]},{"id":"d3_dropdown","type":"ui-dropdown","z":"d3_tab","group":"d3_group","name":"地域選択","label":"地域","order":1,"width":0,"height":0,"passthru":false,"multiple":false,"chips":false,"clearable":false,"options":[],"topic":"region","topicType":"str","className":"","x":480,"y":100,"wires":[["d3_debug"]]},{"id":"d3_debug","type":"debug","z":"d3_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":650,"y":100,"wires":[]}]

⌨️ text-input ウィジェット演習

演習 T-1: テキスト入力初級

📝 課題:

名前を入力できるテキストフィールドを作成してください。Enterキーまたはフォーカスが外れたときに値を送信します。

🎯 要求仕様:

📊 期待される出力:

msg.payload = "山田太郎"
💡 ヒント

ui-text-inputの設定:

  • Label: 「お名前」
  • Mode: text
  • Send On Enter: チェックを入れる
  • Send On Blur: チェックを入れる
✅ 解答例フロー
[{"id":"t1_tab","type":"tab","label":"T-1: テキスト入力"},{"id":"t1_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"t1_page","type":"ui-page","name":"テキスト入力演習","ui":"t1_base","path":"/t1","layout":"grid","theme":"t1_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"t1_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"t1_group","type":"ui-group","name":"👤 名前入力","page":"t1_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"t1_input","type":"ui-text-input","z":"t1_tab","group":"t1_group","name":"名前入力","label":"お名前","order":1,"width":0,"height":0,"topic":"name","topicType":"str","mode":"text","delay":300,"passthru":false,"sendOnBlur":true,"sendOnEnter":true,"className":"","x":160,"y":100,"wires":[["t1_debug"]]},{"id":"t1_debug","type":"debug","z":"t1_tab","name":"出力確認","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":370,"y":100,"wires":[]}]

演習 T-2: 数値入力初級

📝 課題:

数量を入力できる数値入力フィールドを作成してください。numberモードでは出力が数値型になります。

🎯 要求仕様:

📊 期待される出力:

msg.payload = 10 // typeof === "number"
💡 ヒント

ui-text-inputの設定:

  • Label: 「数量」
  • Mode: number
  • ※ Modeがnumberの場合、msg.payloadは数値型で出力されます
✅ 解答例フロー
[{"id":"t2_tab","type":"tab","label":"T-2: 数値入力"},{"id":"t2_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"t2_page","type":"ui-page","name":"テキスト入力演習","ui":"t2_base","path":"/t2","layout":"grid","theme":"t2_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"t2_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"t2_group","type":"ui-group","name":"🔢 数量入力","page":"t2_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"t2_input","type":"ui-text-input","z":"t2_tab","group":"t2_group","name":"数量入力","label":"数量","mode":"number","sendOnBlur":true,"sendOnEnter":true,"topic":"quantity","topicType":"str","order":1,"width":0,"height":0,"delay":300,"passthru":false,"className":"","x":160,"y":100,"wires":[["t2_debug"]]},{"id":"t2_debug","type":"debug","z":"t2_tab","name":"出力確認","active":true,"tosidebar":true,"complete":"true","x":370,"y":100,"wires":[]}]

演習 T-3: 複数モード活用中級

📝 課題:

パスワード、メール、日付の3つの入力フィールドを作成してください。

🎯 要求仕様:

💡 ヒント

各モードの特徴:

  • password: 入力がマスク表示されます
  • email: メールアドレス形式の入力用
  • date: 日付選択ピッカーが表示されます
✅ 解答例フロー
[{"id":"t3_tab","type":"tab","label":"T-3: 複数モード活用"},{"id":"t3_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"t3_page","type":"ui-page","name":"テキスト入力演習","ui":"t3_base","path":"/t3","layout":"grid","theme":"t3_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"t3_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"t3_group","type":"ui-group","name":"🔐 入力モード","page":"t3_page","width":"6","height":"6","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"t3_password","type":"ui-text-input","z":"t3_tab","group":"t3_group","name":"パスワード","label":"パスワード","mode":"password","sendOnBlur":true,"sendOnEnter":true,"topic":"password","topicType":"str","order":1,"width":0,"height":0,"delay":300,"passthru":false,"className":"","x":160,"y":80,"wires":[["t3_debug"]]},{"id":"t3_email","type":"ui-text-input","z":"t3_tab","group":"t3_group","name":"メール","label":"メール","mode":"email","sendOnBlur":true,"sendOnEnter":true,"topic":"email","topicType":"str","order":2,"width":0,"height":0,"delay":300,"passthru":false,"className":"","x":140,"y":140,"wires":[["t3_debug"]]},{"id":"t3_date","type":"ui-text-input","z":"t3_tab","group":"t3_group","name":"日付","label":"生年月日","mode":"date","sendOnBlur":true,"sendOnEnter":true,"topic":"birthday","topicType":"str","order":3,"width":0,"height":0,"delay":300,"passthru":false,"className":"","x":140,"y":200,"wires":[["t3_debug"]]},{"id":"t3_debug","type":"debug","z":"t3_tab","name":"出力確認","active":true,"tosidebar":true,"complete":"true","x":370,"y":140,"wires":[]}]

📝 form ウィジェット演習

演習 F-1: ユーザー登録フォーム中級

📝 課題:

名前、メール、年齢、コメントを入力できるユーザー登録フォームを作成してください。

🎯 要求仕様:

📊 期待される出力:

msg.payload = { "name": "山田太郎", "email": "yamada@example.com", "age": 30, "comment": "よろしくお願いします" }
💡 ヒント

ui-formの設定:

  • Optionsに4つのフィールドを追加
  • 各フィールド: label, key, type, requiredを設定
  • multilineのrows: 3
✅ 解答例フロー
[{"id":"f1_tab","type":"tab","label":"F-1: ユーザー登録フォーム"},{"id":"f1_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"f1_page","type":"ui-page","name":"フォーム演習","ui":"f1_base","path":"/f1","layout":"grid","theme":"f1_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"f1_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"f1_group","type":"ui-group","name":"📝 ユーザー登録","page":"f1_page","width":"6","height":"8","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"f1_form","type":"ui-form","z":"f1_tab","group":"f1_group","name":"登録フォーム","label":"","options":[{"label":"名前","key":"name","type":"text","required":true},{"label":"メール","key":"email","type":"email","required":true},{"label":"年齢","key":"age","type":"number","required":false},{"label":"コメント","key":"comment","type":"multiline","rows":3}],"topic":"registration","topicType":"str","order":1,"width":0,"height":0,"resetOnSubmit":true,"splitLayout":false,"className":"","x":170,"y":100,"wires":[["f1_debug"]]},{"id":"f1_debug","type":"debug","z":"f1_tab","name":"出力確認","active":true,"tosidebar":true,"complete":"payload","x":370,"y":100,"wires":[]}]

演習 F-2: デバイス設定フォーム中級

📝 課題:

IoTデバイスの設定フォームを作成してください。テキスト、数値、スイッチのフィールドを含みます。

🎯 要求仕様:

📊 期待される出力:

msg.payload = { "deviceName": "センサー1", "ip": "192.168.1.100", "port": 8080, "enabled": true }
💡 ヒント

ui-formの設定:

  • 各フィールドにkey, label, type, requiredを設定
  • switchタイプはboolean値を出力します
✅ 解答例フロー
[{"id":"f2_tab","type":"tab","label":"F-2: デバイス設定フォーム"},{"id":"f2_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"f2_page","type":"ui-page","name":"フォーム演習","ui":"f2_base","path":"/f2","layout":"grid","theme":"f2_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"f2_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"f2_group","type":"ui-group","name":"⚙️ デバイス設定","page":"f2_page","width":"6","height":"8","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"f2_form","type":"ui-form","z":"f2_tab","group":"f2_group","name":"設定フォーム","label":"","options":[{"label":"デバイス名","key":"deviceName","type":"text","required":true},{"label":"IPアドレス","key":"ip","type":"text","required":true},{"label":"ポート","key":"port","type":"number","required":true},{"label":"有効化","key":"enabled","type":"switch","required":false}],"topic":"device_config","topicType":"str","order":1,"width":0,"height":0,"resetOnSubmit":true,"splitLayout":false,"className":"","x":170,"y":100,"wires":[["f2_debug"]]},{"id":"f2_debug","type":"debug","z":"f2_tab","name":"出力確認","active":true,"tosidebar":true,"complete":"payload","x":370,"y":100,"wires":[]}]

演習 F-3: 初期値設定フォーム中級

📝 課題:

Injectノードからmsg.payloadを送信して、フォームの初期値を設定してください。

🎯 要求仕様:

💡 ヒント

Injectノードの設定:

msg.payload = { "name": "デフォルト名", "email": "default@example.com" }

※ フィールドのkeyとmsg.payloadのキーを一致させる

✅ 解答例フロー
[{"id":"f3_tab","type":"tab","label":"F-3: 初期値設定フォーム"},{"id":"f3_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"f3_page","type":"ui-page","name":"フォーム演習","ui":"f3_base","path":"/f3","layout":"grid","theme":"f3_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"f3_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"f3_group","type":"ui-group","name":"📝 初期値フォーム","page":"f3_page","width":"6","height":"6","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"f3_inject","type":"inject","z":"f3_tab","name":"初期値設定","props":[{"p":"payload"}],"payload":"{\"name\":\"デフォルト名\",\"email\":\"default@example.com\"}","payloadType":"json","x":130,"y":100,"wires":[["f3_form"]]},{"id":"f3_form","type":"ui-form","z":"f3_tab","group":"f3_group","name":"初期値フォーム","label":"","options":[{"label":"名前","key":"name","type":"text","required":true},{"label":"メール","key":"email","type":"email","required":true}],"topic":"user","topicType":"str","order":1,"width":0,"height":0,"resetOnSubmit":true,"splitLayout":false,"className":"","x":320,"y":100,"wires":[["f3_debug"]]},{"id":"f3_debug","type":"debug","z":"f3_tab","name":"出力確認","active":true,"tosidebar":true,"complete":"payload","x":510,"y":100,"wires":[]}]

🔘 radio-group / button-group ウィジェット演習

演習 R-1: 優先度選択ラジオ初級

📝 課題:

優先度(高・中・低)を3择で選べるラジオボタングループを作成してください。

🎯 要求仕様:

📊 期待される出力:

msg.payload = "high" // 選択した値
💡 ヒント

ui-radio-groupの設定:

  • Label: 「優先度」
  • Optionsに3つの選択肢を追加
  • 各選択肢にlabelとvalueを設定
✅ 解答例フロー
[{"id":"r1_tab","type":"tab","label":"R-1: 優先度選択ラジオ"},{"id":"r1_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"r1_page","type":"ui-page","name":"ラジオボタン演習","ui":"r1_base","path":"/r1","layout":"grid","theme":"r1_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"r1_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"r1_group","type":"ui-group","name":"🎯 優先度選択","page":"r1_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"r1_radio","type":"ui-radio-group","z":"r1_tab","group":"r1_group","name":"優先度ラジオ","label":"優先度","options":[{"label":"🔴 高","value":"high"},{"label":"🟡 中","value":"medium"},{"label":"🟢 低","value":"low"}],"topic":"priority","topicType":"str","order":1,"width":0,"height":0,"passthru":false,"className":"","x":170,"y":100,"wires":[["r1_debug"]]},{"id":"r1_debug","type":"debug","z":"r1_tab","name":"出力確認","active":true,"tosidebar":true,"complete":"payload","x":370,"y":100,"wires":[]}]

演習 BG-1: 表示モード切替中級

📝 課題:

アイコン付きの表示モード切替ボタングループを作成してください。

🎯 要求仕様:

📊 期待される出力:

msg.payload = "grid" // 選択した値
💡 ヒント

ui-button-groupの設定:

  • Label: 「表示モード」
  • Optionsに3つの選択肢を追加
  • 各選択肢にlabel, value, iconを設定
✅ 解答例フロー
[{"id":"bg1_tab","type":"tab","label":"BG-1: 表示モード切替"},{"id":"bg1_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showPageTitle":true,"showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},{"id":"bg1_page","type":"ui-page","name":"ボタングループ演習","ui":"bg1_base","path":"/bg1","layout":"grid","theme":"bg1_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":true,"disabled":false},{"id":"bg1_theme","type":"ui-theme","name":"Theme","colors":{"surface":"#ffffff","primary":"#b92d5d","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px","density":"default"}},{"id":"bg1_group","type":"ui-group","name":"🔀 表示モード","page":"bg1_page","width":"6","height":"4","order":1,"showTitle":true,"className":"","visible":true,"disabled":false,"groupType":"default"},{"id":"bg1_btngroup","type":"ui-button-group","z":"bg1_tab","group":"bg1_group","name":"表示モード切替","label":"表示モード","options":[{"label":"リスト","value":"list","icon":"mdi-format-list-bulleted"},{"label":"グリッド","value":"grid","icon":"mdi-grid"},{"label":"カード","value":"card","icon":"mdi-card-outline"}],"topic":"display_mode","topicType":"str","order":1,"width":0,"height":0,"passthru":false,"className":"","x":190,"y":100,"wires":[["bg1_debug"]]},{"id":"bg1_debug","type":"debug","z":"bg1_tab","name":"出力確認","active":true,"tosidebar":true,"complete":"payload","x":410,"y":100,"wires":[]}]

🎓 12. まとめ

入力系ウィジェットの重要ポイント

⚠️ よくある間違い

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

よくある問題と解決方法

問題 原因 解決方法
ウィジェットが表示されない Groupが未設定 ウィジェットにGroupを設定する
値が送信されない ワイヤー未接続 出力ポートにワイヤーを接続する
スイッチの状態が更新されない 送信値と設定値の型不一致 On/Off Valueの型を確認(bool/str/num)
ドロップダウンの選択肢が変わらない msg.optionsの形式エラー 配列形式で{label, value}オブジェクトを送信
フォームの初期値が設定されない keyの不一致 msg.payloadのキーとフィールドのkeyを一致させる
通知が表示されない ui参照エラー ui-notificationのuiプロパティでui-baseを参照

💡 14. 実務での活用例

ケース1: 製造ライン制御パネル

ライン選択(ui-dropdown) ↓ 運転モード(ui-radio-group: 自動/手動/メンテナンス) ↓ 速度設定(ui-slider: 0-100%) ↓ 緊急停止(ui-button: 赤色、大きめ) ↓ PLCへ送信 → 状態表示

ケース2: スマートホームコントローラー

部屋選択(ui-dropdown) ↓ 照明ON/OFF(ui-switch)+ 明るさ(ui-slider) ↓ エアコン設定(ui-form: 運転モード、設定温度、風量) ↓ MQTT → IoTデバイス

ケース3: データ収集設定画面

センサー選択(ui-dropdown: 複数選択) ↓ サンプリング間隔(ui-slider: 1-60秒) ↓ データ形式(ui-button-group: JSON/CSV/XML) ↓ 出力先設定(ui-form: ファイルパス、DB接続情報) ↓ 設定保存 → 収集開始

ケース4: ユーザー認証フォーム

ログインフォーム(ui-form) - ユーザー名(text, required) - パスワード(password, required) - ログイン状態を保持(checkbox) ↓ 認証API呼び出し ↓ 成功/失敗通知(ui-notification)

📚 15. 追加リソース


このガイドが役に立ちましたら、実際のプロジェクトで練習してみてください!
入力系ウィジェットはユーザーインタラクションの基本です。

🏠