Tutorial: Make Your Non-Smart Bluetooth Light Work with HomeKit

Introduction This tutorial demonstrates how to integrate Bluetooth-enabled lights into Apple’s HomeKit ecosystem. The following mobile apps are supported: LampSmart Pro Lamp Smart Pro - Soft Lighting / Smart Lighting FanLamp Pro Zhi Jia Zhi Guang ApplianceSmart Vmax smart Zhi Mei Deng Kong By following this guide, you’ll be able to control your Bluetooth light through the iPhone Home app and Siri voice commands. For a demonstration of the final implementation, refer to my companion post: Journal: Integrate Bluetooth Lamp into HomeKit. ...

April 27, 2025 · 7 mins · Lex Cao

Journal: Integrate Bluetooth Lamp into HomeKit

I. The Challenge: Making a “Basic” Ceiling Light Smart Recently, I replaced my living room ceiling light with a new model. This light supports both remote and mobile app control, making it appear smart. However, it lacks integration with Mi Home or HomeKit. After research, I discovered that the premium version of the same brand supports Mi Home control, while my basic version doesn’t - a price difference of approximately 100 RMB. ...

April 26, 2025 · 5 mins · Lex Cao

Introducing genapi: A Golang HTTP Client Code Generator

In this article, I’m excited to introduce genapi, a code generator for Golang HTTP clients. For comprehensive documentation and implementation details, you can explore the genapi website or check out our GitHub repository. From Manual to Automatic: Evolution of Golang HTTP Client In Golang development, making HTTP API calls is a very common requirement. Through a weather API example, this article will demonstrate how HTTP client code evolves from manual writing to automatic generation. Let’s look at this simple weather API: ...

March 3, 2025 · 4 mins · Lex Cao

Learn Rust by Building a Full-stack Todo Application

What I want to write a blog about how I learned Rust. Please forgive me that I just started learning such a great programming language in 2022. To learn Rust by doing, I have built a full-stack todo application. You can try it here. The source code is available at GitHub. Here I am going to write about how to build it. How Firstly, as everyone beginning, I learn Rust from the book as well. It is an awesome book to start learning Rust, and you should not skip it. ...

May 1, 2022 · 3 mins · Lex Cao

Kotlin Weird Equality

Recently, I encountered a weird equality question about Kotlin which does not usually get much attention while coding. So here is the thought process. Background The following code snippet is using Kotlin 1.3.72. The business logic of it has been removed and only remained the code structure for reproducing the question. // a enum for state enum class MyState { OK, CANCELED } // it might return nullable MyState fun processing(): MyState? { // asuming that it returns the CANCELED state return MyState.CANCELED } // when processing the state fun handleState() { // the type of state is MyState? val state = processing() if (state == CANCELED) { // if condition counld not reach here println("Handle <CANCELED> state") } } The reason why it could not reach the CANCELED condition is the import. ...

April 21, 2020 · 8 mins · Lex Cao