Node-RED中使用Notification元件显示警告讯息框(温度过高提示)

场景

Node-RED简介与Windows上安装、启动和运行示例:

Node-RED简介与Windows上安装、启动和运行示例_霸道流氓气质的博客-CSDN博客

Node-RED怎样导出导入流程为json文件:

Node-RED怎样导出导入流程为json文件_霸道流氓气质的博客-CSDN博客

Node-RED安装图形化节点dashboard实现订阅mqtt主题并在仪表盘中显示温度:

Node-RED安装图形化节点dashboard实现订阅mqtt主题并在仪表盘中显示温度_霸道流氓气质的博客-CSDN博客

在上面的基础上怎样使用Notification元件实现弹出警告讯息框。

 

注:

博客:
霸道流氓气质的博客_CSDN博客-C#,架构之路,SpringBoot领域博主
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

1、 在仪表盘新增Slider、Text、Notification元件后

Text元件显示Slider滑杆的温度值,switch节点判断温度值是否超过40度,如果是就在右上角弹出警告框。

 

2、编辑switch元件,判断温度过高则提示

 

3、编辑警告讯息框,layout代表在右上角显示,3代表显示3秒,Topic代表显示的内容

4、json数据

[
    {
        "id": "f4a4d8eab7935bc8",
        "type": "tab",
        "label": "流程 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "edf7dbb2e9a74b72",
        "type": "ui_slider",
        "z": "f4a4d8eab7935bc8",
        "name": "",
        "label": "输入温度: ",
        "tooltip": "",
        "group": "a0954be5.a7f7e8",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": true,
        "outs": "all",
        "topic": "topic",
        "topicType": "msg",
        "min": "20",
        "max": "50",
        "step": 1,
        "className": "",
        "x": 180,
        "y": 120,
        "wires": [
            [
                "9ae5f06a867fbd9f",
                "4be5429fd1f5dcad"
            ]
        ]
    },
    {
        "id": "9ae5f06a867fbd9f",
        "type": "ui_text",
        "z": "f4a4d8eab7935bc8",
        "group": "248cbbb0.18e794",
        "order": 0,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "温度值: ",
        "format": "摄氏: {{msg.payload}} 度",
        "layout": "row-spread",
        "className": "",
        "x": 410,
        "y": 120,
        "wires": []
    },
    {
        "id": "4be5429fd1f5dcad",
        "type": "switch",
        "z": "f4a4d8eab7935bc8",
        "name": "温度是否太高",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gte",
                "v": "40",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 390,
        "y": 180,
        "wires": [
            [
                "140874520f9ed70f"
            ]
        ]
    },
    {
        "id": "140874520f9ed70f",
        "type": "ui_toast",
        "z": "f4a4d8eab7935bc8",
        "position": "top right",
        "displayTime": "3",
        "highlight": "",
        "sendall": true,
        "outputs": 0,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "温度太高!",
        "name": "",
        "x": 610,
        "y": 180,
        "wires": []
    },
    {
        "id": "a0954be5.a7f7e8",
        "type": "ui_group",
        "name": "MyInput",
        "tab": "3f79c420.cfc1bc",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "248cbbb0.18e794",
        "type": "ui_group",
        "name": "MyGroup",
        "tab": "3f79c420.cfc1bc",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "3f79c420.cfc1bc",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
] 

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

霸道流氓气质

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值