Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{"id":"99fff3d2.09c48","type":"comment","z":"db1f005d.29aa4","name":"DUMB FLOOR FAN","info":"","x":1450,"y":60,"wires":[]},{"id":"81ef3b09.03b408","type":"server-state-changed","z":"db1f005d.29aa4","name":"Fan Sensor","server":"8ac3cd7f.58d3e","entityidfilter":"sensor.fan_speed_actual","entityidfiltertype":"substring","haltifstate":"","x":1430,"y":220,"wires":[["9d815ef6.f7fe2"]]},{"id":"e2fe0953.4177b8","type":"comment","z":"db1f005d.29aa4","name":"Match Actual State to MQTT Fan Entity","info":"","x":1510,"y":120,"wires":[]},{"id":"9d815ef6.f7fe2","type":"switch","z":"db1f005d.29aa4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Off","vt":"str"},{"t":"eq","v":"Low","vt":"str"},{"t":"eq","v":"Medium","vt":"str"},{"t":"eq","v":"High","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":1620,"y":220,"wires":[["da7e3fe0.9ff65"],["51897813.df3b38","6f4b42fd.03d19c"],["51897813.df3b38","1dbd1036.08323"],["51897813.df3b38","4a434fb.49043b"]]},{"id":"32494884.2a2658","type":"mqtt out","z":"db1f005d.29aa4","name":"OFF","topic":"floor_fan/on/state","qos":"","retain":"","broker":"beaef00f.f9378","x":2030,"y":120,"wires":[]},{"id":"27416167.bb7c8e","type":"mqtt out","z":"db1f005d.29aa4","name":"ON","topic":"floor_fan/on/state","qos":"","retain":"","broker":"beaef00f.f9378","x":2030,"y":160,"wires":[]},{"id":"92216381.878dc","type":"mqtt out","z":"db1f005d.29aa4","name":"LOW","topic":"floor_fan/speed/state","qos":"","retain":"","broker":"beaef00f.f9378","x":2030,"y":240,"wires":[]},{"id":"f1bf1cf5.afef4","type":"mqtt out","z":"db1f005d.29aa4","name":"MEDIUM","topic":"floor_fan/speed/state","qos":"","retain":"","broker":"beaef00f.f9378","x":2040,"y":280,"wires":[]},{"id":"ce446b4c.54f7b8","type":"mqtt out","z":"db1f005d.29aa4","name":"HIGH","topic":"floor_fan/speed/state","qos":"","retain":"","broker":"beaef00f.f9378","x":2030,"y":320,"wires":[]},{"id":"da7e3fe0.9ff65","type":"change","z":"db1f005d.29aa4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1840,"y":120,"wires":[["32494884.2a2658"]]},{"id":"51897813.df3b38","type":"change","z":"db1f005d.29aa4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1840,"y":160,"wires":[["27416167.bb7c8e"]]},{"id":"6f4b42fd.03d19c","type":"change","z":"db1f005d.29aa4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"low","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1840,"y":240,"wires":[["92216381.878dc"]]},{"id":"1dbd1036.08323","type":"change","z":"db1f005d.29aa4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"medium","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1840,"y":280,"wires":[["f1bf1cf5.afef4"]]},{"id":"4a434fb.49043b","type":"change","z":"db1f005d.29aa4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"high","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1840,"y":320,"wires":[["ce446b4c.54f7b8"]]},{"id":"2c4441ab.a246ae","type":"comment","z":"db1f005d.29aa4","name":"Send On/Off Commands to IR","info":"","x":1480,"y":400,"wires":[]},{"id":"58813268.bd8c6c","type":"mqtt in","z":"db1f005d.29aa4","name":"","topic":"floor_fan/on/set","qos":"2","broker":"beaef00f.f9378","x":1440,"y":460,"wires":[["8f883ffa.a1ed1"]]},{"id":"8f883ffa.a1ed1","type":"switch","z":"db1f005d.29aa4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"true","vt":"str"},{"t":"eq","v":"false","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1610,"y":460,"wires":[["2c6b4475.4f142c"],["137a4161.8cde0f"]]},{"id":"2c6b4475.4f142c","type":"api-current-state","z":"db1f005d.29aa4","name":"Actual Fan State","server":"8ac3cd7f.58d3e","halt_if":"","entity_id":"sensor.fan_speed_actual","x":1790,"y":400,"wires":[["4b04ad66.430714"]]},{"id":"137a4161.8cde0f","type":"api-current-state","z":"db1f005d.29aa4","name":"Actual Fan State","server":"8ac3cd7f.58d3e","halt_if":"","entity_id":"sensor.fan_speed_actual","x":1790,"y":500,"wires":[["bb02c812.b0c378"]]},{"id":"4b04ad66.430714","type":"switch","z":"db1f005d.29aa4","name":"If Fan is Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1790,"y":440,"wires":[["35083b82.f4f4c4"]]},{"id":"35083b82.f4f4c4","type":"api-call-service","z":"db1f005d.29aa4","name":"Toggle Fan Power (IR)","server":"8ac3cd7f.58d3e","service_domain":"script","service":"fan_power_toggle","data":"","mergecontext":"","x":2080,"y":420,"wires":[[]]},{"id":"bb02c812.b0c378","type":"switch","z":"db1f005d.29aa4","name":"If Fan is On","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1790,"y":540,"wires":[["2604bc40.0515d4"]]},{"id":"2604bc40.0515d4","type":"api-call-service","z":"db1f005d.29aa4","name":"Toggle Fan Power (IR)","server":"8ac3cd7f.58d3e","service_domain":"script","service":"fan_power_toggle","data":"","mergecontext":"","x":2080,"y":520,"wires":[[]]},{"id":"7ce0569c.d88748","type":"mqtt in","z":"db1f005d.29aa4","name":"","topic":"floor_fan/speed/set","qos":"2","broker":"beaef00f.f9378","x":1450,"y":680,"wires":[["3467825b.7ca8be","dd878389.06e59"]]},{"id":"3467825b.7ca8be","type":"api-current-state","z":"db1f005d.29aa4","name":"Actual Fan State","server":"8ac3cd7f.58d3e","halt_if":"","entity_id":"sensor.fan_speed_actual","x":1670,"y":760,"wires":[["dd878389.06e59"]]},{"id":"dd878389.06e59","type":"join","z":"db1f005d.29aa4","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1710,"y":680,"wires":[["ce91a560.038718"]]},{"id":"ce91a560.038718","type":"function","z":"db1f005d.29aa4","name":"Here to There","func":"newmsg = {};\n\ncurrentSpeed = msg.payload[\"sensor.fan_speed_actual\"].toLowerCase();\ndesiredSpeed = msg.payload[\"floor_fan/speed/set\"].toLowerCase();\n\nif (currentSpeed == desiredSpeed) {\n newmsg.payload = 0;\n}\nelse if (currentSpeed == \"low\" && desiredSpeed == \"medium\") {\n newmsg.payload = 1;\n}\nelse if (currentSpeed == \"high\" && desiredSpeed == \"low\") {\n newmsg.payload = 1;\n}\nelse if (currentSpeed == \"low\" && desiredSpeed == \"high\") {\n newmsg.payload = 2;\n}\nelse if (currentSpeed == \"medium\" && desiredSpeed == \"high\") {\n newmsg.payload = 1;\n}\nelse if (currentSpeed == \"medium\" && desiredSpeed == \"low\") {\n newmsg.payload = 2;\n}\nelse if (currentSpeed == \"high\" && desiredSpeed == \"medium\") {\n newmsg.payload = 2;\n}\nelse {\n newmsg.payload = \"???? Current \" + currentSpeed + \" Desired \" + desiredSpeed;\n}\n\nreturn newmsg;","outputs":1,"noerr":0,"x":1920,"y":680,"wires":[["74db3b25.d594d4"]]},{"id":"31c6999e.7d1956","type":"comment","z":"db1f005d.29aa4","name":"How Many Toggles?","info":"","x":1910,"y":620,"wires":[]},{"id":"46ac0cc3.08bd04","type":"comment","z":"db1f005d.29aa4","name":"Send Speed Changes to IR","info":"","x":1470,"y":620,"wires":[]},{"id":"74db3b25.d594d4","type":"switch","z":"db1f005d.29aa4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1930,"y":720,"wires":[["466a9bc9.9743a4"],["c46f4fae.31688"]]},{"id":"466a9bc9.9743a4","type":"api-call-service","z":"db1f005d.29aa4","name":"Toggle Fan Speed (IR)","server":"8ac3cd7f.58d3e","service_domain":"script","service":"fan_speed_toggle","data":"","mergecontext":"","x":2220,"y":680,"wires":[[]]},{"id":"c46f4fae.31688","type":"api-call-service","z":"db1f005d.29aa4","name":"Toggle Fan Speed (IR)","server":"8ac3cd7f.58d3e","service_domain":"script","service":"fan_speed_toggle","data":"","mergecontext":"","x":2220,"y":740,"wires":[["b0712147.039c3"]]},{"id":"b0712147.039c3","type":"delay","z":"db1f005d.29aa4","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2220,"y":780,"wires":[["ba7c99c2.1ad518"]]},{"id":"ba7c99c2.1ad518","type":"api-call-service","z":"db1f005d.29aa4","name":"Toggle Fan Speed (IR)","server":"8ac3cd7f.58d3e","service_domain":"script","service":"fan_speed_toggle","data":"","mergecontext":"","x":2220,"y":820,"wires":[[]]},{"id":"8ac3cd7f.58d3e","type":"server","z":"","name":"Home Assistant","url":"https://HASS_URL","pass":"YOUR_PASSWORD"},{"id":"beaef00f.f9378","type":"mqtt-broker","z":"","name":"MQTT","broker":"mosquitto","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement