先锋直流变频风扇接入homekit
使用node-red控制红外遥控器,控制风扇
安装
1.node-red安装插件 node-red-contrib-homekit-bridged
2.红外遥控器接入ha,可供node-red调服务, 我使用的是黑豆mini3
node-red流
[{"id":"cbd987c8.bf4098","type":"homekit-service","z":"fd58cee.fbdb73","isParent":true,"hostType":"0","bridge":"1e41ab28.618145","accessoryId":"","parentService":"","name":"先锋风扇","serviceName":"Fanv2","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.3.4","serialNo":"Default Serial Number","firmwareRev":"1.3.4","hardwareRev":"1.3.4","softwareRev":"1.3.4","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":2,"x":260,"y":1000,"wires":[["31d5f5e6.27138a","7d2f6a80.d81804"],[]]},{"id":"fd1b5230.f74ce","type":"api-call-service","z":"fd58cee.fbdb73","name":"ON/OFF","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"on_off\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":780,"y":1000,"wires":[[]]},{"id":"2204927d.a374be","type":"api-call-service","z":"fd58cee.fbdb73","name":"swing","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"swing_on_off\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":990,"y":1180,"wires":[[]]},{"id":"31d5f5e6.27138a","type":"switch","z":"fd58cee.fbdb73","name":"","property":"payload","propertyType":"msg","rules":[{"t":"hask","v":"RotationSpeed","vt":"str"},{"t":"hask","v":"On","vt":"str"},{"t":"hask","v":"SwingMode","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":450,"y":1000,"wires":[["77911b8e.a8be34"],["fd1b5230.f74ce"],["700ad3b4.cd37fc"]]},{"id":"ed83c7fc.b7cf38","type":"api-call-service","z":"fd58cee.fbdb73","name":"swing","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"swing_on_off\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":870,"y":1100,"wires":[[]]},{"id":"33053bdf.73ca64","type":"api-call-service","z":"fd58cee.fbdb73","name":"swing","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"swing_on_off\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1010,"y":1100,"wires":[[]]},{"id":"4fb26123.1a323","type":"api-call-service","z":"fd58cee.fbdb73","name":"swing","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"swing_on_off\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1150,"y":1100,"wires":[[]]},{"id":"6a9f902c.e749a","type":"api-call-service","z":"fd58cee.fbdb73","name":"swing","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"swing_on_off\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1310,"y":1100,"wires":[[]]},{"id":"c08bb7cb.8c1cd8","type":"api-call-service","z":"fd58cee.fbdb73","name":"speed","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"speed\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":970,"y":880,"wires":[[]]},{"id":"700ad3b4.cd37fc","type":"switch","z":"fd58cee.fbdb73","name":"Swing ON/OFF","property":"payload.SwingMode","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":660,"y":1140,"wires":[["ed83c7fc.b7cf38","33053bdf.73ca64","4fb26123.1a323","6a9f902c.e749a"],["2204927d.a374be"]]},{"id":"77911b8e.a8be34","type":"switch","z":"fd58cee.fbdb73","name":"Spead","property":"hap.oldValue","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"gt","v":"hap.newValue","vt":"msg"},{"t":"lt","v":"hap.newValue","vt":"msg"}],"checkall":"false","repair":false,"outputs":3,"x":610,"y":880,"wires":[[],["6b9b14d8.96234c","8273c93d.711d18","46e68b5e.d55e44"],["c08bb7cb.8c1cd8"]]},{"id":"6b9b14d8.96234c","type":"api-call-service","z":"fd58cee.fbdb73","name":"speed","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"speed\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":870,"y":820,"wires":[[]]},{"id":"8273c93d.711d18","type":"api-call-service","z":"fd58cee.fbdb73","name":"speed","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"speed\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":990,"y":820,"wires":[[]]},{"id":"46e68b5e.d55e44","type":"api-call-service","z":"fd58cee.fbdb73","name":"speed","server":"bd2aed9c.63709","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.zhi_neng_yao_kong_remote","data":"{\t \"entity_id\": \"remote.zhi_neng_yao_kong_remote\",\t \"device\": \"xianfeng_fan\",\t \"command\": \"speed\"\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1110,"y":820,"wires":[[]]},{"id":"d0b8c988.8cd858","type":"comment","z":"fd58cee.fbdb73","name":"开关","info":"","x":630,"y":960,"wires":[]},{"id":"fb7cd091.7b25d","type":"comment","z":"fd58cee.fbdb73","name":"速度调节","info":"","x":660,"y":820,"wires":[]},{"id":"193a993e.8af407","type":"comment","z":"fd58cee.fbdb73","name":"速度降低一级,滴滴滴三下","info":"","x":1010,"y":780,"wires":[]},{"id":"a8c63118.011c3","type":"comment","z":"fd58cee.fbdb73","name":"速度升高一级,滴一下","info":"","x":1000,"y":920,"wires":[]},{"id":"128b3d70.a181f3","type":"comment","z":"fd58cee.fbdb73","name":"180摇头,滴滴滴滴四下","info":"","x":1040,"y":1060,"wires":[]},{"id":"12fe6083.5a5e6f","type":"comment","z":"fd58cee.fbdb73","name":"关闭摇头,滴一下","info":"","x":1038,"y":1213,"wires":[]},{"id":"7d2f6a80.d81804","type":"debug","z":"fd58cee.fbdb73","name":"Fan output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":900,"wires":[]},{"id":"2eca8792.b49f58","type":"comment","z":"fd58cee.fbdb73","name":"摇摆模式","info":"","x":640,"y":1100,"wires":[]},{"id":"1e41ab28.618145","type":"homekit-bridge","bridgeName":"fan bridge","pinCode":"529-82-423","port":"","advertiser":"bonjour-hap","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"1.3.4","serialNo":"Default Serial Number","firmwareRev":"1.3.4","hardwareRev":"1.3.4","softwareRev":"1.3.4","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"192.168.100.1","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true},{"id":"bd2aed9c.63709","type":"server","name":"Home Assistant","addon":true}]
修改蓝色接口,调整为自己的红外服务节点
homekit 配置
部属node-red节点后,在iphone的homekit里扫开 添加配件
点击没有代码或无法扫描
正常情况,bridge
会显示出来,输入node-red中的8位数字就能成功添加
hi siri, 打开风扇
就能使用了
node-red-contrib-homekit-bridged
node-red-contrib-homekit-bridged 支持所有的homekit category, 可以使用类似的方法接入别的设备