Node-Red Dashboard
Node-Red Dashboard 是提供Node-Red 流程资料展示的一个中方式.Dashboard
提供丰富多样的人机界面组件,适用于展示设备的监测数据.
安装
在节点管理
界面找到 node-red-dashboard
安装即可.如下图:
找到 {user}/.node-red/settings.json
去掉 ui: { path: "ui" }
前面的注释.
访问 http://ip:1880/ui/ 出现以下界面则安装完成.
配置dashboard
把node-red选项卡切换至dashboard
配置界面,如下图:
- Layout 用来管理
dashboard
的布局
- Site 是网站的一些设置
- Theme 是网站样式调整
如果没有添加控件在dashboard
中则会显示空白,点击tab
点击一个新栏目,然后下面可以添加group
, group里面添加组件.动手尝试一下即可以发现互相的关系.
每日油价练习
node-red启动或每天早上六点从 油价网获取指定地区的油价,如需修改则修改油价网
里面对应链接即可.
[
{
"id": "eecd414d.9d3d8",
"type": "tab",
"label": "每日油价",
"disabled": false,
"info": ""
},
{
"id": "5be36d69.613d24",
"type": "ui_text",
"z": "eecd414d.9d3d8",
"group": "18fe738b.e7dc4c",
"order": 1,
"width": 0,
"height": 0,
"name": "",
"label": "89#汽油价格",
"format": "{{msg.price_89}}元/升",
"layout": "row-spread",
"x": 549,
"y": 175,
"wires": []
},
{
"id": "3d07117e.0e96ee",
"type": "ui_text",
"z": "eecd414d.9d3d8",
"group": "18fe738b.e7dc4c",
"order": 4,
"width": 0,
"height": 0,
"name": "",
"label": "0#柴油价格",
"format": "{{msg.price_0}}元/升",
"layout": "row-spread",
"x": 537,
"y": 340,
"wires": []
},
{
"id": "1168b0ba.f04fdf",
"type": "inject",
"z": "eecd414d.9d3d8",
"name": "早上6点",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "00 06 * * *",
"once": false,
"onceDelay": 0.1,
"x": 156,
"y": 125,
"wires": [
[
"f04637bb.7833b8"
]
]
},
{
"id": "5cf75eb6.3b86d",
"type": "start-up-trigger",
"z": "eecd414d.9d3d8",
"x": 157,
"y": 52,
"wires": [
[
"f04637bb.7833b8"
]
]
},
{
"id": "5584f053.ca1f2",
"type": "html",
"z": "eecd414d.9d3d8",
"name": "过滤油价",
"property": "payload",
"outproperty": "payload",
"tag": "font",
"ret": "text",
"as": "single",
"x": 140,
"y": 325,
"wires": [
[
"3a77cd21.82eb62"
]
]
},
{
"id": "f04637bb.7833b8",
"type": "http request",
"z": "eecd414d.9d3d8",
"name": "油价网",
"method": "GET",
"ret": "txt",
"url": "http://youjia.chemcp.com/zhejiang/",
"tls": "",
"x": 133,
"y": 234,
"wires": [
[
"5584f053.ca1f2"
]
]
},
{
"id": "f9c58bdf.3875a8",
"type": "debug",
"z": "eecd414d.9d3d8",
"name": "调式信息",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 531,
"y": 67,
"wires": []
},
{
"id": "3a77cd21.82eb62",
"type": "function",
"z": "eecd414d.9d3d8",
"name": "油价处理",
"func": "var payload = msg.payload;\nmsg.price_89 = payload[0];\nmsg.price_92 = payload[1];\nmsg.price_95 = payload[2];\nmsg.price_0 = payload[3];\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 123,
"y": 423,
"wires": [
[
"f9c58bdf.3875a8",
"5be36d69.613d24",
"3d07117e.0e96ee",
"698ba48f.b80f1c",
"82f5d760.a29ff8",
"81b6e55b.0581e8"
]
]
},
{
"id": "698ba48f.b80f1c",
"type": "ui_text",
"z": "eecd414d.9d3d8",
"group": "18fe738b.e7dc4c",
"order": 2,
"width": 0,
"height": 0,
"name": "",
"label": "92#汽油价格",
"format": "{{msg.price_92}}元/升",
"layout": "row-spread",
"x": 550,
"y": 219,
"wires": []
},
{
"id": "82f5d760.a29ff8",
"type": "ui_text",
"z": "eecd414d.9d3d8",
"group": "18fe738b.e7dc4c",
"order": 3,
"width": 0,
"height": 0,
"name": "",
"label": "95#汽油价格",
"format": "{{msg.price_95}}元/升",
"layout": "row-spread",
"x": 544,
"y": 269,
"wires": []
},
{
"id": "e9d6c99.4254038",
"type": "mqtt out",
"z": "eecd414d.9d3d8",
"name": "mqtt转发今日油价",
"topic": "/node-red/youjia",
"qos": "0",
"retain": "",
"broker": "1550bab3.2a8365",
"x": 548,
"y": 543,
"wires": []
},
{
"id": "81b6e55b.0581e8",
"type": "function",
"z": "eecd414d.9d3d8",
"name": "mqtt消息整理",
"func": "\nvar payload = {}\npayload.price_89 = msg.price_89;\npayload.price_92 = msg.price_89;\npayload.price_95 = msg.price_89;\npayload.price_0 = msg.price_89;\n\nmsg.payload = payload;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 527,
"y": 428,
"wires": [
[
"e9d6c99.4254038"
]
]
},
{
"id": "18fe738b.e7dc4c",
"type": "ui_group",
"z": "",
"name": "今日油价",
"tab": "63e47422.1e5c5c",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "1550bab3.2a8365",
"type": "mqtt-broker",
"z": "",
"name": "home",
"broker": "shenfan.f3322.net",
"port": "2883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "63e47422.1e5c5c",
"type": "ui_tab",
"z": "",
"name": "Home",
"icon": "dashboard",
"order": 1
}
]