[{"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 这个值才有意义