ratgdo

View the Project on GitHub PaulWieland/ratgdo

TOC

NodeRED Example

These examples show how to interface ratgdo to Appleā€™s HomeKit using the NRCHKB homekit node for NodeRED. The process for Google Home would be similar - if anyone wishes to share an example, please submit a pull request.

Single Door

This example shows how to use the NRCHKB homekit nodes with ratgdo MQTT messages.

[{"id":"7b4a2c42db6452c9","type":"mqtt in","z":"6ba85b54.4eaccc","name":"","topic":"home/garage/+/status/+","qos":"2","datatype":"auto","broker":"a59c4793.670798","nl":false,"rap":true,"rh":0,"inputs":0,"x":430,"y":340,"wires":[["b558e1713b55a981"]]},{"id":"9792a0cef14de8bd","type":"change","z":"6ba85b54.4eaccc","name":"Obstruction","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"ObstructionDetected\":1}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":970,"y":320,"wires":[["2f6b42b5bab45e6a"]]},{"id":"28180d22a4760e7a","type":"change","z":"6ba85b54.4eaccc","name":"Clear","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"ObstructionDetected\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":360,"wires":[["88a97265efcb2a47"]]},{"id":"84a7a05fc1c8e6c5","type":"switch","z":"6ba85b54.4eaccc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"opening","vt":"str"},{"t":"eq","v":"open","vt":"str"},{"t":"eq","v":"closing","vt":"str"},{"t":"eq","v":"closed","vt":"str"},{"t":"eq","v":"obstructed","vt":"str"},{"t":"eq","v":"clear","vt":"str"},{"t":"eq","v":"locked","vt":"str"},{"t":"eq","v":"unlocked","vt":"str"},{"t":"eq","v":"offline","vt":"str"},{"t":"eq","v":"online","vt":"str"},{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":12,"x":750,"y":340,"wires":[["63011314e44cc5c2"],["f2ea1d8c3f1648d2"],["c13d7b743accb5b3"],["b958cff80596dcd3"],["9792a0cef14de8bd"],["28180d22a4760e7a"],[],[],[],[],["22e4af0d36cde743"],["1d4eac3f766f7d80"]]},{"id":"f2ea1d8c3f1648d2","type":"change","z":"6ba85b54.4eaccc","name":"CurrentDoorState Open","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetDoorState\":0,\"CurrentDoorState\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1010,"y":200,"wires":[["99201f279051b20b"]]},{"id":"b958cff80596dcd3","type":"change","z":"6ba85b54.4eaccc","name":"CurrentDoorState Closed","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetDoorState\":1,\"CurrentDoorState\":1}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1010,"y":280,"wires":[["07d02107e01aeecf"]]},{"id":"63011314e44cc5c2","type":"change","z":"6ba85b54.4eaccc","name":"CurrentDoorState Opening","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetDoorState\":0,\"CurrentDoorState\":2}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":160,"wires":[["b7e30be92f14fa2b"]]},{"id":"c13d7b743accb5b3","type":"change","z":"6ba85b54.4eaccc","name":"CurrentDoorState Closing","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetDoorState\":1,\"CurrentDoorState\":3}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1010,"y":240,"wires":[["0cb3b4cd8c774f01"]]},{"id":"cbd44e13318a1fea","type":"mqtt out","z":"6ba85b54.4eaccc","name":"home/garage/*/command","topic":"","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"a59c4793.670798","x":1930,"y":300,"wires":[]},{"id":"9e96ba6dc5cc686c","type":"change","z":"6ba85b54.4eaccc","name":"close","rules":[{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1710,"y":260,"wires":[["cbd44e13318a1fea","86a502b28b5eb34d"]]},{"id":"cf939af3a766c5be","type":"change","z":"6ba85b54.4eaccc","name":"open","rules":[{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1710,"y":300,"wires":[["cbd44e13318a1fea","86a502b28b5eb34d"]]},{"id":"86a502b28b5eb34d","type":"debug","z":"6ba85b54.4eaccc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1890,"y":260,"wires":[]},{"id":"a4a19801141494eb","type":"switch","z":"6ba85b54.4eaccc","name":"","property":"payload.TargetDoorState","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":1590,"y":280,"wires":[["9e96ba6dc5cc686c"],["cf939af3a766c5be"]]},{"id":"f30432e055d269d5","type":"change","z":"6ba85b54.4eaccc","name":"ch topic","rules":[{"t":"change","p":"topic","pt":"msg","from":"/status$","fromt":"re","to":"/command/door","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1460,"y":280,"wires":[["a4a19801141494eb"]]},{"id":"43c7dba25cf93895","type":"debug","z":"6ba85b54.4eaccc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1970,"y":440,"wires":[]},{"id":"b558e1713b55a981","type":"change","z":"6ba85b54.4eaccc","name":"chg topic","rules":[{"t":"change","p":"topic","pt":"msg","from":"status/.*","fromt":"re","to":"status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":340,"wires":[["84a7a05fc1c8e6c5"]]},{"id":"3610c6f862294d49","type":"homekit-service","z":"6ba85b54.4eaccc","isParent":false,"hostType":"0","bridge":"5848fa57.3c3164","accessoryId":"","parentService":"b7e30be92f14fa2b","name":"Glass Door Light","serviceName":"Lightbulb","topic":"home/garage/GlassDoor/status","filter":false,"manufacturer":"NRCHKB","model":"1.4.3","serialNo":"Default Serial Number","firmwareRev":"1.4.3","hardwareRev":"1.4.3","softwareRev":"1.4.3","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":1330,"y":420,"wires":[["c26650c042e391c9"],[]]},{"id":"22e4af0d36cde743","type":"change","z":"6ba85b54.4eaccc","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":1}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":400,"wires":[["07d580d9f7ab2989"]]},{"id":"1d4eac3f766f7d80","type":"change","z":"6ba85b54.4eaccc","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":440,"wires":[["c90846c3575c6996"]]},{"id":"df66d59f33dac09d","type":"switch","z":"6ba85b54.4eaccc","name":"","property":"payload.On","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1690,"y":420,"wires":[["cd83a7efa2c829d3"],["83bd3af67e68fa27"]]},{"id":"cd83a7efa2c829d3","type":"change","z":"6ba85b54.4eaccc","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1810,"y":400,"wires":[["45d8dd27dad603b1","43c7dba25cf93895"]]},{"id":"83bd3af67e68fa27","type":"change","z":"6ba85b54.4eaccc","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1810,"y":440,"wires":[["45d8dd27dad603b1","43c7dba25cf93895"]]},{"id":"45d8dd27dad603b1","type":"mqtt out","z":"6ba85b54.4eaccc","name":"home/garage/*/command","topic":"","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"a59c4793.670798","x":2010,"y":400,"wires":[]},{"id":"b7e30be92f14fa2b","type":"homekit-service","z":"6ba85b54.4eaccc","isParent":true,"hostType":"0","bridge":"5848fa57.3c3164","accessoryId":"","parentService":"","name":"Glass Door","serviceName":"GarageDoorOpener","topic":"home/garage/GlassDoor/status","filter":true,"manufacturer":"prw","model":"1337","serialNo":"001","firmwareRev":"1337","hardwareRev":"1337","softwareRev":"1337","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":"{\"LockTargetState\":1,\"LockCurrentState\":1}","waitForSetupMsg":false,"outputs":2,"x":1310,"y":280,"wires":[["f30432e055d269d5"],[]]},{"id":"c26650c042e391c9","type":"change","z":"6ba85b54.4eaccc","name":"","rules":[{"t":"change","p":"topic","pt":"msg","from":"/status$","fromt":"re","to":"/command/light","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1530,"y":420,"wires":[["df66d59f33dac09d"]]},{"id":"99201f279051b20b","type":"junction","z":"6ba85b54.4eaccc","x":1140,"y":200,"wires":[["b7e30be92f14fa2b"]]},{"id":"0cb3b4cd8c774f01","type":"junction","z":"6ba85b54.4eaccc","x":1140,"y":240,"wires":[["b7e30be92f14fa2b"]]},{"id":"07d02107e01aeecf","type":"junction","z":"6ba85b54.4eaccc","x":1140,"y":280,"wires":[["b7e30be92f14fa2b"]]},{"id":"2f6b42b5bab45e6a","type":"junction","z":"6ba85b54.4eaccc","x":1140,"y":320,"wires":[["b7e30be92f14fa2b"]]},{"id":"88a97265efcb2a47","type":"junction","z":"6ba85b54.4eaccc","x":1140,"y":360,"wires":[["b7e30be92f14fa2b"]]},{"id":"c90846c3575c6996","type":"junction","z":"6ba85b54.4eaccc","x":1140,"y":440,"wires":[["3610c6f862294d49"]]},{"id":"07d580d9f7ab2989","type":"junction","z":"6ba85b54.4eaccc","x":1140,"y":400,"wires":[["3610c6f862294d49"]]},{"id":"a59c4793.670798","type":"mqtt-broker","name":"","broker":"10.0.1.55","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"5848fa57.3c3164","type":"homekit-bridge","bridgeName":"NodeRed","pinCode":"111-11-112","port":"","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"1.2.0","serialNo":"Default Serial Number","firmwareRev":"1.2.0","hardwareRev":"1.2.0","softwareRev":"1.2.0","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":false}]

image