HomeKit to MQTT v1
Allows control of MQTT smart switches and devices through HomeKit.
This example is a simple On/Off for a ceiling light and ceiling fan controller running Tasmota on an ESP-01.
Make sure to update MQTT Broker IP Address and Port number as necessary.
[{"id":"14120fe5.c9127","type":"switch","z":"4aac43bc.7854ec","name":"","property":"hap.newValue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":420,"wires":[["7cfab37f.c50c6c"],["bca9c551.a48478"]]},{"id":"7cfab37f.c50c6c","type":"template","z":"4aac43bc.7854ec","name":"ON","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"ON","x":730,"y":400,"wires":[["99f675a1.31985"]]},{"id":"bca9c551.a48478","type":"template","z":"4aac43bc.7854ec","name":"OFF","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"OFF","x":730,"y":440,"wires":[["99f675a1.31985"]]},{"id":"99f675a1.31985","type":"mqtt out","z":"4aac43bc.7854ec","name":"Fan In","topic":"cmnd/ceiling/POWER2","qos":"0","retain":"true","broker":"ac5ed306.14505","x":850,"y":420,"wires":[]},{"id":"f297ee5c.354e28","type":"mqtt out","z":"4aac43bc.7854ec","name":"Light In","topic":"cmnd/ceiling/POWER1","qos":"0","retain":"true","broker":"ac5ed306.14505","x":860,"y":280,"wires":[]},{"id":"25169171.32540e","type":"homekit-service","z":"4aac43bc.7854ec","isParent":true,"bridge":"d1e9a5db.0081d","parentService":"","name":"Ceiling Light","serviceName":"Lightbulb","topic":"","filter":false,"manufacturer":"zaes","model":"Ceiling Light","serialNo":"1","cameraConfigVideoProcessor":"","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":"","cameraConfigMaxWidth":"","cameraConfigMaxHeight":"","cameraConfigMaxFPS":"","cameraConfigMaxBitrate":"","cameraConfigVideoCodec":"","cameraConfigAudioCodec":"","cameraConfigAudio":false,"cameraConfigPacketSize":"","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"","cameraConfigMapAudio":"","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\n \"On\": false\n}","x":470,"y":280,"wires":[["8c6884a2.4215"],[]]},{"id":"bc334bcb.563078","type":"homekit-service","z":"4aac43bc.7854ec","isParent":true,"bridge":"d1e9a5db.0081d","parentService":"","name":"Ceiling Fan","serviceName":"Fan","topic":"","filter":false,"manufacturer":"zaes","model":"Ceiling Fan","serialNo":"1","cameraConfigVideoProcessor":"","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":"","cameraConfigMaxWidth":"","cameraConfigMaxHeight":"","cameraConfigMaxFPS":"","cameraConfigMaxBitrate":"","cameraConfigVideoCodec":"","cameraConfigAudioCodec":"","cameraConfigAudio":false,"cameraConfigPacketSize":"","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"","cameraConfigMapAudio":"","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"","cameraConfigDebug":false,"characteristicProperties":"{\n \"On\": false\n}","x":470,"y":420,"wires":[["14120fe5.c9127"],[]]},{"id":"571467c1.61dbf8","type":"mqtt in","z":"4aac43bc.7854ec","name":"Light MQTT","topic":"stat/ceiling/POWER1","qos":"2","broker":"ac5ed306.14505","x":110,"y":220,"wires":[["46d0681d.4819e8"]]},{"id":"e4d73335.a6723","type":"mqtt in","z":"4aac43bc.7854ec","name":"Fan MQTT","topic":"stat/ceiling/POWER2","qos":"2","broker":"ac5ed306.14505","x":100,"y":420,"wires":[["77934a9a.c25cdc"]]},{"id":"77934a9a.c25cdc","type":"change","z":"4aac43bc.7854ec","name":"Change Json","rules":[{"t":"change","p":"payload","pt":"msg","from":"ON","fromt":"str","to":"{ \"On\": true }","tot":"json"},{"t":"change","p":"payload","pt":"msg","from":"OFF","fromt":"str","to":"{ \"On\": false }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":420,"wires":[["bc334bcb.563078"]]},{"id":"d7d2e7c1.cf9dc","type":"change","z":"4aac43bc.7854ec","name":"Change Json","rules":[{"t":"change","p":"payload","pt":"msg","from":"ON","fromt":"str","to":"{ \"On\": true }","tot":"json"},{"t":"change","p":"payload","pt":"msg","from":"OFF","fromt":"str","to":"{ \"On\": false }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":280,"wires":[["25169171.32540e"]]},{"id":"8c6884a2.4215","type":"switch","z":"4aac43bc.7854ec","name":"","property":"hap.newValue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":280,"wires":[["9cc96dcc.35d368"],["bf55226e.731318"]]},{"id":"9cc96dcc.35d368","type":"template","z":"4aac43bc.7854ec","name":"ON","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"ON","x":730,"y":260,"wires":[["f297ee5c.354e28"]]},{"id":"bf55226e.731318","type":"template","z":"4aac43bc.7854ec","name":"OFF","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"OFF","x":730,"y":300,"wires":[["f297ee5c.354e28"]]},{"id":"46d0681d.4819e8","type":"delay","z":"4aac43bc.7854ec","name":"limiter","pauseType":"rate","timeout":"0","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":150,"y":280,"wires":[["d7d2e7c1.cf9dc","d2f45b5e.3c52e"]]},{"id":"ac5ed306.14505","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.200","port":"1881","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"d1e9a5db.0081d","type":"homekit-bridge","z":"","bridgeName":"Main Lights","pinCode":"098-76-543","port":"","allowInsecureRequest":false,"manufacturer":"zaes","model":"Main Lights","serialNo":"1","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]