A little more than three years ago I wrote a series of posts describing how to use Apple’s HomeKit to control the power of a desktop (or home server). The idea was to implement a solution that allowed me to turn the computer on or off using my iOS / iPadOS devices.
The posts described the infrastructure, the tooling and the configuration required.
Although this application had been working well over these years – surviving multiple iOS, iPadOS, Fedora, and Raspbian upgrades – the original solution was a bit cumbersome. It was composed of two projects in C, plus a few shell scripts and extra tools.
This week I decided to fix some of these loose ends. I also wanted to use this as an opportunity to learn Rust, a programming language that is gaining a lot of interest. Therefore, I decided to convert the old application from C to Rust.
In the new application, both executing the shutdown, and sending the magic packet for wake-on-lan now rely on native code. The tool does not need external scripts anymore. The bultin functionality simplifies the configuration, as you can see from the description in the project documentation.
Obs.: I am still a beginner in Rust, so if you are an experienced Rust developer that happens to look at the source code, you may notice some anti-patterns. I’m sure I will find problems once I become better at the language. This is part of my learning exercise.