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

 找回密码
 立即注册
12
返回列表 发新帖
楼主: innx

[流程系列] 【已解决】做了一个永远关不掉的感应灯

[复制链接]

21

主题

179

帖子

2470

积分

论坛DIY达人

积分
2470
金钱
2286
HASS币
30
 楼主| 发表于 2021-1-11 23:52:16 | 显示全部楼层
hunterfox 发表于 2021-1-11 22:36
closetime 是我设定的一个变量,当你关开关时, 就会对closetime 进行赋值,XX秒后再赋另一个值。  在人 ...

果然是大佬,对的对的就是这样,关开关时进行赋值,然后在人体传感器流程中对这个值进行判断。
是我学艺不精研究了1个小时这个判断还是走不通,还得麻烦有空帮忙看看。感谢感谢

POWER3是人体传感器检测到人的信号,就是closetime判断用的switch这个走不通

[{"id":"e447781.5a6d988","type":"trigger","z":"d40593df.a9b03","name":"封闭时间","op1":"0","op2":"1","op1type":"str","op2type":"str","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":520,"y":2420,"wires":[["add623e9.104b2","b82cc95d.dcad58"]]},{"id":"57cd6820.44a0a8","type":"server-state-changed","z":"d40593df.a9b03","name":"按键开关","server":"18668ea5.b519c1","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.wei_sheng_jian_deng","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":220,"y":2420,"wires":[["99075dbd.e551d"],[]]},{"id":"add623e9.104b2","type":"change","z":"d40593df.a9b03","name":"","rules":[{"t":"set","p":"closetime","pt":"flow","to":"payload1","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":2420,"wires":[["d1d697.4b2b4968","6230b73a.9a1288"]]},{"id":"99075dbd.e551d","type":"switch","z":"d40593df.a9b03","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":2420,"wires":[["e447781.5a6d988"]]},{"id":"b82cc95d.dcad58","type":"debug","z":"d40593df.a9b03","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":2480,"wires":[]},{"id":"820cc4fd.0575c8","type":"inject","z":"d40593df.a9b03","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":230,"y":2480,"wires":[["99075dbd.e551d"]]},{"id":"d1d697.4b2b4968","type":"debug","z":"d40593df.a9b03","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":950,"y":2480,"wires":[]},{"id":"75b8b093.df97f","type":"api-call-service","z":"d40593df.a9b03","name":"卫生间灯开","server":"18668ea5.b519c1","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.wei_sheng_jian_deng","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":990,"y":2340,"wires":[["5bbdf40.d8af40c"]]},{"id":"409bf3de.2aaa1c","type":"switch","z":"d40593df.a9b03","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":2320,"wires":[["53dd6a85.243b64"]]},{"id":"64b1700a.013ff","type":"mqtt in","z":"d40593df.a9b03","name":"","topic":"cmnd/tasmota_EF82BE/POWER3","qos":"2","datatype":"auto","broker":"36c984ba.5428ec","x":420,"y":2280,"wires":[["409bf3de.2aaa1c","216f9af2.d3b126"]]},{"id":"216f9af2.d3b126","type":"debug","z":"d40593df.a9b03","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":2260,"wires":[]},{"id":"b92dabc1.800c58","type":"inject","z":"d40593df.a9b03","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":510,"y":2340,"wires":[["409bf3de.2aaa1c"]]},{"id":"6230b73a.9a1288","type":"function","z":"d40593df.a9b03","name":"","func":"msg.payload = msg.payload1\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":910,"y":2420,"wires":[[]]},{"id":"53dd6a85.243b64","type":"switch","z":"d40593df.a9b03","name":"","property":"closetime","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":820,"y":2340,"wires":[["75b8b093.df97f"],[]]},{"id":"5bbdf40.d8af40c","type":"debug","z":"d40593df.a9b03","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1170,"y":2340,"wires":[]},{"id":"18668ea5.b519c1","type":"server","z":"","name":".7.7-Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"36c984ba.5428ec","type":"mqtt-broker","z":"","name":"","broker":"192.168.7.7","port":"1883","clientid":"Node-red","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"2","birthPayload":"","closeTopic":"","closeQos":"2","closePayload":"","willTopic":"","willQos":"2","willPayload":""}]




回复

使用道具 举报

43

主题

412

帖子

3806

积分

元老级技术达人

积分
3806
金钱
3389
HASS币
136
发表于 2021-1-12 09:31:57 | 显示全部楼层
[{"id":"32e60761.dc2758","type":"trigger","z":"86e04a84.9d1278","op1":"0","op2":"1","op1type":"str","op2type":"str","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"封闭时间","x":500,"y":1840,"wires":[["eebd9692.01d9f8","2ee4b04d.e9872"]]},{"id":"94a3893c.4732a8","type":"server-state-changed","z":"86e04a84.9d1278","name":"按键开关","server":"b9c9a101.8b6bc","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.wei_sheng_jian_deng","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":200,"y":1840,"wires":[["e6d51739.af9628"],[]]},{"id":"eebd9692.01d9f8","type":"change","z":"86e04a84.9d1278","name":"","rules":[{"t":"set","p":"closetime","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":1840,"wires":[["a1de4a5a.ad02d8"]]},{"id":"e6d51739.af9628","type":"switch","z":"86e04a84.9d1278","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":1840,"wires":[["32e60761.dc2758"]]},{"id":"2ee4b04d.e9872","type":"debug","z":"86e04a84.9d1278","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":1900,"wires":[]},{"id":"a21dccd4.b6019","type":"inject","z":"86e04a84.9d1278","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":1900,"wires":[["e6d51739.af9628"]]},{"id":"a1de4a5a.ad02d8","type":"debug","z":"86e04a84.9d1278","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":930,"y":1900,"wires":[]},{"id":"63a2e0c1.5f2c2","type":"api-call-service","z":"86e04a84.9d1278","name":"卫生间灯开","server":"b9c9a101.8b6bc","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.wei_sheng_jian_deng","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":950,"y":1760,"wires":[["7fa2a1a7.2a1c7"]]},{"id":"4db3b06d.96d24","type":"mqtt in","z":"86e04a84.9d1278","name":"","topic":"cmnd/tasmota_EF82BE/POWER3","qos":"2","datatype":"auto","broker":"3ba861ee.9e20be","x":340,"y":1700,"wires":[["c42d2d24.3702d","f1e15eff.3fea8"]]},{"id":"c42d2d24.3702d","type":"debug","z":"86e04a84.9d1278","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":1680,"wires":[]},{"id":"d36e8ab6.0d3778","type":"inject","z":"86e04a84.9d1278","name":"","topic":"","payload":"ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":1760,"wires":[["f1e15eff.3fea8"]]},{"id":"f1e15eff.3fea8","type":"switch","z":"86e04a84.9d1278","name":"","property":"closetime","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":790,"y":1760,"wires":[["63a2e0c1.5f2c2"],[]]},{"id":"7fa2a1a7.2a1c7","type":"debug","z":"86e04a84.9d1278","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":970,"y":1700,"wires":[]},{"id":"b9c9a101.8b6bc","type":"server","z":"","name":".7.7-Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"3ba861ee.9e20be","type":"mqtt-broker","z":"","name":"","broker":"192.168.7.7","port":"1883","clientid":"Node-red","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"2","birthPayload":"","closeTopic":"","closeQos":"2","closePayload":"","willTopic":"","willQos":"2","willPayload":""}]
你流当中有几个错误。    我改好了。测试正常了。  你先要对 closetime进行赋值。也就是先进行按键操作。操作完了closetime就有状态了。 switch 里面取closetime 这个值才有意义

评分

参与人数 1金钱 +5 收起 理由
innx + 5 厉害了word楼主!

查看全部评分

回复

使用道具 举报

21

主题

179

帖子

2470

积分

论坛DIY达人

积分
2470
金钱
2286
HASS币
30
 楼主| 发表于 2021-1-12 18:34:55 | 显示全部楼层
hunterfox 发表于 2021-1-12 09:31
你流当中有几个错误。    我改好了。测试正常了。  你先要对 closetime进行赋值。也就是先进行按键操作。操 ...

非常感谢!已经完美实现想要的效果!论坛有你们真的太好了。学到了switch原来还可以这么用,还是得多学习案例啊
回复

使用道具 举报

22

主题

319

帖子

3925

积分

论坛元老

Rank: 8Rank: 8

积分
3925
金钱
3601
HASS币
30
发表于 2022-1-1 22:30:09 | 显示全部楼层
hunterfox 发表于 2021-1-12 09:31
你流当中有几个错误。    我改好了。测试正常了。  你先要对 closetime进行赋值。也就是先进行按键操作。操 ...

学习了,closetime这个很有用!
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-22 02:58 , Processed in 0.129097 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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