Node-RED中使用Notification元件显示警告讯息框(温度过高提示)
2022/4/14 20:12:48
本文主要是介绍Node-RED中使用Notification元件显示警告讯息框(温度过高提示),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
场景
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-RED中使用Notification元件显示警告讯息框(温度过高提示)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-22怎么通过控制台去看我的页面渲染的内容在哪个文件中呢-icode9专业技术文章分享
- 2024-12-22el-tabs 组件只被引用了一次,但有时会渲染两次是什么原因?-icode9专业技术文章分享
- 2024-12-22wordpress有哪些好的安全插件?-icode9专业技术文章分享
- 2024-12-22wordpress如何查看系统有哪些cron任务?-icode9专业技术文章分享
- 2024-12-21Svg Sprite Icon教程:轻松入门与应用指南
- 2024-12-20Excel数据导出实战:新手必学的简单教程
- 2024-12-20RBAC的权限实战:新手入门教程
- 2024-12-20Svg Sprite Icon实战:从入门到上手的全面指南
- 2024-12-20LCD1602显示模块详解
- 2024-12-20利用Gemini构建处理各种PDF文档的Document AI管道