Maker Salam Waddah has come up with a unique way to control his Xiaomi Mi home devices using a PlayStation4 gamepad, as a demonstration of how different technologies can work together. This open source project is based on the Raspberry Pi 4 that connects the Bluetooth device and Node.js server.
The project utilizes only three components — the PS4 controller, Xiaomi MI smart lights, and a Raspberry Pi 4. The basic concept was to make a Bluetooth device that tells the Raspberry Pi to do something, which in this case happens to be the gamepad.
The build process is fairly straightforward, starting with obtaining the Xiaomi device tokens for which the steps are available on the GitHub repository. Then, set up a Node.js server on Raspberry Pi, write an API to adjust the lights, and connect the controller to the Pi via Bluetooth and Python. This works on the Python code that enables the PS4 controller to talk with the APIs. Waddah has provided all the code on GitHub.