Software apps and online services
In the past, if you want to access Apple's homekit, you need to use homeassistant, homebridge and other services to realize it. The complexity of configuration is not friendly to beginner. At the same time, building a connected server is not a small overhead. Now you can easily access the homekit service by using the ESPHap library. You can control the M5Stack through related Apple products.
Take M5StickC as an example to show how to use the ESPHap library file. First, we need to download the related file https://github.com/yurik72/esphap from GitHub. After downloading, find the wolfssl folder, under this file, there is a wolfssl -13-3-0.rar package. Extract the compression package to Arduino library as an independent wolfssl library.
Operation process:connected WIFI->Register configuration status indicator pin (can be omitted)->Initialize SPIFFS, store homekit pairing information->Set the callback function to remove the device (it must be added, otherwise the Apple HomeKit cannot be paired again after deleting the device, and the NVS partition must be erased and upload code again) ->Set device type (32 types enumerated) ->Register homekit hardware (Sensor, manufacturer, serial number, model, firmware information) ->Add homekit service information->Final initialization. Code Homekit code is set to 111-11-111 by default.
For the first use, you need to format the spiffs storage configuration file, about 30 seconds, and wait patiently. The following example is connected to ENV-Unit to display temperature and humidity.
Thanks to yurik72