🎮 Node-RED Dashboard 2.0 入力系ウィジェット ガイド
このガイドでは、Dashboard 2.0の入力系ウィジェットについて詳しく解説します。これらのウィジェットは、ユーザーからの入力を受け付けてフローに送信するために使用します。
📌 このガイドで学べること:
- button: ボタンによるアクション実行
- switch: ON/OFF切り替え
- slider: 数値のスライダー入力
- dropdown: 選択肢からの選択
- text-input: テキスト入力
- form: 複数フィールドのフォーム
- radio-group: ラジオボタン選択
- button-group: ボタングループ選択
🎯 1. 入力系ウィジェットの概要
🤔 入力系ウィジェットとは?
入力系ウィジェットは、ユーザーからの入力を受け付けてNode-REDフローに送信するためのウィジェットです。
日常生活で例えると、リモコンや操作パネルのようなものです。
🎮 ゲームコントローラーに例えると:
- 🔘 button = Aボタン・Bボタン(押すとアクション実行)
- 🔛 switch = 電源スイッチ(ON/OFFの切り替え)
- 🎚️ slider = 音量つまみ(連続値の調整)
- 📋 dropdown = モード選択メニュー(リストから選択)
- ⌨️ text-input = 名前入力欄(文字の入力)
- 📝 form = 設定画面(複数項目の一括入力)
- 🔘 radio-group = 難易度選択(排他的な選択)
- 🎛️ button-group = アイテム選択ボタン群
📊 入力系ウィジェット一覧
| ウィジェット |
用途 |
出力値の型 |
入力受付 |
| button |
クリックでアクション実行 |
設定値(任意) |
状態更新可 |
| switch |
ON/OFF切り替え |
boolean / 設定値 |
✅ |
| slider |
数値の範囲入力 |
number |
✅ |
| dropdown |
リストから選択 |
選択した値 |
✅ |
| text-input |
テキスト入力 |
string / number |
✅ |
| form |
複数フィールド入力 |
object |
✅ |
| radio-group |
排他的選択 |
選択した値 |
✅ |
| button-group |
ボタン群から選択 |
選択した値 |
✅ |
動作を図で見る
入力系のウィジェットは、画面で操作されたときに msg を作ってフローへ送り出します。
ボタンを押す、スライダーを動かすと、その値が msg になって出る
🔥 2. サンプルフロー
📥 サンプルフローを試す手順:
- 下のフローJSONを「コピー」ボタンでコピー
- Node-REDエディタで メニュー → 読み込み を選択
- JSONをペーストして「読み込み」をクリック
- エディタ右上の「デプロイ」ボタンをクリック(クリックするまでフローは動きません)
- ブラウザでダッシュボード(
http://localhost:1880/dashboard)を開き、左のメニューからページを選んで動作を確認
このサイトの Dashboard 2.0 のフロー(このあとの「公式サンプルフロー」「応用フロー」と、演習の解答例)は、すべて同じダッシュボードの設定ノード(ui-base)を共有しています。2つ目以降のフローを読み込むと、「読み込もうとしているノードのいくつかは、既にワークスペース内に存在しています。」という通知が出ます。「コピーを読み込み」を選んでください。共有している設定ノードは既にあるものが使われ、ページは1つのダッシュボードにまとまります。ダッシュボード全体の見た目(ヘッダーやメニューの表示)は、最初に読み込んだフローの ui-base の設定になります。
ページが表示されないとき: ダッシュボードの設定ノード(ui-base)が2つ以上あると、そのうち1つのページしか表示されません。このサイトの以前の版のフローを読み込んでいると、この状態になります。以前の版のフローのタブを削除してから、エディタの メニュー → 設定ノード を開き、画面上部の「未使用」を選んで、どのノードからも使われていない ui-group・ui-page・ui-base・ui-theme を削除します。ui-group を消すとそれを使っていた ui-page が、ui-page を消すと ui-base が未使用になるので、未使用のものが無くなるまで繰り返してください。そのあとで、フローを読み込み直します。
公式サンプルフロー
最初のサンプルフローは、Dashboard 2.0 の開発元である FlowFuse が公開している公式サンプルを、1つのタブにまとめたものです。出典は次の2か所です。
ノードの設定値とノードIDは公式のままです。このサイトで手を加えたのは次の点だけです。
- 1つのタブにまとめ、例が重ならないよう位置をずらし、例の名前を書いたコメントノードを置いた
- GitHub examples はグループ(ui-group)が空のままで、読み込んでもダッシュボードに表示されない。そこで「GitHub Examples(入力系)」ページ(
/flowfuse-examples-input)と例ごとのグループを用意し、各ウィジェットに割り当てた
- 同じ設定ノード(ui-base など)が例ごとに少しずつ違う値で入っていたため、1つにそろえた
| 例(出典・表示されるページ) |
内容 |
ui-button-hold 公式ドキュメント(ui-button)
/dashboard/page2 |
ボタンを押し始めた時刻(pointerdown)と離した時刻(pointerup)を受け取り、押していた時間を「Held For:」に表示します。押した時間で操作を区別する場面で使います。 |
group-dialog-type 公式ドキュメント(ui-group)
/dashboard/active-development |
ボタンでダイアログ型のグループを開き、中のフォームを送信すると ui-control で閉じます。入力欄を必要なときだけ表示する場面で使います。 |
text-input-w-button GitHub examples
/dashboard/flowfuse-examples-input |
数値の入力欄に入れた値を、Enterキーを押すか入力欄から離れたときに debug へ出します。「Enter」ボタンは値を送るボタンではなく、入力欄へ空の文字列を送って入力欄を空にします。 |
dropdown-w-dynamic-options GitHub examples
/dashboard/flowfuse-examples-input |
Injectノードで msg.options を送り、ドロップダウンの選択肢を4種類のチーズに入れ替えます。選ぶと、その値が debug に出ます。読み込んだ直後は選択肢が空なので、先に Inject のボタンを押してください。 |
radio-example GitHub examples
/dashboard/flowfuse-examples-input |
ラジオボタンで選んだ値を、ui-text に「Emotion: Happy」のように表示します。 |
swith-w-notification GitHub examples
/dashboard/flowfuse-examples-input |
スイッチを切り替えると、「Machine Started」または「Machine Stopped」が通知で表示されます。例の名前の綴り(swith)は公式のファイル名のままです。 |
この公式サンプルフローには、slider と button-group の例を収録していません(slider は、表示系ガイドの公式サンプルフローにある ui-text-suffix でも使われています)。この2つは、次の応用フローで扱います。
📥 入力系 公式サンプルフローJSON(クリックで展開)
[
{
"id": "dash2_input_official_tab",
"type": "tab",
"label": "入力系 公式サンプル",
"disabled": false,
"info": "",
"env": []
},
{
"id": "cmt_dash2_input_official_ui_button_hold",
"type": "comment",
"z": "dash2_input_official_tab",
"name": "ui-button-hold(公式ドキュメント ui-button)",
"info": "",
"x": 320,
"y": 60,
"wires": []
},
{
"id": "41af91ca7e2d0577",
"type": "ui-button",
"z": "dash2_input_official_tab",
"group": "4400cdcbaa768e57",
"name": "",
"label": "Hold Duration Test",
"order": 1,
"width": "3",
"height": "1",
"emulateClick": false,
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"iconPosition": "left",
"payload": "Click",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"buttonColor": "",
"textColor": "",
"iconColor": "",
"enableClick": false,
"enablePointerdown": true,
"pointerdownPayload": "",
"pointerdownPayloadType": "date",
"enablePointerup": true,
"pointerupPayload": "",
"pointerupPayloadType": "date",
"x": 200,
"y": 150,
"wires": [
[
"57e8b3025bda5b1b",
"c09876e76c45d7fb"
]
]
},
{
"id": "57e8b3025bda5b1b",
"type": "debug",
"z": "dash2_input_official_tab",
"name": "debug 2569",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 380,
"y": 110,
"wires": []
},
{
"id": "c09876e76c45d7fb",
"type": "join",
"z": "dash2_input_official_tab",
"name": "",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "_event.type",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 360,
"y": 150,
"wires": [
[
"9503bfb0e2713b08"
]
]
},
{
"id": "9503bfb0e2713b08",
"type": "change",
"z": "dash2_input_official_tab",
"name": "",
"rules": [
{
"t": "set",
"p": "payload.held",
"pt": "msg",
"to": "$number(msg.payload.pointerup) - $number(msg.payload.pointerdown)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 530,
"y": 150,
"wires": [
[
"d289e0f09ddd90f9",
"6314f8f6c76cc4e5"
]
]
},
{
"id": "d289e0f09ddd90f9",
"type": "debug",
"z": "dash2_input_official_tab",
"name": "debug 2571",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 150,
"wires": []
},
{
"id": "ac3f3589547ed27b",
"type": "ui-text",
"z": "dash2_input_official_tab",
"group": "4400cdcbaa768e57",
"order": 2,
"width": "3",
"height": "1",
"name": "",
"label": "Held For:",
"format": "{{msg.payload}}",
"layout": "row-spread",
"style": false,
"font": "",
"fontSize": 16,
"color": "#717171",
"className": "",
"x": 930,
"y": 110,
"wires": []
},
{
"id": "6314f8f6c76cc4e5",
"type": "change",
"z": "dash2_input_official_tab",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "msg.payload.held & \"ms\"",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 110,
"wires": [
[
"ac3f3589547ed27b"
]
]
},
{
"id": "cmt_dash2_input_official_group_dialog_type",
"type": "comment",
"z": "dash2_input_official_tab",
"name": "group-dialog-type(公式ドキュメント ui-group)",
"info": "",
"x": 320,
"y": 230,
"wires": []
},
{
"id": "0aa38a714b8a3d67",
"type": "ui-form",
"z": "dash2_input_official_tab",
"name": "",
"group": "c7871ac53089d535",
"label": "New User",
"order": 1,
"width": 0,
"height": 0,
"options": [
{
"label": "Name",
"key": "name",
"type": "text",
"required": true,
"rows": null
},
{
"label": "Admin",
"key": "isAdmin",
"type": "switch",
"required": false,
"rows": null
}
],
"formValue": {
"name": "",
"isAdmin": false
},
"payload": "",
"submit": "Add",
"cancel": "clear",
"resetOnSubmit": true,
"topic": "topic",
"topicType": "msg",
"splitLayout": "",
"className": "",
"passthru": false,
"dropdownOptions": [],
"x": 200,
"y": 280,
"wires": [
[
"adbd76ecf97076a1"
]
]
},
{
"id": "fa4925a5253341ce",
"type": "ui-control",
"z": "dash2_input_official_tab",
"name": "",
"ui": "c2e1aa56f50f03bd",
"events": "all",
"inputMode": "payload",
"x": 560,
"y": 280,
"wires": [
[]
]
},
{
"id": "adbd76ecf97076a1",
"type": "change",
"z": "dash2_input_official_tab",
"name": "Hide Dialog",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"groups\":{\"hide\":[\"Active Development:Dialog Group\"]}}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 370,
"y": 280,
"wires": [
[
"fa4925a5253341ce",
"b9d77a856b1be020"
]
]
},
{
"id": "294ac777d99f5789",
"type": "ui-button",
"z": "dash2_input_official_tab",
"group": "497106faf38a5190",
"name": "",
"label": "Add User (Dialog)",
"order": 1,
"width": 0,
"height": 0,
"emulateClick": false,
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"iconPosition": "left",
"payload": "{\"groups\":{\"show\":[\"Active Development:Dialog Group\"]}}",
"payloadType": "json",
"topic": "topic",
"topicType": "msg",
"buttonColor": "",
"textColor": "",
"iconColor": "",
"x": 350,
"y": 320,
"wires": [
[
"fa4925a5253341ce",
"b9d77a856b1be020"
]
]
},
{
"id": "b9d77a856b1be020",
"type": "debug",
"z": "dash2_input_official_tab",
"name": "debug 2572",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 570,
"y": 320,
"wires": []
},
{
"id": "cmt_dash2_input_official_text_input_w_button",
"type": "comment",
"z": "dash2_input_official_tab",
"name": "text-input-w-button(GitHub examples)",
"info": "",
"x": 320,
"y": 400,
"wires": []
},
{
"id": "f64abb39012dfbf7",
"type": "ui-text-input",
"z": "dash2_input_official_tab",
"group": "dash2_input_gh_grp_text_input_w_button",
"name": "Temp Setpoint",
"label": "Number",
"order": 4,
"width": 0,
"height": 0,
"topic": "topic",
"topicType": "msg",
"mode": "number",
"delay": 300,
"passthru": false,
"sendOnDelay": false,
"sendOnBlur": true,
"sendOnEnter": true,
"className": "",
"x": 370,
"y": 450,
"wires": [
[
"07cccb1132285b1d"
]
]
},
{
"id": "07cccb1132285b1d",
"type": "debug",
"z": "dash2_input_official_tab",
"name": "debug 19",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 550,
"y": 450,
"wires": []
},
{
"id": "d3da83fae5463c26",
"type": "ui-button",
"z": "dash2_input_official_tab",
"group": "dash2_input_gh_grp_text_input_w_button",
"name": "",
"label": "Enter",
"order": 5,
"width": 0,
"height": 0,
"passthru": false,
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 200,
"y": 450,
"wires": [
[
"f64abb39012dfbf7"
]
]
},
{
"id": "cmt_dash2_input_official_dropdown_w_dynamic_options",
"type": "comment",
"z": "dash2_input_official_tab",
"name": "dropdown-w-dynamic-options(GitHub examples)",
"info": "",
"x": 320,
"y": 530,
"wires": []
},
{
"id": "c68b5b27e2406dac",
"type": "inject",
"z": "dash2_input_official_tab",
"name": "",
"props": [
{
"p": "options",
"v": "[{\"value\":\"cheddar\",\"label\":\"Cheddar\"},{\"value\":\"brie\",\"label\":\"Brie\"},{\"value\":\"parmesan\",\"label\":\"Parmesan\"},{\"value\":\"gruyere\",\"label\":\"Gruyere\"}]",
"vt": "json"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 200,
"y": 580,
"wires": [
[
"511030e7cf60fd3d"
]
]
},
{
"id": "511030e7cf60fd3d",
"type": "ui-dropdown",
"z": "dash2_input_official_tab",
"group": "dash2_input_gh_grp_dropdown_w_dynamic_options",
"name": "",
"label": "Select Option:",
"tooltip": "",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"multiple": false,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"topicType": "msg",
"className": "",
"x": 390,
"y": 580,
"wires": [
[
"605f48154038b399"
]
]
},
{
"id": "605f48154038b399",
"type": "debug",
"z": "dash2_input_official_tab",
"name": "debug 21",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 580,
"y": 580,
"wires": []
},
{
"id": "cmt_dash2_input_official_radio_example",
"type": "comment",
"z": "dash2_input_official_tab",
"name": "radio-example(GitHub examples)",
"info": "",
"x": 320,
"y": 660,
"wires": []
},
{
"id": "972184369b9c2039",
"type": "ui-radio-group",
"z": "dash2_input_official_tab",
"group": "dash2_input_gh_grp_radio_example",
"name": "Emotion Meter",
"label": "Select Option:",
"order": 0,
"width": 0,
"height": 0,
"columns": 1,
"passthru": false,
"options": [
{
"label": "Happy",
"value": "Happy",
"type": "str"
},
{
"label": "Sad",
"value": "Sad",
"type": "str"
},
{
"label": "Scared",
"value": "Scared",
"type": "str"
},
{
"label": "Indifferent",
"value": "Indifferent",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"topicType": "msg",
"className": "",
"x": 200,
"y": 710,
"wires": [
[
"c1bacd6c8805dae3"
]
]
},
{
"id": "c1bacd6c8805dae3",
"type": "ui-text",
"z": "dash2_input_official_tab",
"group": "dash2_input_gh_grp_radio_example",
"order": 0,
"width": 0,
"height": 0,
"name": "",
"label": "Emotion:",
"format": "{{msg.payload}}",
"layout": "row-center",
"style": false,
"font": "",
"fontSize": 16,
"color": "#717171",
"className": "",
"x": 380,
"y": 710,
"wires": []
},
{
"id": "cmt_dash2_input_official_swith_w_notification",
"type": "comment",
"z": "dash2_input_official_tab",
"name": "swith-w-notification(GitHub examples)",
"info": "",
"x": 320,
"y": 790,
"wires": []
},
{
"id": "beaecd4993da0288",
"type": "ui-switch",
"z": "dash2_input_official_tab",
"name": "",
"label": "switch",
"group": "dash2_input_gh_grp_swith_w_notification",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"topic": "topic",
"topicType": "msg",
"style": "",
"className": "",
"onvalue": "Machine Started",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "Machine Stopped",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"x": 200,
"y": 840,
"wires": [
[
"e1f9ad3e5063e8ae"
]
]
},
{
"id": "e1f9ad3e5063e8ae",
"type": "ui-notification",
"z": "dash2_input_official_tab",
"ui": "c2e1aa56f50f03bd",
"position": "top right",
"colorDefault": true,
"color": "#000000",
"displayTime": "3",
"showCountdown": true,
"outputs": 0,
"allowDismiss": true,
"dismissText": "Close",
"raw": false,
"className": "",
"name": "",
"x": 380,
"y": 840,
"wires": []
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "Dashboard",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": [
"ui-control",
"ui-notification",
"ui-text",
"ui-template"
],
"showPathInSidebar": false,
"headerContent": "none",
"navigationStyle": "default",
"titleBarStyle": "default"
},
{
"id": "afa24cae12543ca5",
"type": "ui-theme",
"name": "Example Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#fafdff",
"groupOutline": "#000000"
},
"sizes": {
"groupGap": "12px",
"widgetGap": "12px",
"pagePadding": "12px",
"groupBorderRadius": "0px",
"density": "default"
}
},
{
"id": "129e99574def90a3",
"type": "ui-theme",
"name": "Custom Theme",
"colors": {
"surface": "#000000",
"primary": "#ff4000",
"bgPage": "#f0f0f0",
"groupBg": "#ffffff",
"groupOutline": "#d9d9d9"
},
"sizes": {
"pagePadding": "24px",
"groupGap": "12px",
"groupBorderRadius": "9px",
"widgetGap": "6px",
"density": "default"
}
},
{
"id": "ea42e606327de0a5",
"type": "ui-page",
"name": "Demo Page",
"ui": "c2e1aa56f50f03bd",
"path": "/page2",
"icon": "",
"layout": "grid",
"theme": "afa24cae12543ca5",
"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": 23,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "22b5519aa675ad88",
"type": "ui-page",
"name": "Active Development",
"ui": "c2e1aa56f50f03bd",
"path": "/active-development",
"icon": "forum",
"layout": "grid",
"theme": "129e99574def90a3",
"order": 1,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "dash2_input_gh_page",
"type": "ui-page",
"name": "GitHub Examples(入力系)",
"ui": "c2e1aa56f50f03bd",
"path": "/flowfuse-examples-input",
"icon": "github",
"layout": "grid",
"theme": "afa24cae12543ca5",
"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": 30,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "4400cdcbaa768e57",
"type": "ui-group",
"name": "Hold Duration Test",
"page": "ea42e606327de0a5",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "c7871ac53089d535",
"type": "ui-group",
"name": "Dialog Group",
"page": "22b5519aa675ad88",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "dialog"
},
{
"id": "497106faf38a5190",
"type": "ui-group",
"name": "Button Groups",
"page": "22b5519aa675ad88",
"width": "6",
"height": "1",
"order": 10,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "dash2_input_gh_grp_text_input_w_button",
"type": "ui-group",
"name": "text-input-w-button",
"page": "dash2_input_gh_page",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "dash2_input_gh_grp_dropdown_w_dynamic_options",
"type": "ui-group",
"name": "dropdown-w-dynamic-options",
"page": "dash2_input_gh_page",
"width": "6",
"height": "1",
"order": 2,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "dash2_input_gh_grp_radio_example",
"type": "ui-group",
"name": "radio-example",
"page": "dash2_input_gh_page",
"width": "6",
"height": "1",
"order": 3,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "dash2_input_gh_grp_swith_w_notification",
"type": "ui-group",
"name": "swith-w-notification",
"page": "dash2_input_gh_page",
"width": "6",
"height": "1",
"order": 4,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
}
]
応用(サイト独自): 全パターンのサンプル
ここから先は公式サンプルではなく、本サイトが用意した応用教材です。このガイドで説明する8種類のウィジェットの使い方を、1つのタブにまとめています。ダッシュボードでは /dashboard/input-widgets に表示されます。3章以降の説明は、このフローを例に進めます。
📋 応用フローJSON(クリックで展開)
このサンプルには 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": "",
"thumbLabel": true,
"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": "",
"thumbLabel": true,
"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": "",
"rounded": false,
"useThemeColors": true,
"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": "c2e1aa56f50f03bd",
"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": "input_ui_page",
"type": "ui-page",
"name": "入力系サンプル",
"ui": "c2e1aa56f50f03bd",
"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": "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": "012aac34447c496d",
"type": "global-config",
"env": [],
"modules": {
"@flowfuse/node-red-dashboard": "1.29.0"
}
}
]
🔘 3. button(ボタン)
📋 主要プロパティ
エディターは日本語化されている(ui_button の ja ロケールあり)。一部のキー(イベント有効化・色)は ja 翻訳がなく英語表示のままなので、その項目だけ「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
| 設定項目 |
説明 |
デフォルト |
| 名前 |
フローエディター上でノードを識別する管理名。ダッシュボードの表示には影響しない。 |
(空) |
| グループ |
ボタンを配置するダッシュボードのグループ。 |
(必須) |
| Size(サイズ) |
グループ内で占める幅と高さ。0 のときはグループ幅に自動でそろえる。 |
自動 |
| アイコン |
ボタンに表示する Material Design Icons(mdi- 接頭辞で指定)。右隣の選択(Left/Right)でアイコンを左右どちらに置くかを決める。 |
(なし) |
| ラベル |
ボタン面に表示する文字列。 |
"button" |
| クラス |
ボタンに付与する任意の CSS クラス名。スタイルを細かく調整するときに使う。 |
(空) |
| Enable pointerdown event(押下イベントを有効化) |
ボタンを押し込んだ瞬間(pointerdown)に送信するか。有効化すると専用のペイロード欄が現れる。 |
オフ |
| Enable pointerup event(離上イベントを有効化) |
ボタンから指を離した瞬間(pointerup)に送信するか。有効化すると専用のペイロード欄が現れる。 |
オフ |
| Enable click event(クリックイベントを有効化) |
クリック完了時に送信するか。通常のボタン送信はこれにあたる。 |
有効 |
| ペイロード |
クリック時に送信する msg.payload。右側の型セレクタ(typedInput)で文字列・数値・JSON などの型を選ぶ。 |
文字列・(空) |
| 入力にメッセージが届けることでクリックを再現: |
入力にメッセージが届いたとき、画面上のクリックと同じ動作(ペイロード送信)を行う。 |
オフ |
| トピック |
「Always Send:」の下にある欄。送信メッセージに付ける msg.topic。型セレクタ付き。 |
"topic" |
| Background(背景色) |
ボタンの背景色。空ならテーマの色を使う。例: green や #a5a5a5。 |
(空) |
| Text(文字色) |
ボタンの文字色。 |
(空) |
| Icon(アイコン色) |
アイコンの色。 |
(空) |
🎯 使用パターン
パターン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: #f44336 (赤)
Text: #ffffff (白)
アイコン: mdi-alert-octagon
💡 動的プロパティ更新:
msg.ui_updateでボタンの外観を動的に変更できます。
msg.ui_update = { "label": "処理中...", "icon": "mdi-loading", "buttonColor": "#ff9800" }
🔛 4. switch(スイッチ)
📋 主要プロパティ
switch ウィジェットは ja ロケールがなく、エディター表示は英語(「名前」は Node-RED 共通項目なので日本語)。英語項目は「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
| 設定項目 |
説明 |
デフォルト |
| 名前 |
フローエディター上でノードを識別する管理名。 |
(空) |
| Group(グループ) |
スイッチを配置するダッシュボードのグループ。 |
(必須) |
| Size(サイズ) |
グループ内で占める幅と高さ。0 で自動。 |
自動 |
| Label(ラベル) |
スイッチの横に表示する文字列。 |
(空) |
| Clickable(クリック可能範囲) |
どこをクリックで切り替えられるか。Only switch(スイッチのみ)/Label and switch(ラベルとスイッチ)/Entire line(行全体)/None(操作不可)。 |
Only switch |
| Class(クラス) |
任意の CSS クラス名。 |
(空) |
| Layout(レイアウト) |
ラベルとスイッチの配置を選ぶプリセット(アイコンで選択)。 |
(既定) |
| Icon(アイコン) |
Default(既定の丸トグル)か Custom(自前アイコン)かを選ぶ。Custom にすると On Icon・Off Icon と各色(Colour)の欄が現れる。 |
Default |
| If msg arrives on input, pass through to output:(入力メッセージを出力にパススルー) |
入力で状態を更新したとき、その入力メッセージをそのまま出力にも流すか。 |
オン |
| Indicator(インジケータ) |
スイッチのアイコンが「出力の状態」を示すか「入力の状態」を示すか(内部プロパティは decouple)。入力で表示だけ変えて操作時のみ出力したい場合に使う。 |
出力の状態を示す |
| On Payload(ON時の送信値) |
「When clicked, send:」配下。ON にしたとき送信する値。右の型セレクタ(typedInput)で型を選ぶ。 |
true(bool) |
| Off Payload(OFF時の送信値) |
OFF にしたとき送信する値。型セレクタ付き。 |
false(bool) |
| Topic |
送信メッセージに付ける msg.topic。型セレクタ付き。 |
"topic" |
🎯 使用パターン
パターン1: シンプルなON/OFFスイッチ
用途: 機器の入切のような二者択一の状態の切り替え
boolean値(true/false)を送信する基本的なスイッチです。
ui-switch
LEDライト
→
Debug
// ON時: msg.payload = true
// OFF時: msg.payload = false
パターン2: カスタム値スイッチ
用途: true/false ではなく機器が解釈できる文字列の送信
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
⚠️ パススルーと Indicator の違い:
- If msg arrives on input, pass through to output: 入力で状態を更新したとき、入力メッセージ全体(msg.payload だけでなく全プロパティ)を出力にも流す。
- Indicator(内部プロパティ decouple): アイコンが入力の状態を示すモードにすると、入力で表示が変わってもそのまま出力はせず、画面操作したときだけ出力する。
🎚️ 5. slider(スライダー)
📋 主要プロパティ
slider ウィジェットは ja ロケールがなく、エディター表示は英語。英語項目は「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
| 設定項目 |
説明 |
デフォルト |
| Name(名前) |
フローエディター上でノードを識別する管理名。 |
(空) |
| Group(グループ) |
スライダーを配置するダッシュボードのグループ。 |
(必須) |
| Size(サイズ) |
グループ内で占める幅と高さ。0 で自動。 |
自動 |
| Class(クラス) |
任意の CSS クラス名。 |
(空) |
| Label(ラベル) |
スライダーの上に表示する文字列。 |
(空) |
| Text Field(数値入力欄) |
右の「Show」を有効にすると、スライダー横に直接数値を打ち込める入力欄を表示する。 |
非表示 |
| Thumb(つまみの値ラベル) |
つまみの上に現在値の吹き出しを出すか。Never(出さない)/On Drag(ドラッグ中だけ)/Always(常に)。 |
Never |
| Ticks(目盛り) |
目盛りを表示するか。Never/On Drag/Always。 |
Never |
| Range(範囲) |
3 つの入力欄で min.(最小値)・max.(最大値)・step(刻み幅)を指定する。 |
0 / 100 / 1 |
| Icons(左右のアイコン) |
スライダーの左(prepend)と右(append)に置くアイコンを指定する。 |
(空) |
| Color(色) |
スライダー本体・トラック・つまみの色を個別に指定する。 |
(空) |
| Output(出力タイミング) |
continuously while sliding(操作中ずっと送信)/only on release(離した時だけ送信)。 |
continuously while sliding |
| If msg arrives on input, pass through to output:(入力メッセージを出力にパススルー) |
入力で値を更新したとき、その入力メッセージをそのまま出力にも流すか。 |
オン |
| Topic |
「When changed, send:」配下。送信メッセージに付ける msg.topic。 |
"topic" |
🎯 使用パターン
パターン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オプションの使い分け:
- all: リアルタイムプレビュー(LEDの明るさなど)
- end: 確定値のみ必要な場合(API呼び出しなど)
💡 Pass Through: 有効にすると、入力メッセージで値を更新した際に、元のメッセージ全体(msg.topicなど他のプロパティも含む)を出力に流します。
📋 6. dropdown(ドロップダウン)
📋 主要プロパティ
dropdown ウィジェットは ja ロケールがなく、エディター表示は英語(「名前」は共通項目なので日本語)。英語項目は「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
| 設定項目 |
説明 |
デフォルト |
| 名前 |
フローエディター上でノードを識別する管理名。 |
(空) |
| Group(グループ) |
配置するダッシュボードのグループ。 |
(必須) |
| Size(サイズ) |
グループ内で占める幅と高さ。0 で自動。 |
自動 |
| Label(ラベル) |
ドロップダウンの横に表示する文字列。 |
(空) |
| Class(クラス) |
任意の CSS クラス名。 |
(空) |
| Options(選択肢) |
value/label の組のリスト(editableList で増減)。実行時に msg.options で差し替えられる。 |
(なし) |
| Trigger On(送信タイミング) |
いつメッセージを送るか。Selection Changed(選択が変わった時)/Dropdown Closed(リストを閉じた時)。 |
Selection Changed |
| Allow multiple selections from list:(複数選択を許可) |
複数項目を同時に選べるようにするか。出力は配列になる。 |
オン |
| Show selected elements in chips(選択項目をチップ表示) |
複数選択時、選んだ項目をチップ(タグ)状に表示する。 |
オン |
| Clear selection with button(クリアボタンを表示) |
選択をまとめて解除するボタンを表示する。 |
オン |
| Allow Search(検索入力を許可) |
コンボボックスとして、文字を打って候補を絞り込めるようにする(内部プロパティ typeIsComboBox)。 |
オン |
| If msg arrives on input, pass through to output:(入力メッセージを出力にパススルー) |
入力で選択値を更新したとき、その入力メッセージをそのまま出力にも流すか。 |
オン |
| Topic |
送信メッセージに付ける msg.topic。 |
"topic" |
🎯 使用パターン
パターン1: 単一選択ドロップダウン
用途: 決まった選択肢からの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 ウィジェットは ja ロケールがなく、エディター表示は英語(「名前」は共通項目なので日本語)。英語項目は「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
| 設定項目 |
説明 |
デフォルト |
| 名前 |
フローエディター上でノードを識別する管理名。 |
(空) |
| Group(グループ) |
配置するダッシュボードのグループ。 |
(必須) |
| Size(サイズ) |
グループ内で占める幅と高さ。0 で自動。 |
自動 |
| Icon(アイコン) |
入力欄に添えるアイコン。右の選択で左右(Left/Right)と、枠の内側か外側か(In/Out)を指定する。 |
(空) |
| Label(ラベル) |
入力欄の横に表示する文字列。 |
(空) |
| Tooltip(ツールチップ) |
ホバー時に表示する補足説明。 |
(空) |
| Class(クラス) |
任意の CSS クラス名。 |
(空) |
| Mode(入力モード) |
入力欄の種類。text input(1行)/text area(複数行)/email/password/number/color(カラーピッカー)/datetime/date/time/week/month。 |
text input |
| If msg arrives on input, pass through to output:(入力メッセージを出力にパススルー) |
入力で値を更新したとき、その入力メッセージをそのまま出力にも流すか。 |
オン |
| Clear text input with button(クリアボタンを表示) |
入力欄の中身を消すボタンを表示する。 |
オン |
| Send message on:(送信タイミング) |
見出し。下の各チェックで、どの操作のときにメッセージを送るかを選ぶ。 |
— |
| Delay(遅延後・(ms)) |
入力が止まってから指定ミリ秒後に送信する。チェックを外すと遅延送信しない。 |
オン・300 |
| Focus Leave(フォーカスが外れた時) |
入力欄からフォーカスが外れたときに送信する。 |
オン |
| Press Enter(Enterキー押下時) |
Enter キーを押したときに送信する。 |
オン |
| Clear Button(クリアボタン押下時) |
クリアボタンを押したときにも送信する。 |
オン |
| Topic |
「When changed, send:」配下。送信メッセージに付ける msg.topic。 |
"topic" |
🎯 入力モード一覧
text
通常のテキスト入力
msg.payload = "Hello"
number
数値入力(数値型で出力)
msg.payload = 42
password
パスワード入力(マスク表示)
msg.payload = "secret123"
date
日付選択
msg.payload = "2024-01-15"
color
カラーピッカー
msg.payload = "#ff5722"
🎯 使用パターン
パターン1: 名前入力フィールド
用途: ユーザーによる自由な文字列の入力
ui-text-input
お名前
→
Debug
// 設定
Mode: text input
Press Enter: オン
Focus Leave: オン
パターン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 ウィジェットはエディターが日本語化されている(ui_form の ja ロケールあり)。ja 翻訳のない「Size」のみ「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
| 設定項目 |
説明 |
デフォルト |
| 名前 |
フローエディター上でノードを識別する管理名。 |
(空) |
| グループ |
フォームを配置するダッシュボードのグループ。 |
(必須) |
| Size(サイズ) |
グループ内で占める幅と高さ。0 で自動。 |
自動 |
| ラベル |
フォーム上部に表示する見出し文字列。 |
(空) |
| クラス |
任意の CSS クラス名。 |
(空) |
| フォームの要素 |
入力欄の定義リスト。要素ごとに ラベル・key(出力オブジェクトのキー名)・型・必須・行数(複数行のとき)を設定する。 |
(なし) |
| ボタン |
送信ボタンの文字列(submit)と中止ボタンの文字列(cancel)を設定する。 |
submit / clear |
| トピック |
送信メッセージに付ける msg.topic。 |
"topic" |
| 送信後にフォームを初期化 |
送信後に各入力欄を空に戻すか(resetOnSubmit)。 |
オン |
| フォーム要素を2列に配置 |
フォームを2列レイアウトで表示するか(splitLayout)。 |
オフ |
📋 フィールドタイプ
| タイプ |
説明 |
出力値 |
| text |
テキスト入力 |
string |
| number |
数値入力 |
number |
| email |
メール入力 |
string |
| password |
パスワード入力 |
string |
| checkbox |
チェックボックス |
boolean |
| switch |
スイッチ |
boolean |
| date |
日付選択 |
string (YYYY-MM-DD) |
| time |
時刻選択 |
string (HH:MM) |
| multiline |
複数行テキスト |
string |
🎯 使用パターン
パターン1: ユーザー登録フォーム
用途: 複数項目をまとめた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 ウィジェットは ja ロケールがなく、エディター表示は英語(「名前」は共通項目なので日本語)。英語項目は「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
| 設定項目 |
説明 |
デフォルト |
| 名前 |
フローエディター上でノードを識別する管理名。 |
(空) |
| Group(グループ) |
配置するダッシュボードのグループ。 |
(必須) |
| Size(サイズ) |
グループ内で占める幅と高さ。0 で自動。 |
自動 |
| Label(ラベル) |
グループの横に表示する文字列。 |
(空) |
| Class(クラス) |
任意の CSS クラス名。 |
(空) |
| Options(選択肢) |
value/label の組のリスト(editableList で増減)。 |
(なし) |
| Columns(列数) |
ラジオボタンを何列で並べるか。 |
1 |
| Topic |
送信メッセージに付ける msg.topic。 |
"topic" |
| If msg arrives on input, pass through to output:(入力メッセージを出力にパススルー) |
入力で選択値を更新したとき、その入力メッセージをそのまま出力にも流すか。 |
オン |
使用例: 優先度選択
ui-radio-group
優先度
→
Debug
// Options設定
[
{"label": "🔴 高", "value": "high"},
{"label": "🟡 中", "value": "medium"},
{"label": "🟢 低", "value": "low"}
]
// 出力: msg.payload = "high"
🎛️ 10. button-group(ボタングループ)
📋 主要プロパティ
button-group ウィジェットは ja ロケールがなく、エディター表示は英語(「名前」「トピック」は Node-RED 共通項目なので日本語)。英語項目は「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
| 設定項目 |
説明 |
デフォルト |
| 名前 |
フローエディター上でノードを識別する管理名。 |
(空) |
| Group(グループ) |
配置するダッシュボードのグループ。 |
(必須) |
| Size(サイズ) |
グループ内で占める幅と高さ。0 で自動。 |
自動 |
| Label(ラベル) |
グループの横に表示する文字列。 |
(空) |
| Class(クラス) |
任意の CSS クラス名。 |
(空) |
| Appearance(外観) |
ボタンの角を丸くするか(rounded)。 |
角丸オン |
| Colors(色) |
「Use theme colors」を有効にするとテーマ色を使う。無効にすると各ボタンに個別色を設定できる。 |
テーマ色を使用 |
| Options(選択肢) |
各ボタンの value/label/icon/color のリスト(editableList で増減)。 |
(なし) |
| トピック |
送信メッセージに付ける msg.topic。 |
"topic" |
| If msg arrives on input, pass through to output:(入力メッセージを出力にパススルー) |
入力で選択値を更新したとき、その入力メッセージをそのまま出力にも流すか。 |
オン |
使用例: 表示モード切替
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. 実践演習
📌 複数のフローを読み込むとき: このサイトの Dashboard 2.0 のフロー(サンプルフローと演習の解答例)は、すべて同じダッシュボード設定ノード(ui-base)を共有しています。2つ目以降のフローを読み込むと、「読み込もうとしているノードのいくつかは、既にワークスペース内に存在しています。」という通知が出ます。「コピーを読み込み」を選んでください。共有している設定ノードは既にあるものが使われ、どのフローのページも1つのダッシュボードにまとまります。ページはダッシュボードの左のメニューから選べます。ダッシュボード全体の見た目(ヘッダーやメニューの表示)は、最初に読み込んだフローの ui-base の設定になります。
ページが表示されないとき: ダッシュボードの設定ノード(ui-base)が2つ以上あると、そのうち1つのページしか表示されません。このサイトの以前の版のフローを読み込んでいると、この状態になります。以前の版のフローのタブを削除してから、エディタの メニュー → 設定ノード を開き、画面上部の「未使用」を選んで、どのノードからも使われていない ui-group・ui-page・ui-base・ui-theme を削除します。ui-group を消すとそれを使っていた ui-page が、ui-page を消すと ui-base が未使用になるので、未使用のものが無くなるまで繰り返してください。そのあとで、フローを読み込み直します。
📝 演習の進め方:
- 各演習はウィジェット種類ごとに分かれています
- まず要求仕様を読み、自分で実装を試みましょう
- 困ったらヒントを参考にしてください
- 解答例フローはインポートして動作確認できます
🔘 button ウィジェット演習
演習 B-1: シンプルボタン初級
📝 課題:
クリックすると「ボタンが押されました」というメッセージを送信するシンプルなボタンを作成してください。
💼 使いどころ: 画面の操作をきっかけにフローを動かす、最も基本の形を確かめる場面で使います。
🎯 要求仕様:
- ui-button: ラベル「クリック」、Payload「ボタンが押されました」
- Debugノードで出力を確認
📊 期待される出力:
msg.payload = "ボタンが押されました"
💡 ヒント
ui-buttonの設定:
- Label: 「クリック」
- Payload: 「ボタンが押されました」(string型)
- Topic: 空欄のままでOK
Debugノードの設定:
- 出力: msg.payload
- 対象: デバッグウィンドウ
✅ 解答例フロー
[{"id":"b1_tab","type":"tab","label":"B-1: シンプルボタン"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"ボタン演習","ui":"c2e1aa56f50f03bd","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_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: アイコン付きボタン中級
📝 課題:
電源アイコン付きのボタンを作成してください。
💼 使いどころ: 操作の意味を絵記号で示し、限られた画面幅にボタンを収める場面で使います。
🎯 要求仕様:
- ui-button: ラベル「電源」、アイコン「mdi-power」
- Payload: 「power_toggle」
- Topic: 「power」
📊 期待される出力:
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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"ボタン演習","ui":"c2e1aa56f50f03bd","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_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を送信して、ボタンの外観(ラベル、アイコン、色)を動的に変更してください。
💼 使いどころ: 状況に応じてボタンの表示や色を変え、今できる操作を示す場面で使います。
🎯 要求仕様:
- ui-button: 初期状態は「待機中」
- Injectノード「処理中」: ラベルを「処理中...」、アイコンを「mdi-loading」、背景色をオレンジに変更
- Injectノード「完了」: ラベルを「完了」、アイコンを「mdi-check」、背景色を緑に変更
💡 ヒント
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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"ボタン演習","ui":"c2e1aa56f50f03bd","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_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値を送信するシンプルなスイッチを作成してください。
💼 使いどころ: 入切の状態を画面から切り替える場面で使います。
🎯 要求仕様:
- ui-switch: ラベル「LEDライト」
- On Value: true(boolean), Off Value: false(boolean)
- Debugノードで出力を確認
📊 期待される出力:
// 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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"スイッチ演習","ui":"c2e1aa56f50f03bd","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_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で異なる文字列値を送信し、アイコンと色も変更されるスイッチを作成してください。
💼 使いどころ: 受け手の機器が解釈できる値を、スイッチ操作で送る場面で使います。
🎯 要求仕様:
- ui-switch: ラベル「モーター」
- On Value: 「running」, Off Value: 「stopped」
- On Color: 緑(#4caf50), Off Color: 赤(#f44336)
- On Icon: mdi-play, Off Icon: mdi-stop
📊 期待される出力:
// 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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"スイッチ演習","ui":"c2e1aa56f50f03bd","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_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: ラベル「リモート制御」
- Injectノード「ON」: msg.payload = true を送信
- Injectノード「OFF」: msg.payload = false を送信
- ダッシュボードで手動操作した場合とInjectノード入力の両方でDebug出力されるようにする
- ダッシュボード上の操作とInjectによる入力の両方でDebug出力を確認する
💡 ヒント
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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"スイッチ演習","ui":"c2e1aa56f50f03bd","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_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の範囲で音量を調整できるスライダーを作成してください。操作中にリアルタイムで値を送信します。
💼 使いどころ: 操作しながら結果を確かめたい設定値を、連続的に変える場面で使います。
🎯 要求仕様:
- ui-slider: ラベル「音量」、範囲 0〜100、刻み 1
- Output: all(操作中常時送信)
- Debugノードで出力を確認
📊 期待される出力:
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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"スライダー演習","ui":"c2e1aa56f50f03bd","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_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":"","thumbLabel":true,"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度刻みで温度を設定できるスライダーを作成してください。操作完了時のみ値を送信します。
💼 使いどころ: 刻み幅を決めた設定値を、操作の途中で送らずに確定してから渡す場面で使います。
🎯 要求仕様:
- ui-slider: ラベル「設定温度」、範囲 16〜30、刻み 0.5
- Output: end(操作完了時のみ)
- Debugノードで出力を確認
📊 期待される出力:
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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"スライダー演習","ui":"c2e1aa56f50f03bd","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_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":"","thumbLabel":true,"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: ラベル「明るさ」、範囲 0〜100
- Injectノード「50%」: msg.payload = 50 を送信
- Injectノード「100%」: msg.payload = 100 を送信
- ダッシュボードで手動操作した場合とInjectノード入力の両方でDebug出力されるようにする
- ダッシュボード上の操作とInjectによる入力の両方でDebug出力を確認する
💡 ヒント
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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"スライダー演習","ui":"c2e1aa56f50f03bd","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_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":"","thumbLabel":true,"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: 単一選択ドロップダウン初級
📝 課題:
動作モードを選択できる単一選択のドロップダウンを作成してください。
💼 使いどころ: 運転モードのように、決まった選択肢から1つ選ばせる場面で使います。
🎯 要求仕様:
- ui-dropdown: ラベル「動作モード」
- Options: 自動(auto)、手動(manual)、停止(stop)
- Debugノードで出力を確認
📊 期待される出力:
msg.payload = "auto" // 選択した値
💡 ヒント
ui-dropdownの設定:
- Label: 「動作モード」
- Optionsに3つの選択肢を追加
- 各選択肢にlabelとvalueを設定
✅ 解答例フロー
[{"id":"d1_tab","type":"tab","label":"D-1: 単一選択ドロップダウン"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"ドロップダウン演習","ui":"c2e1aa56f50f03bd","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_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: 複数選択ドロップダウン中級
📝 課題:
通知先を複数選択できるドロップダウンを作成してください。チップ表示で選択状態を見やすくします。
💼 使いどころ: 通知先のように、複数の項目を同時に選ばせる場面で使います。
🎯 要求仕様:
- ui-dropdown: ラベル「通知先」
- Options: メール(email)、Slack(slack)、LINE(line)、SMS(sms)
- Multiple: true, Chips: true, Clearable: true
📊 期待される出力:
msg.payload = ["email", "slack"] // 選択した値の配列
💡 ヒント
ui-dropdownの設定:
- Label: 「通知先」
- Multiple: チェックを入れる
- Chips: チェックを入れる
- Clearable: チェックを入れる
✅ 解答例フロー
[{"id":"d2_tab","type":"tab","label":"D-2: 複数選択ドロップダウン"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"ドロップダウン演習","ui":"c2e1aa56f50f03bd","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_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: 動的オプション変更上級
📝 課題:
msg.optionsを送信して、ドロップダウンの選択肢を動的に変更してください。
💼 使いどころ: 接続中の機器一覧のように、選択肢が実行時に決まる場面で使います。
🎯 要求仕様:
- ui-dropdown: ラベル「地域選択」
- Inject → Changeノードでmsg.optionsを設定
- 選択肢: 東京(tokyo)、大阪(osaka)、福岡(fukuoka)
💡 ヒント
Changeノードの設定: 「値の代入」で msg.options に「JSON」型の次の値を設定します。
[
{"label": "東京", "value": "tokyo"},
{"label": "大阪", "value": "osaka"},
{"label": "福岡", "value": "fukuoka"}
]
ドロップダウンは msg.options を受け取ると、選択肢をその内容に置き換えます。
✅ 解答例フロー
[{"id":"d3_tab","type":"tab","label":"D-3: 動的オプション変更"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"ドロップダウン演習","ui":"c2e1aa56f50f03bd","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_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_change"]]},{"id":"d3_change","type":"change","z":"d3_tab","name":"options設定","rules":[{"t":"set","p":"options","pt":"msg","to":"[{\"label\": \"東京\", \"value\": \"tokyo\"}, {\"label\": \"大阪\", \"value\": \"osaka\"}, {\"label\": \"福岡\", \"value\": \"fukuoka\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"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キーまたはフォーカスが外れたときに値を送信します。
💼 使いどころ: 名前やメモなど、自由な文字列をユーザーに入力させる場面で使います。
🎯 要求仕様:
- ui-text-input: ラベル「お名前」、Mode: text input
- Press Enter: オン、Focus Leave: オン
- Debugノードで出力を確認
📊 期待される出力:
msg.payload = "山田太郎"
💡 ヒント
ui-text-inputの設定:
- Label: 「お名前」
- Mode: text input
- Press Enter: チェックを入れる
- Focus Leave: チェックを入れる
✅ 解答例フロー
[{"id":"t1_tab","type":"tab","label":"T-1: テキスト入力"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"テキスト入力演習","ui":"c2e1aa56f50f03bd","path":"/input-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_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モードでは出力が数値型になります。
💼 使いどころ: 数量のように、そのまま計算に使える値として受け取る場面で使います。
🎯 要求仕様:
- ui-text-input: ラベル「数量」、Mode: number
- Debugノードで出力の型を確認
📊 期待される出力:
msg.payload = 10 // typeof === "number"
💡 ヒント
ui-text-inputの設定:
- Label: 「数量」
- Mode: number
- ※ Modeがnumberの場合、msg.payloadは数値型で出力されます
✅ 解答例フロー
[{"id":"t2_tab","type":"tab","label":"T-2: 数値入力"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"テキスト入力演習","ui":"c2e1aa56f50f03bd","path":"/input-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_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つの入力フィールドを作成してください。
💼 使いどころ: パスワードや日付など、内容に応じた専用の入力欄を使い分ける場面で使います。
🎯 要求仕様:
- ui-text-input 1: Mode: password
- ui-text-input 2: Mode: email
- ui-text-input 3: Mode: date
💡 ヒント
各モードの特徴:
- password: 入力がマスク表示されます
- email: メールアドレス形式の入力用
- date: 日付選択ピッカーが表示されます
✅ 解答例フロー
[{"id":"t3_tab","type":"tab","label":"T-3: 複数モード活用"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"テキスト入力演習","ui":"c2e1aa56f50f03bd","path":"/input-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_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: ユーザー登録フォーム中級
📝 課題:
名前、メール、年齢、コメントを入力できるユーザー登録フォームを作成してください。
💼 使いどころ: 複数の項目をまとめて入力させ、1件のデータとして受け取る場面で使います。
🎯 要求仕様:
- ui-form: 4つのフィールド
- 名前(text/必須)、メール(email/必須)、年齢(number)、コメント(multiline)
📊 期待される出力:
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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"フォーム演習","ui":"c2e1aa56f50f03bd","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_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デバイスの設定フォームを作成してください。テキスト、数値、スイッチのフィールドを含みます。
💼 使いどころ: 文字・数値・入切が混在する設定を、1つの画面で登録する場面で使います。
🎯 要求仕様:
- ui-form: 4つのフィールド
- デバイス名(text/必須)、IPアドレス(text/必須)、ポート(number/必須)、有効化(switch)
📊 期待される出力:
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":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"フォーム演習","ui":"c2e1aa56f50f03bd","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_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を送信して、フォームの初期値を設定してください。
💼 使いどころ: 現在の設定を初期値として表示し、変更したい箇所だけ直させる場面で使います。
🎯 要求仕様:
- ui-form: 名前(text)、メール(email)フィールド
- Injectノードから初期値を送信
- フォームに初期値が反映されることを確認
💡 ヒント
Injectノードの設定:
msg.payload = {
"name": "デフォルト名",
"email": "default@example.com"
}
※ フィールドのkeyとmsg.payloadのキーを一致させる
✅ 解答例フロー
[{"id":"f3_tab","type":"tab","label":"F-3: 初期値設定フォーム"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"フォーム演習","ui":"c2e1aa56f50f03bd","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_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択で選べるラジオボタングループを作成してください。
💼 使いどころ: 選択肢が少なく、すべてを一覧で見せたまま1つ選ばせる場面で使います。
🎯 要求仕様:
- ui-radio-group: ラベル「優先度」
- Options: 🔴 高(high)、🟡 中(medium)、🟢 低(low)
📊 期待される出力:
msg.payload = "high" // 選択した値
💡 ヒント
ui-radio-groupの設定:
- Label: 「優先度」
- Optionsに3つの選択肢を追加
- 各選択肢にlabelとvalueを設定
✅ 解答例フロー
[{"id":"r1_tab","type":"tab","label":"R-1: 優先度選択ラジオ"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"ラジオボタン演習","ui":"c2e1aa56f50f03bd","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_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: 表示モード切替中級
📝 課題:
アイコン付きの表示モード切替ボタングループを作成してください。
💼 使いどころ: 表示の切り替えのように、現在どれが選ばれているかを常に示す場面で使います。
🎯 要求仕様:
- ui-button-group: ラベル「表示モード」
- Options: リスト(list/mdi-format-list-bulleted)、グリッド(grid/mdi-grid)、カード(card/mdi-card-outline)
📊 期待される出力:
msg.payload = "grid" // 選択した値
💡 ヒント
ui-button-groupの設定:
- Label: 「表示モード」
- Optionsに3つの選択肢を追加
- 各選択肢にlabel, value, iconを設定
✅ 解答例フロー
[{"id":"bg1_tab","type":"tab","label":"BG-1: 表示モード切替"},{"id":"c2e1aa56f50f03bd","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_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_page","type":"ui-page","name":"ボタングループ演習","ui":"c2e1aa56f50f03bd","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_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":"","rounded":false,"useThemeColors":true,"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. まとめ
入力系ウィジェットの重要ポイント
- ✅ button: クリックで任意の値を送信、アイコン・色のカスタマイズ可能
- ✅ switch: ON/OFF切り替え、カスタム値・アイコン対応
- ✅ slider: 範囲内の数値入力、操作中/完了時の出力選択可能
- ✅ dropdown: 単一/複数選択対応、動的オプション変更可能
- ✅ text-input: 様々な入力モード(text/number/password/email/date等)
- ✅ form: 複数フィールドをまとめて送信
- ✅ msg.payloadで外部から値を設定可能(双方向バインディング)
- ✅ msg.ui_updateで動的にプロパティを変更可能
⚠️ よくある間違い
- Pass Throughの誤解: 入力メッセージをそのまま出力に流す機能(状態更新とは別)
- Decoupleの誤解: UIからの操作時のみ出力する機能(入力での更新は出力しない)
- ui-notificationの参照: groupではなくuiプロパティでui-baseを参照
- ui-formの出力: 各フィールドのkeyがオブジェクトのキーになる
- スライダーのOutput設定: allは操作中常時、endは操作完了時のみ
🔧 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. 追加リソース
このガイドが役に立ちましたら、実際のプロジェクトで練習してみてください!
入力系ウィジェットはユーザーインタラクションの基本です。