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

 找回密码
 立即注册
楼主: lanhemeng

[教程系列] 通过Node-Red将小米空气净化器接入Homekit,彻底摆脱Homebridge

  [复制链接]

1

主题

64

帖子

1124

积分

金牌会员

Rank: 6Rank: 6

积分
1124
金钱
1060
HASS币
0
发表于 2021-8-19 08:42:19 | 显示全部楼层
[{"id":"16165073.43e1e","type":"subflow","name":"light.study_n","info":"","category":"object","in":[{"x":40,"y":80,"wires":[{"id":"76b47bf8.2fbabc"}]}],"out":[{"x":380,"y":40,"wires":[{"id":"76b47bf8.2fbabc","port":0}]}],"env":[],"color":"#FFCC66","icon":"font-awesome/fa-lightbulb-o","status":{"x":380,"y":100,"wires":[{"id":"76b47bf8.2fbabc","port":0}]}},{"id":"76b47bf8.2fbabc","type":"subflow:ba988f1e.59283","z":"16165073.43e1e","name":"light.study_nightlight","env":[{"name":"entity_id","value":"light.study_nightlight","type":"str"}],"x":200,"y":80,"wires":[[]]},{"id":"efdecd6.23a8b3","type":"subflow","name":"climate.study","info":"","category":"object","in":[{"x":40,"y":80,"wires":[{"id":"934b949a.512908"}]}],"out":[{"x":320,"y":40,"wires":[{"id":"934b949a.512908","port":0}]}],"env":[],"color":"#FFCC66","icon":"font-awesome/fa-snowflake-o","status":{"x":320,"y":100,"wires":[{"id":"934b949a.512908","port":0}]}},{"id":"934b949a.512908","type":"subflow:ba988f1e.59283","z":"efdecd6.23a8b3","name":"climate.study","env":[{"name":"entity_id","value":"climate.study","type":"str"}],"x":170,"y":80,"wires":[[]]},{"id":"cb9f50c5.1edb6","type":"subflow","name":"button","info":"","category":"","in":[],"out":[{"x":720,"y":100,"wires":[{"id":"6db94a21.316f44","port":0}]},{"x":720,"y":140,"wires":[{"id":"6db94a21.316f44","port":1}]},{"x":720,"y":180,"wires":[{"id":"6db94a21.316f44","port":2}]},{"x":720,"y":220,"wires":[{"id":"6db94a21.316f44","port":3}]}],"env":[{"name":"entity_id","type":"str","value":""}],"color":"#FDF0C2","icon":"node-red-contrib-cast/google-home-mini2.svg"},{"id":"6db94a21.316f44","type":"function","z":"cb9f50c5.1edb6","name":"button","func":"var entity_id = env.get("entity_id");\nvar time = msg.mytimes;\nvar clickMsg={entity_id:msg.payload.entity_id};\nif(msg.payload.entity_id == entity_id)\n{\n    var statusMsg = {payload:{text:msg.payload.event.click_type + "@" + time}};\n    switch(msg.payload.event.click_type)\n    {\n        case "single":\n            return [clickMsg, null, null, statusMsg];\n        case "double":\n            return [null, clickMsg, null, statusMsg];\n        case "long_click_press":\n            return [null, null, clickMsg, statusMsg];\n            \n    }\n}","outputs":4,"noerr":0,"initialize":"","finalize":"","x":570,"y":160,"wires":[[],[],[],[]],"icon":"node-red-contrib-time-range-switch/switch.png"},{"id":"e6ee65b.0d6e418","type":"server-events","z":"cb9f50c5.1edb6","name":"","server":"9827bb1a.d22488","version":1,"event_type":"xiaomi_aqara.click","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData("eventData").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData("eventData").event_type","valueType":"jsonata"}],"x":190,"y":160,"wires":[["294742f3.a985d6"]]},{"id":"294742f3.a985d6","type":"simpletime","z":"cb9f50c5.1edb6","name":"","mydate":false,"myymd":false,"myyear":false,"mymonth":false,"mymonthn":false,"mydom":false,"mydoy":false,"myday":false,"myhourpm":false,"myhour":false,"mytime":false,"mytimes":true,"myminute":false,"myminutes":false,"mysecond":false,"mymillis":false,"myepoch":false,"myrawdate":false,"mypm":false,"x":410,"y":160,"wires":[["6db94a21.316f44"]]},{"id":"295735e5.862b72","type":"subflow","name":"btn.study","info":"","category":"trigger","in":[],"out":[{"x":340,"y":20,"wires":[{"id":"2a39be00.4c6c92","port":0}]},{"x":340,"y":60,"wires":[{"id":"2a39be00.4c6c92","port":1}]},{"x":340,"y":100,"wires":[{"id":"2a39be00.4c6c92","port":2}]}],"env":[],"color":"#FDF0C2","icon":"node-red-contrib-cast/google-home-mini2.svg","status":{"x":340,"y":140,"wires":[{"id":"2a39be00.4c6c92","port":3}]}},{"id":"2a39be00.4c6c92","type":"subflow:cb9f50c5.1edb6","z":"295735e5.862b72","name":"btn.study","env":[{"name":"entity_id","value":"binary_sensor.switch_158d0001c30ce6","type":"str"}],"x":200,"y":80,"wires":[[],[],[],[]]},{"id":"ba988f1e.59283","type":"subflow","name":"object","info":"","category":"","in":[{"x":80,"y":80,"wires":[{"id":"a9ba7ec.497588"}]}],"out":[{"x":320,"y":40,"wires":[{"id":"a9ba7ec.497588","port":0}]}],"env":[{"name":"entity_id","type":"str","value":""}],"color":"#E2D96E","icon":"node-red-contrib-influxdb/influxdb.png","status":{"x":320,"y":120,"wires":[{"id":"a9ba7ec.497588","port":0}]}},{"id":"a9ba7ec.497588","type":"function","z":"ba988f1e.59283","name":"object","func":"var entity_id = env.get("entity_id");\nmsg.payload = \n{\n    "entity_id":entity_id,\n    "data":{"entity_id":entity_id},\n    "text":entity_id\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":190,"y":80,"wires":[[]]},{"id":"5e9f2a58.663784","type":"subflow","name":"light.study","info":"","category":"object","in":[{"x":60,"y":80,"wires":[{"id":"dffb66c9.5dd1a8"}]}],"out":[{"x":340,"y":40,"wires":[{"id":"dffb66c9.5dd1a8","port":0}]}],"env":[],"color":"#FFCC66","icon":"font-awesome/fa-lightbulb-o","status":{"x":340,"y":100,"wires":[{"id":"dffb66c9.5dd1a8","port":0}]}},{"id":"dffb66c9.5dd1a8","type":"subflow:ba988f1e.59283","z":"5e9f2a58.663784","name":"light.study","env":[{"name":"entity_id","value":"light.study","type":"str"}],"x":190,"y":80,"wires":[[]]},{"id":"7fc2ca.d817f538","type":"subflow","name":"hass.turn_off","info":"","category":"action","in":[{"x":60,"y":140,"wires":[{"id":"9b19003f.6352b8"}]}],"out":[],"env":[],"color":"#E6E0F8"},{"id":"9b19003f.6352b8","type":"api-call-service","z":"7fc2ca.d817f538","name":"","server":"9827bb1a.d22488","version":3,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"","data":"","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":260,"y":140,"wires":[[]]},{"id":"3e76a22a.20d006","type":"subflow","name":"light.toggle","info":"","category":"action","in":[{"x":60,"y":120,"wires":[{"id":"f6d3a44a.9670e8"}]}],"out":[],"env":[],"color":"#E6E0F8"},{"id":"f6d3a44a.9670e8","type":"function","z":"3e76a22a.20d006","name":"nightlight","func":"node.entity_id = msg.payload.entity_id + "_nightlight"\nmsg.payload = \n{\n    "entity_id":node.entity_id,\n    "data":{"entity_id":node.entity_id},\n    "origin":msg.payload.entity_id\n}\nnode.status({text:msg.payload.origin});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":200,"y":120,"wires":[["606fe53e.9c82e4"]]},{"id":"606fe53e.9c82e4","type":"api-current-state","z":"3e76a22a.20d006","name":"state_is_on","server":"9827bb1a.d22488","version":2,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"","state_type":"str","blockInputOverrides":false,"outputProperties":[],"x":350,"y":120,"wires":[["4f19589f.a2718"],["edee9cb1.aa442"]]},{"id":"1be61706.bcd3d1","type":"subflow:c6d00a58.333bc8","z":"3e76a22a.20d006","name":"","env":[],"x":650,"y":160,"wires":[]},{"id":"4f19589f.a2718","type":"subflow:7fc2ca.d817f538","z":"3e76a22a.20d006","name":"","env":[],"x":520,"y":80,"wires":[]},{"id":"edee9cb1.aa442","type":"function","z":"3e76a22a.20d006","name":"origin","func":"node.entity_id = msg.payload.origin\nmsg.payload = \n{\n    "entity_id":node.entity_id,\n    "data":{"entity_id":node.entity_id}\n}\nnode.status({text:node.entity_id});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":160,"wires":[["1be61706.bcd3d1"]]},{"id":"c6d00a58.333bc8","type":"subflow","name":"hass.toggle","info":"","category":"action","in":[{"x":60,"y":80,"wires":[{"id":"c86d532f.955628"}]}],"out":[],"env":[],"color":"#E6E0F8"},{"id":"c86d532f.955628","type":"api-call-service","z":"c6d00a58.333bc8","name":"toggle","server":"9827bb1a.d22488","version":3,"debugenabled":false,"service_domain":"homeassistant","service":"toggle","entityId":"","data":"","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":190,"y":80,"wires":[[]]},{"id":"4052db18.d9064c","type":"subflow","name":"climate.toggle","info":"","category":"action","in":[{"x":40,"y":100,"wires":[{"id":"44109253.157b6c"}]}],"out":[],"env":[],"color":"#E6E0F8"},{"id":"4bc1d9c7.6e5b2","type":"api-call-service","z":"4052db18.d9064c","name":"ac.turn_on","server":"9827bb1a.d22488","version":3,"debugenabled":false,"service_domain":"climate","service":"turn_on","entityId":"","data":"","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":450,"y":80,"wires":[[]]},{"id":"44109253.157b6c","type":"api-current-state","z":"4052db18.d9064c","name":"hass.is_off","server":"9827bb1a.d22488","version":2,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"","state_type":"str","blockInputOverrides":false,"outputProperties":[],"x":190,"y":100,"wires":[["4bc1d9c7.6e5b2"],["9aa164aa.ab4d8"]]},{"id":"9aa164aa.ab4d8","type":"api-call-service","z":"4052db18.d9064c","name":"ac.turn_off","server":"9827bb1a.d22488","version":3,"debugenabled":false,"service_domain":"climate","service":"turn_off","entityId":"","data":"","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":450,"y":120,"wires":[[]]},{"id":"9827bb1a.d22488","type":"server","name":"hass","version":1,"legacy":true,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"820160d5.2d903","type":"tab","label":"studyroom","disabled":false,"info":""},{"id":"c69fb13f.147868","type":"group","z":"820160d5.2d903","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["89b167c5.9a1778","a275d0f6.49b068","f4f511df.f78ae","e524ff4f.2e125","62af9a38.66873c","c5cd7675.209138","12118e8.d0e9872"],"x":14,"y":19,"w":632,"h":202},{"id":"89b167c5.9a1778","type":"subflow:4052db18.d9064c","z":"820160d5.2d903","g":"c69fb13f.147868","name":"","env":[],"x":540,"y":180,"wires":[]},{"id":"a275d0f6.49b068","type":"subflow:c6d00a58.333bc8","z":"820160d5.2d903","g":"c69fb13f.147868","name":"","env":[],"x":530,"y":120,"wires":[]},{"id":"f4f511df.f78ae","type":"subflow:3e76a22a.20d006","z":"820160d5.2d903","g":"c69fb13f.147868","name":"","env":[],"x":530,"y":60,"wires":[]},{"id":"e524ff4f.2e125","type":"subflow:5e9f2a58.663784","z":"820160d5.2d903","g":"c69fb13f.147868","name":"","env":[],"x":330,"y":60,"wires":[["f4f511df.f78ae"]]},{"id":"62af9a38.66873c","type":"subflow:295735e5.862b72","z":"820160d5.2d903","g":"c69fb13f.147868","name":"","x":100,"y":120,"wires":[["e524ff4f.2e125"],["12118e8.d0e9872"],["c5cd7675.209138"]]},{"id":"c5cd7675.209138","type":"subflow:efdecd6.23a8b3","z":"820160d5.2d903","g":"c69fb13f.147868","name":"","x":330,"y":180,"wires":[["89b167c5.9a1778"]]},{"id":"12118e8.d0e9872","type":"subflow:16165073.43e1e","z":"820160d5.2d903","g":"c69fb13f.147868","name":"","env":[],"x":330,"y":120,"wires":[["a275d0f6.49b068"]]}]
回复

使用道具 举报

0

主题

1

帖子

17

积分

新手上路

Rank: 1

积分
17
金钱
16
HASS币
0
发表于 2021-8-30 23:28:23 | 显示全部楼层
感謝大大地無私分享
回复

使用道具 举报

0

主题

5

帖子

52

积分

注册会员

Rank: 2

积分
52
金钱
47
HASS币
0
发表于 2021-9-9 19:59:28 | 显示全部楼层
感谢分享
回复

使用道具 举报

0

主题

6

帖子

44

积分

新手上路

Rank: 1

积分
44
金钱
38
HASS币
0
发表于 2021-9-9 21:32:32 | 显示全部楼层
学习一下接入方法
回复

使用道具 举报

1

主题

5

帖子

68

积分

注册会员

Rank: 2

积分
68
金钱
63
HASS币
0
发表于 2021-10-9 22:16:10 | 显示全部楼层
学习学习
回复

使用道具 举报

0

主题

9

帖子

93

积分

注册会员

Rank: 2

积分
93
金钱
84
HASS币
0
发表于 2021-10-13 21:14:43 | 显示全部楼层
这个真的可以吗
回复

使用道具 举报

1

主题

51

帖子

349

积分

中级会员

Rank: 3Rank: 3

积分
349
金钱
298
HASS币
0
发表于 2021-10-14 00:12:51 | 显示全部楼层
学习学习666
回复

使用道具 举报

0

主题

8

帖子

30

积分

新手上路

Rank: 1

积分
30
金钱
22
HASS币
0
发表于 2021-10-28 00:46:51 | 显示全部楼层
研究一下这个方案
回复

使用道具 举报

0

主题

3

帖子

26

积分

新手上路

Rank: 1

积分
26
金钱
23
HASS币
0
发表于 2021-10-29 11:39:18 | 显示全部楼层
感谢学习
回复

使用道具 举报

0

主题

12

帖子

190

积分

注册会员

Rank: 2

积分
190
金钱
178
HASS币
0
发表于 2021-11-3 01:19:24 来自手机 | 显示全部楼层
感谢楼主分享
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-22 11:14 , Processed in 1.157807 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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