A DIY touchscreen scene controller that fits in a standard switch box
I had been looking for a clean way to control Home Assistant that would fit into a standard single-gang work box / switch panel. Lacking good options on the market I decided to design and build one myself.
The HASwitchPlate (“HASP”) can display a series of “pages”, each with a custom set of buttons. There are several default button layouts (4 button/8 button/12 button/media/graph) available out of the box, and each button can be configured from Home Assistant via MQTT for custom text, font size, colors, and actions. Button presses are published back to MQTT for Home Assistant to pick up and react to via automations.
The project includes a 3D-printable enclosure (front/back) to fit a 2.4" Nextion LCD touchscreen. Arduino code for an ESP8266 has been developed to interface with the display and communicate with Home Assistant via MQTT. A PCB design is available to safely power the device with AC power.
The Nextion display used in this project has it’s own command structure which is accessible via MQTT, so you can use the provided display firmware or download their editor to add your own graphics, buttons, or other user controls. The included Arduino code should be flexible enough to support whatever you create as it’s mostly passing through Nextion commands directly.
Below are some example screens. All of these are created by way of sending MQTT commands from Home Assistant to the device, and all are included in the default Home Assistant package:
Both the microcontroller and LCD panel support web updates allowing modifications without removing the device from the wall. A web-based administration page allows you to manage the device from within the Home Assistant web interface. Extensive demonstration automations are provided to give you a sense of how to interact with the device and to provide some basic functionality out of the box. Finally, a shell script is available to simplify installation and configuration with Home Assistant. Run the script on your Home Assistant installation, restart, and the HASP is ready to run.
Building this project is straightforward with access to some basic maker tools. The enclosure requires a 3D printer but can be inexpensively outsourced through services like 3D Hubs. A PCB is available and all parts are through-hole making for easy soldering with beginning soldering skills and tools.
Alternately, fully-assembled HASP devices are available to purchase to get you setup and running quickly.