『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 515|回复: 11

[教程系列] 求助:温度超温报警通知,恢复正常通知

[复制链接]

5

主题

21

帖子

120

积分

注册会员

Rank: 2

积分
120
金钱
99
HASS币
0
发表于 2024-9-25 18:48:50 | 显示全部楼层 |阅读模式
本帖最后由 寒夜吟 于 2024-9-28 12:19 编辑

小白刚刚接触HA  nodered ,想实现:温度正常范围:30--33度,温度超温报警通知,恢复正常通知。其中要求,每间隔1分钟检测一次,超过30度进行报警提示。 低于33度时提示恢复正常,恢复正常后不再提示。
目前做到:获取温度高于33度报警,每间隔1分钟,温差大于1度报警给一次,。恢复30度以下提示温度正常,温差大于1时报警一次。
swith 设置了>33   <30   ; function  判断了 温差,拼接文字提示。
不知道应该用什么方式实现我要的效果了。补充:
需要解决:1 温度恢复33度后,提示温度正常后,不再报警。
              2 在30--33度之间时,不会因为温度波动而误报警。

node捕获.JPG
========================
20240927  更新内容:基本实现想法,
1、超出温度范围报警,温差大于1度报警一次。
2、正常温度范围:提示2次温度后不再提示。
3、低于温度范围报警,温差大于1度时报警一次。
4、温度正常时,早中晚各发一次温度提醒。(另外一个流程没有展示)
问题:1、正常温度范围提示2次使用了计数器,怎么才能在超出温度范围后重置计算器,这样才能在温度从高温到正常时 时行提示。
感谢论坛各位的支持。

新的流程图

新的流程图



