ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

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

2022-04-14 19:31:24  阅读:184  来源: 互联网

标签:Node false name Notification ui f4a4d8eab7935bc8 type id RED


场景

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

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/121884766

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

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/124130985

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

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/121992760

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

 

 

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

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
    }
] 

 

标签:Node,false,name,Notification,ui,f4a4d8eab7935bc8,type,id,RED
来源: https://www.cnblogs.com/badaoliumangqizhi/p/16146174.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有