Integrating Hacked Touch Panel into Home Assistant
[ Also available at https://lucasteske.dev/2019/12/integrating-hacked-touch-panel-into-home-assistant/ ]
In the previous article I showed a simple hack of a chinese Touch Panel. Now I have successfully integrated it Home Assistant and I’m able to turn my room light on / off. Here is how.
From now on I will assume you have ESPHome working on your machine and Home Assistant configured. ESPHome is very easy to install if you have python pip:
pip install esphome
Should install everything you need.
First let’s create our project. I will call it
Check the comments in this file to change the required fields.
Now this will require us to add some C++ code (including the library I previous created). So let’s first download the wtc801 library files
wtc801.cpp and put in the same folder as the
And then create a
touchpanel.h file that will hold our custom ESPHome component:
This will define 3 binary sensors for the buttons and one “Common” Sensor for the Slider. Their names are declared in
touchpanel.yml lambda section.
After that we can build and upload our project using ESPHome:
esphome touchpanel.yaml run
If everything went correct, you should receive a notification in Home Assistant:
If we click in
Check it out button, it will guide us to the Device Discovery & Configure page.
Configure button and Home Assistant will start configuring your device. It will ask the API Password that you defined in
After it configures, it will show in the device list:
Now we can configure the Automation to toggle the light using Home Automation
Click in the device line shown in the list. This will lead you another device list:
Click in the device name at the list and it will lead you to the device info page.
In the end of the page, there is an automation section
Click in any of
turned on options and it will lead to the Automation Config Page.
Give a name to your automation, for example
Toggle my light
Triggers section, make sure the correct trigger is selected
Actions section select
Call Service as
Action Type ,
Service and add the following to
Then hit the save button and test it.
Your house automation is done!
Home Assistant: https://www.home-assistant.io/