This is a simple demo of how to use KM to control a Homekit device. It's a very simple demo so don't expect too much here. Currently Homekit has no way to control devices (like fans) based on temperature values, even though HomeKit itself can display the temperature reported by HomeKit devices. Even worse, although you can read the temperature on the Apple Home screen, it's not selectable text so it's tricky to get KM to interpret the temperature. But I like challenges, and I love the Find Image action in KM!
Let's get started. Here's what I see at the top of my Apple Home window, which shows the temperature in my house:
One of the challenges is that you can see the temperature above but you can't select it so it's tricky, but not impossible, to deal with this. Someday KM may have hooks into HomeKit, and someday KM might have OCR built in, but currently it does not so we're going to use a trick using the Find Image action to get this to work.
In my case, if I owned a fan that HomeKit could turn on, I would solve the problem this way: I would create a KM macro to periodically search for the graphic image containing the letters "Living Room 7" (ie, the first digit of "70 degrees") and when that image appeared I would click on the Home icon to turn the fan on. Also in the same macro I would check if the image containing the letters "Living Room 6" appeared and when that image appears I would click on the Home icon to turn the fan off. It would look very similar to this: (this is just a sample to show the idea)
I'll be the first to admit there are downsides here, like your computer has to be running, along with KM, and you need to have Apple Home on the display. And it will take a little more work if you want to trigger on a different temperature than 70 degrees. Here's how I would tackle that. I would create one statement like the following for each number from 60 to 80, which is a cheap form of OCR. This essentially gets the temperature into a KM variable as a value.
Apple's Home product is pretty half-baked because you can't use Option +/- to zoom in and you can't get it to work with the Accessibility feature in macOS. And if you click on Edit / Speech / Start Speaking it doesn't speak anything useful. But with some ingenuity in KM you can make it work. And even if you don't like this solution, it may give you ideas for other problems.