I don't know if I posted this sequence a few years ago, but I had to recreate it last night, so I am posting it again.
Title: Shutdown Hubitat using a HomeKit switch
Summary: I have my Hubitat hub plugged into a USB zigbee switch from Sonoff. The USB switch is paired to zigbee2mqtt. This sequence lets me shutdown my Hubitat using a HomeKit switch in Apple Home. When the HomeKit switch is turned off, it sents an http POST to initiate a controlled shutdown of the Hubitat hub. It then makes sure the Hubitat hub if off by pinging it, and when the hub no longer responds to pings, the USB zigbee switch is turned off. When the USB zigbee switch is turned on, the hub is restarted.
Picture:
Sequence:
[{"id":"3f2c82a298bebe82","type":"change","z":"86681e54e08a990a","name":"ON","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":340,"wires":[["21f0a047a3227c19"]]},{"id":"a2443f220a5f469a","type":"switch","z":"86681e54e08a990a","name":"T/F","property":"payload.On","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":340,"wires":[["3f2c82a298bebe82"],["e319ecdb9df1404d"]]},{"id":"2ad30c07f41c1190","type":"homekit-service","z":"86681e54e08a990a","isParent":true,"hostType":"0","bridge":"599b29e8a1989ac9","accessoryId":"","parentService":"","name":"Hubitat Switch","serviceName":"Switch","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.7.3","serialNo":"Default Serial Number","firmwareRev":"1.7.3","hardwareRev":"1.7.3","softwareRev":"1.7.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,"adaptiveLightingOptionsEnable":false,"adaptiveLightingOptionsCustomTemperatureAdjustment":"","x":160,"y":340,"wires":[["a2443f220a5f469a"],[]]},{"id":"e319ecdb9df1404d","type":"http request","z":"86681e54e08a990a","name":"Hubitat Shutdown","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://192.168.0.6/hub/shutdown","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":550,"y":380,"wires":[["0a554adcb446d6dc"]]},{"id":"0a554adcb446d6dc","type":"delay","z":"86681e54e08a990a","name":"60s","pauseType":"delay","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":695,"y":380,"wires":[["7560cd39de58997e"]],"l":false},{"id":"7560cd39de58997e","type":"ping","z":"86681e54e08a990a","protocol":"IPv4","mode":"triggered","name":"Hubitat","host":"192.168.0.6","timer":"20","inputs":1,"x":820,"y":380,"wires":[["3b16d8c6e449d7ac"]]},{"id":"381f53e4d836c2dd","type":"delay","z":"86681e54e08a990a","name":"15s","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":815,"y":440,"wires":[["7560cd39de58997e"]],"l":false},{"id":"3b16d8c6e449d7ac","type":"switch","z":"86681e54e08a990a","name":"F/O","property":"payload","propertyType":"msg","rules":[{"t":"false"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":970,"y":380,"wires":[["4c2e384a1e25957e"],["381f53e4d836c2dd"]]},{"id":"4c2e384a1e25957e","type":"change","z":"86681e54e08a990a","name":"OFF","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":380,"wires":[["21f0a047a3227c19"]]},{"id":"21f0a047a3227c19","type":"zigbee2mqtt-out","z":"86681e54e08a990a","name":"","server":"1eeacb51e33c1fef","friendly_name":"Hubitat Switch (ZBMicro)","device_id":"0xd44867fffe3abb5a","command":"state","commandType":"z2m_cmd","payload":"payload","payloadType":"msg","optionsValue":"","optionsType":"nothing","x":1350,"y":340,"wires":[]},{"id":"599b29e8a1989ac9","type":"homekit-bridge","bridgeName":"NR Bridge","pinCode":"1541-2144","port":"","advertiser":"bonjour-hap","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"1.7.3","serialNo":"Default Serial Number","firmwareRev":"1.7.3","hardwareRev":"1.7.3","softwareRev":"1.7.3","bind":"","bindType":"str","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true},{"id":"1eeacb51e33c1fef","type":"zigbee2mqtt-server","name":"Z2M","host":"192.168.0.59","mqtt_port":"1883","mqtt_username":"aaiyar","mqtt_password":"4917Bissonet","mqtt_qos":"1","tls":"","usetls":false,"base_topic":"zigbee2mqtt"}]
