"Enter"a basıp içeriğe geçin

Enhancing Home Automation: KDE Plasma and Yeelight Bulbs

I purchased a couple of Xiaomi Smart Led Bulbs a few years ago. In the beginning, it was fun to control the bulbs using a mobile application. However, as someone who spends most of his day in front of a computer, I gradually started feeling uncomfortable using my mobile phone to control the bulbs.

After some research, I’ve discovered that the bulbs can also be controlled from other devices in the same network, thanks to the programming interface the bulbs are providing. So, as a dedicated KDE user for years, I started developing a Plasma 5 widget that provided a simple user interface to control the bulbs next to the clock in the system tray. Unfortunately, the code was quite messy (e.g., I was a beginner with QML widgets, the widget was using a Python script for socket communication with the bulb, etc.), so I’ve never published that version on the web 🙂

With the arrival of KDE Plasma 6.0 a couple of months ago, the widget became unusable due to the changes introduced in the underlying libraries. Rather than simply updating the widget for compatibility, I’ve rewritten most of the widget from scratch, resulting in a cleaner and more efficient codebase. Instead of Python, the widget now uses a native C++ plugin which integrates better with the widget.

The widget currently offers the following features:

  • On/Off control,
  • Brightness, Temperature, RGB controls,
  • Animation duration setting

When the widget is first loaded, it communicates with the bulb and sets its interface accordingly. Additionally, the widget regularly communicates with the bulb and updates its interface if the bulb is controlled from somewhere else (e.g., the mobile app).

Installation

The source code for the widget is available at https://github.com/efeciftci/plasma-widget-yeelight. I’ve also uploaded a prebuilt .deb package for KDE Neon at https://github.com/efeciftci/plasma-widget-yeelight/releases/latest.

Assuming the prerequisites and build dependencies are already installed on your system, the widget can be built and installed with:

git clone https://github.com/efeciftci/plasma-widget-yeelight.git
cd plasma-widget-yeelight
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install

Usage

For the widget to work, the LAN Control setting for the bulb must first be enabled from the Yeelight mobile app. The user is expected to enter the IP address of a bulb available on the local network in the configuration window when the widget is used for the first time. The user then can interact with the bulb using the user interface provided by the widget.

The Future

I plan to implement new features for the widget in the future, such as automatic bulb discovery and the ability to control multiple bulbs, so feel free to visit the widget homepage occasionally. And as always, merge requests and forks are welcome 🙂

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Time limit is exhausted. Please reload CAPTCHA.