[{"id":"8430daf6e32c541b","type":"tab","label":"流程 5","disabled":false,"info":"","env":[]},{"id":"aa9e397c03f86663","type":"api-current-state","z":"8430daf6e32c541b","d":true,"name":"温度","server":"c9ce0c5e564bed0a","version":3,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.esphome_web_107004_temperature","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":210,"y":320,"wires":[["2c89adc818b9dc7e"]]},{"id":"6812ab342657ab71","type":"inject","z":"8430daf6e32c541b","name":"周期","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"iso","payloadType":"date","x":90,"y":320,"wires":[["aa9e397c03f86663"]]},{"id":"7ae97f2f284ec04e","type":"debug","z":"8430daf6e32c541b","name":"debug 35","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":960,"y":340,"wires":[]},{"id":"d2949244440748d0","type":"debug","z":"8430daf6e32c541b","name":"debug 36","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":960,"y":280,"wires":[]},{"id":"9783bb68f4c3f971","type":"switch","z":"8430daf6e32c541b","name":"温度25_33高低","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"33","vt":"str"},{"t":"lt","v":"25","vt":"str"},{"t":"btwn","v":"25","vt":"num","v2":"33","v2t":"num"}],"checkall":"true","repair":false,"outputs":3,"x":580,"y":320,"wires":[["29f771c6c735002e","fb52d3007888d64b"],["37accae04765c6f9","65fce91bb12a2ff1"],["dbb277603f26353b"]]},{"id":"37accae04765c6f9","type":"function","z":"8430daf6e32c541b","name":"低温提醒","func":"msg.current = Math.floor(msg.payload);\nmsg.before = global.get("sensor.esphome_web_107004_temperature") || msg.current;\nmsg.wencha = msg.current - msg.before;\n\nif( msg.wencha != 0 ){\n    if( msg.wencha > 0 ){\n        msg.payload = "低温提醒,温度升高"+ msg.wencha +"度,当前为:" + msg.payload + "度";\n    }else if (msg.wencha < 0 ){\n        msg.payload = "低温提醒,温度降低"+ Math.abs(msg.wencha) +"度,当前为:" + msg.payload + "度";\n    }\n    global.set("sensor.esphome_web_107004_temperature", msg.current);\n    return msg;\n}else{\n    \n    global.set("sensor.esphome_web_107004_temperature", msg.current);\n}\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":340,"wires":[["7ae97f2f284ec04e"]]},{"id":"29f771c6c735002e","type":"function","z":"8430daf6e32c541b","name":"超温提醒","func":"msg.current = Math.floor(msg.payload);\nmsg.before = global.get("sensor.esphome_web_107004_temperature") || msg.current;\nmsg.wencha = msg.current - msg.before;\n\nif( msg.wencha != 0 ){\n    if( msg.wencha > 0 ){\n        msg.payload = "高温预警:超温,温度升高"+ msg.wencha +"度,当前为:" + msg.payload + "度";\n    }else if (msg.wencha < 0 ){\n        msg.payload = "高温预警:超温,温度降低"+ Math.abs(msg.wencha) +"度,当前为:" + msg.payload + "度";\n    }\n    global.set("sensor.esphome_web_107004_temperature", msg.current);\n    return msg;\n}else{\n    \n    global.set("sensor.esphome_web_107004_temperature", msg.current);\n}\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":280,"wires":[["d2949244440748d0"]]},{"id":"2c89adc818b9dc7e","type":"delay","z":"8430daf6e32c541b","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":380,"y":320,"wires":[["9783bb68f4c3f971","1ebf50b692e56290"]]},{"id":"fb52d3007888d64b","type":"debug","z":"8430daf6e32c541b","name":"debug 37","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":220,"wires":[]},{"id":"65fce91bb12a2ff1","type":"debug","z":"8430daf6e32c541b","name":"debug 38","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":820,"y":380,"wires":[]},{"id":"1ebf50b692e56290","type":"debug","z":"8430daf6e32c541b","name":"debug 39","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":220,"wires":[]},{"id":"30b61553fa3cd55f","type":"template","z":"8430daf6e32c541b","name":"当前温度","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"温度正常:现在温度 {{payload}} 度!","output":"str","x":820,"y":580,"wires":[["e7da87d4f76d9dda"]]},{"id":"e7da87d4f76d9dda","type":"debug","z":"8430daf6e32c541b","name":"debug 40","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":580,"wires":[]},{"id":"32b4a1692d68104a","type":"counter","z":"8430daf6e32c541b","name":"","init":"0","step":"1","lower":"1","upper":"5","mode":"increment","outputs":"1","x":820,"y":440,"wires":[["b5fad6cf7416056e","96b7533c98e3d204"]]},{"id":"96b7533c98e3d204","type":"debug","z":"8430daf6e32c541b","name":"debug 43","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1000,"y":440,"wires":[]},{"id":"98f8dbed2de7045b","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"reset","v":"count","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":450,"y":520,"wires":[["32b4a1692d68104a"]]},{"id":"bb505f20f955b26b","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":240,"wires":[["92086a44d4ebe230"]]},{"id":"92086a44d4ebe230","type":"change","z":"8430daf6e32c541b","name":"39","rules":[{"t":"set","p":"payload","pt":"msg","to":"39","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":240,"wires":[["2c89adc818b9dc7e"]]},{"id":"d0d7fd9127984d9e","type":"change","z":"8430daf6e32c541b","name":"28","rules":[{"t":"set","p":"payload","pt":"msg","to":"28","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":200,"wires":[["2c89adc818b9dc7e"]]},{"id":"ac1a2f3a63bf0ff1","type":"change","z":"8430daf6e32c541b","name":"16","rules":[{"t":"set","p":"payload","pt":"msg","to":"16","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":160,"wires":[["2c89adc818b9dc7e"]]},{"id":"045dd61d6ad5e342","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":160,"wires":[["ac1a2f3a63bf0ff1"]]},{"id":"0b2bc8f3c4e04bd2","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":200,"wires":[["d0d7fd9127984d9e"]]},{"id":"b5fad6cf7416056e","type":"switch","z":"8430daf6e32c541b","name":"","property":"count","propertyType":"msg","rules":[{"t":"lt","v":"3","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":650,"y":580,"wires":[["30b61553fa3cd55f"]]},{"id":"dbb277603f26353b","type":"delay","z":"8430daf6e32c541b","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":580,"y":440,"wires":[["32b4a1692d68104a"]]},{"id":"c9ce0c5e564bed0a","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]


==============
0240928  更新内容:基本实现想法,
1、超出温度范围报警,温差大于1度报警一次。
2、正常温度范围:温差大于1度提示,使用了计数器 ,提示2次温度后不再提示。当超出温度范围或者低于温度范围时,重置计数器。
3、低于温度范围报警,温差大于1度时报警一次。
4、温度正常时,早中晚各发一次温度提醒。(另外一个流程没有展示)
问题:1、为什么  ”发送重置“ 与   ”计数器重置“  之间不能加“延时”? 加“延时"后计数器重置 收不到消息。
2024-09-28_121448.jpg
代码如下:里面加了好多debug。
[{"id":"8430daf6e32c541b","type":"tab","label":"测试正式1","disabled":false,"info":"","env":[]},{"id":"aa9e397c03f86663","type":"api-current-state","z":"8430daf6e32c541b","d":true,"name":"温度","server":"c9ce0c5e564bed0a","version":3,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.esphome_web_107004_temperature","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":210,"y":320,"wires":[["2c89adc818b9dc7e"]]},{"id":"6812ab342657ab71","type":"inject","z":"8430daf6e32c541b","name":"周期","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"iso","payloadType":"date","x":90,"y":320,"wires":[["aa9e397c03f86663"]]},{"id":"7ae97f2f284ec04e","type":"debug","z":"8430daf6e32c541b","name":"debug 35","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":340,"wires":[]},{"id":"d2949244440748d0","type":"debug","z":"8430daf6e32c541b","name":"debug 36","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":280,"wires":[]},{"id":"9783bb68f4c3f971","type":"switch","z":"8430daf6e32c541b","name":"温度25_33高低","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"33","vt":"str"},{"t":"lt","v":"25","vt":"str"},{"t":"btwn","v":"25","vt":"num","v2":"33","v2t":"num"}],"checkall":"true","repair":false,"outputs":3,"x":660,"y":320,"wires":[["29f771c6c735002e","fb52d3007888d64b","a81ed7ac1f4f3253","c15269ae9ba184c1"],["37accae04765c6f9","65fce91bb12a2ff1","8a0b9e981e7a190f","a81ed7ac1f4f3253"],["dbb277603f26353b"]]},{"id":"37accae04765c6f9","type":"function","z":"8430daf6e32c541b","name":"低温提醒","func":"msg.current = Math.floor(msg.payload);\nmsg.before = global.get("sensor.esphome_web_107004_temperature") || msg.current;\nmsg.wencha = msg.current - msg.before;\n\nif( msg.wencha != 0 ){\n    if( msg.wencha > 0 ){\n        msg.payload = "低温提醒,温度升高"+ msg.wencha +"度,当前为:" + msg.payload + "度";\n    }else if (msg.wencha < 0 ){\n        msg.payload = "低温提醒,温度降低"+ Math.abs(msg.wencha) +"度,当前为:" + msg.payload + "度";\n    }\n    global.set("sensor.esphome_web_107004_temperature", msg.current);\n    return msg;\n}else{\n    \n    global.set("sensor.esphome_web_107004_temperature", msg.current);\n}\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":340,"wires":[["7ae97f2f284ec04e"]]},{"id":"29f771c6c735002e","type":"function","z":"8430daf6e32c541b","name":"超温提醒","func":"msg.current = Math.floor(msg.payload);\nmsg.before = global.get("sensor.esphome_web_107004_temperature") || msg.current;\nmsg.wencha = msg.current - msg.before;\n\nif( msg.wencha != 0 ){\n    if( msg.wencha > 0 ){\n        msg.payload = "高温预警:超温,温度升高"+ msg.wencha +"度,当前为:" + msg.payload + "度";\n    }else if (msg.wencha < 0 ){\n        msg.payload = "高温预警:超温,温度降低"+ Math.abs(msg.wencha) +"度,当前为:" + msg.payload + "度";\n    }\n    global.set("sensor.esphome_web_107004_temperature", msg.current);\n    return msg;\n}else{\n    \n    global.set("sensor.esphome_web_107004_temperature", msg.current);\n}\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":300,"wires":[["d2949244440748d0"]]},{"id":"2c89adc818b9dc7e","type":"delay","z":"8430daf6e32c541b","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":360,"y":320,"wires":[["1ebf50b692e56290","557929b37ff70db9"]]},{"id":"fb52d3007888d64b","type":"debug","z":"8430daf6e32c541b","name":"debug 37","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":800,"y":160,"wires":[]},{"id":"65fce91bb12a2ff1","type":"debug","z":"8430daf6e32c541b","name":"debug 38","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":440,"wires":[]},{"id":"1ebf50b692e56290","type":"debug","z":"8430daf6e32c541b","name":"debug 39","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":500,"y":240,"wires":[]},{"id":"30b61553fa3cd55f","type":"template","z":"8430daf6e32c541b","name":"当前温度","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"温度正常:现在温度 {{payload}} 度!\n","output":"str","x":860,"y":640,"wires":[["e7da87d4f76d9dda"]]},{"id":"e7da87d4f76d9dda","type":"debug","z":"8430daf6e32c541b","name":"debug 40","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":640,"wires":[]},{"id":"32b4a1692d68104a","type":"counter","z":"8430daf6e32c541b","name":"计数器重置","init":"0","step":"1","lower":"0","upper":"5","mode":"increment","outputs":"1","x":670,"y":520,"wires":[["96b7533c98e3d204","b5fad6cf7416056e"]]},{"id":"96b7533c98e3d204","type":"debug","z":"8430daf6e32c541b","name":"debug 43","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":460,"wires":[]},{"id":"98f8dbed2de7045b","type":"inject","z":"8430daf6e32c541b","name":"重置","props":[{"p":"reset","v":"count","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":310,"y":680,"wires":[["32b4a1692d68104a","bb55a6644ac1a885"]]},{"id":"bb505f20f955b26b","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":240,"wires":[["92086a44d4ebe230"]]},{"id":"92086a44d4ebe230","type":"change","z":"8430daf6e32c541b","name":"39","rules":[{"t":"set","p":"payload","pt":"msg","to":"39","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":240,"wires":[["2c89adc818b9dc7e"]]},{"id":"d0d7fd9127984d9e","type":"change","z":"8430daf6e32c541b","name":"28","rules":[{"t":"set","p":"payload","pt":"msg","to":"28","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":160,"wires":[["2c89adc818b9dc7e"]]},{"id":"ac1a2f3a63bf0ff1","type":"change","z":"8430daf6e32c541b","name":"16","rules":[{"t":"set","p":"payload","pt":"msg","to":"16","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":40,"wires":[["2c89adc818b9dc7e"]]},{"id":"045dd61d6ad5e342","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":40,"wires":[["ac1a2f3a63bf0ff1"]]},{"id":"0b2bc8f3c4e04bd2","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":160,"wires":[["d0d7fd9127984d9e"]]},{"id":"b5fad6cf7416056e","type":"switch","z":"8430daf6e32c541b","name":"限制次数","property":"count","propertyType":"msg","rules":[{"t":"lte","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":860,"y":520,"wires":[["20c3a5556f503b8d"]]},{"id":"dbb277603f26353b","type":"delay","z":"8430daf6e32c541b","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":500,"y":480,"wires":[["32b4a1692d68104a"]]},{"id":"c15269ae9ba184c1","type":"template","z":"8430daf6e32c541b","name":"超温提醒","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"高温预警,当前温度:{{payload}} 度!","output":"str","x":860,"y":200,"wires":[["e8e3d8ec1d041a5f"]]},{"id":"8a0b9e981e7a190f","type":"template","z":"8430daf6e32c541b","name":"低温提醒","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"低温预警,当前温度:{{payload}} 度!","output":"str","x":840,"y":400,"wires":[["07364cb46a10c86f"]]},{"id":"e8e3d8ec1d041a5f","type":"debug","z":"8430daf6e32c541b","name":"debug 44","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":200,"wires":[]},{"id":"07364cb46a10c86f","type":"debug","z":"8430daf6e32c541b","name":"debug 45","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":400,"wires":[]},{"id":"fb9d30fb74a5a504","type":"change","z":"8430daf6e32c541b","name":"17","rules":[{"t":"set","p":"payload","pt":"msg","to":"17","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":80,"wires":[["2c89adc818b9dc7e"]]},{"id":"fe90ff44589579e2","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":80,"wires":[["fb9d30fb74a5a504"]]},{"id":"8808e80ed93b7bdd","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":200,"wires":[["cbca839b7b40a2a4"]]},{"id":"cbca839b7b40a2a4","type":"change","z":"8430daf6e32c541b","name":"37","rules":[{"t":"set","p":"payload","pt":"msg","to":"37","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":200,"wires":[["2c89adc818b9dc7e"]]},{"id":"20c3a5556f503b8d","type":"switch","z":"8430daf6e32c541b","name":"payload不为空","property":"payload","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":700,"y":640,"wires":[["30b61553fa3cd55f"]]},{"id":"e7dc642d6a2567cd","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":520,"wires":[["a81ed7ac1f4f3253"]]},{"id":"a81ed7ac1f4f3253","type":"change","z":"8430daf6e32c541b","name":"发送重置","rules":[{"t":"set","p":"reset","pt":"msg","to":"count","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":520,"wires":[["d6bdf48e72ee55d2","32b4a1692d68104a"]]},{"id":"d6bdf48e72ee55d2","type":"debug","z":"8430daf6e32c541b","name":"debug 46","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":360,"y":580,"wires":[]},{"id":"bb55a6644ac1a885","type":"debug","z":"8430daf6e32c541b","name":"debug 47","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":500,"y":680,"wires":[]},{"id":"557929b37ff70db9","type":"rbe","z":"8430daf6e32c541b","name":"温差","func":"deadbandEq","gap":"1","start":"","inout":"in","septopics":true,"property":"payload","topi":"topic","x":510,"y":320,"wires":[["9783bb68f4c3f971"]]},{"id":"8d9118c376549e26","type":"inject","z":"8430daf6e32c541b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":120,"wires":[["4462a279553831dd"]]},{"id":"4462a279553831dd","type":"change","z":"8430daf6e32c541b","name":"27","rules":[{"t":"set","p":"payload","pt":"msg","to":"27","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":120,"wires":[["2c89adc818b9dc7e"]]},{"id":"c9ce0c5e564bed0a","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]


回复

使用道具 举报

21

主题

523

帖子

3191

积分

论坛元老

Rank: 8Rank: 8

积分
3191
金钱
2668
HASS币
30
发表于 2024-9-25 21:39:10 | 显示全部楼层
poll节点设置1分钟间隔获取温度实体数值
回复

使用道具 举报

5

主题

21

帖子

120

积分

注册会员

Rank: 2

积分
120
金钱
99
HASS币
0
 楼主| 发表于 2024-9-25 22:30:13 | 显示全部楼层
wdmywm3 发表于 2024-9-25 21:39
poll节点设置1分钟间隔获取温度实体数值
谢谢你的支持。
可能是我的描述不准确,我增加了红色字部分。
回复

使用道具 举报

2

主题

136

帖子

2037

积分

金牌会员

Rank: 6Rank: 6

积分
2037
金钱
1901
HASS币
0
发表于 2024-9-26 00:23:37 | 显示全部楼层
为啥要那么复杂啊,直接用温度变动作触发就好了,例如大于33度持续1分钟就报警,直接用events:state 节点,然后后面接一个wait until 节点,等到温度下降到33度再发一次正常的信息
回复

使用道具 举报

40

主题

2176

帖子

8298

积分

元老级技术达人

积分
8298
金钱
6107
HASS币
110
发表于 2024-9-26 08:38:28 | 显示全部楼层
“温度正常范围:30--33度”
“每间隔1分钟检测一次,超过30度进行报警提示”
“目前做到:获取温度高于33度报警”
“恢复30度以下提示温度正常”

看看你在说什么?
我截取的4句能做到自洽吗?
回复

使用道具 举报

13

主题

51

帖子

450

积分

论坛分享达人

积分
450
金钱
399
HASS币
0
发表于 2024-9-26 10:08:36 | 显示全部楼层
这种需求,问gpt,一秒出答案了,直接给你贴出来流代码
回复

使用道具 举报

5

主题

21

帖子

120

积分

注册会员

Rank: 2

积分
120
金钱
99
HASS币
0
 楼主| 发表于 2024-9-26 16:38:48 | 显示全部楼层
ghostist 发表于 2024-9-26 08:38
“温度正常范围:30--33度”
“每间隔1分钟检测一次,超过30度进行报警提示”
“目前做到:获取温度高于33度 ...

表达错误了:
每间隔1分钟检测一次,超过33度进行报警提示
恢复33度以下提示温度正常
温度写错了。
回复

使用道具 举报

5

主题

21

帖子

120

积分

注册会员

Rank: 2

积分
120
金钱
99
HASS币
0
 楼主| 发表于 2024-9-26 17:29:47 | 显示全部楼层
gasment 发表于 2024-9-26 10:08
这种需求,问gpt,一秒出答案了,直接给你贴出来流代码

问了千问,效果一般啊。gpt好用吗?
回复

使用道具 举报

5

主题

21

帖子

120

积分

注册会员

Rank: 2

积分
120
金钱
99
HASS币
0
 楼主| 发表于 2024-9-27 20:56:59 | 显示全部楼层
本帖最后由 寒夜吟 于 2024-9-27 22:57 编辑
ghostist 发表于 2024-9-26 08:38
“温度正常范围:30--33度”
“每间隔1分钟检测一次,超过30度进行报警提示”
“目前做到:获取温度高于33度 ...

大佬 ~,帮我看看我的问题了,贴了代码。
谢谢
回复

使用道具 举报

40

主题

2176

帖子

8298

积分

元老级技术达人

积分
8298
金钱
6107
HASS币
110
发表于 2024-9-29 08:43:37 | 显示全部楼层
寒夜吟 发表于 2024-9-27 20:56
大佬 ~,帮我看看我的问题了,贴了代码。
谢谢

我又看了一遍你的帖子 还是看不懂你的需求
我估计千问 GPT可能也是不理解你的需求吧,所以才“效果一般”
抱歉 帮不上忙

给个建议:重新编辑你的帖子,把30 33搞清楚,上下文不要矛盾,再来提问
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-12-4 01:22 , Processed in 0.200704 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表