Small wall switch panel - Discussion

Hello all,
i always was a little bit jealous about the cool-looking KNX wall switches and panels:
image image

Therefore, i tried to search such a device with the following features for my smart home system:

  • Display (and buttons if possible)
  • Kind of small (2-4" display) - having 1 or 2 tables in the house is fine but i dont want to have a tablet in every room …
  • Customizable buttons and icons for lights, scenes, heating, etc.
  • Wireless communication (WLAN / Zigbee / MQTT / ?)

But i didnt really found something.
I only found normal wireless wall switches with up to 4 push buttons (which of course can be customized via openHAB). However, without the user really knowing what is behind these buttons …
Did i miss some cool devices which cover such functions??

So i decided to try something on my own.

I thing in principle there are a few different options:

  1. Arduino and Touch Panel
  2. Raspberry PI and Touch Panel
  3. (Old) Smartphone or small Tablet

I started with the first option: Arduino and Touch Panel with the following components:

After some evenings of coding and debuging i ended up with this DIY device:

  • There is a menu and different sub-menus.
  • The items can be ordered in different pages.
  • Communication is done via MQTT and is bi-directional.
  • Configuration is done over-the-air.
  • P ossible to add additional sensors (temperature, humidity, motion, etc).
  • Its pretty cheap with ~ 20 $.

However, the drawback is that the configuration is pretty annoying and all the items which are communicated have to be setup as a MQTT thing.

Also i dont like the 3D printed shape because there is a big SD card in the panel till now. However, its possible to flash the icons directly on the ESP32 and get rid of the SD card. This will make the device smaller.

While doing this first device i was already thinking about option 2 Raspberry PI and Touch Panel:

In my understanding it should be way easier to use the following components:

  • The Hardware setup seems to be pretty plug-and-play.
  • By using this setup it should be possible to just display a local browser page of OpenHAB (BASIC-UI or HABpanel) in kiosk-mode.
  • This means all the coding and special configuration is not required.
  • Also its possible to add additional sensors (temperature, humidity, motion, etc).
  • However, i am not sure about the performance.
  • Cost are higher ~ 40 $

Option 3 would be an old smart phone or small tablet
Benefits are of course that its out-of-the-box and able to display local browser OpenHAB page (BASIC-UI or HABpanel) in kiosk mode.
However, not possible to add additional sensors and also not that nice to put it in a box. Also i dont like the fact that there is an old battery integrated.

  • What do you guys think?
  • Did one of you already tried on of the solutions or are there even more (maybe already a final solution on the market)?
  • What would be your preference?

Best regards!

I think I’ve seen esp32 with display that may be something to look for and requires less tinkering



Dear Marcel,
Thank you for the input!
Yes I do know the AZ touch module already. It’s also a ILI9341 display. However I dont like the big border of the case around the screen.
The LILGO looks nice, I will check this one.

Does anyone have experience with a raspberry pi zero w, small displays and browser in kiosk mode?

Okay, I’m totally biassed here, but do check out my openHASP project. :wink:

In openHASP you can display a series of pages with fully customizable objects. The layout is defined either by a JSON lines file on the flash partition or via jsonl commands over mqtt. The configuration of those screens is entirely up to you.

We’re using the lvgl library which allows for complete control of almost any object property. openHASP lets you send the commands over MQTT. Over the past 18 months we’ve slowly integrated features while adding support for microcontrollers like the ESP32.

There are binaries on Github for several of-the-shelf and DIY devices, like the ESP32-Touchdown, FreeTouchDeck, M5Stack core2 and WT32-SC01. Even more configurations are available when you compile the firmware yourself, including the AZ-Touch and Lily Pi…

With the help of @blakadder we’ve added support for the popular Lanbon L8 series of smart switches and it runs quite smoothly. Here’s a quick demo:

Note: The openHASP firmware is currently still a pre-release version. Feel free to try it out.

The Adafruit TFT Featherwing 2.4" is rather compact but is also a fair bit more expensive than those generic ILI displays. I am a fan of the cheap Lolin 2.4" Touch shield, which is also compatible with the TTGO T7 v1.5 Mini32 and Lolin D32 Pro V2.0:

As far as I am aware the ELEGOO 3.5" Touch Panel does not have backlight control, which imho is a must-have feature for a switch panel. However, the Waveshare RPi LCD (Revision C) touchscreens do support backlight dimming via a solder jumper… and are also are more expensive:

Wow that’s great! I will definitely try it!
Is the ILI9341 supported?
If yes I can directly use available hardware

I am not able to find that much information about the display online. Not even a datasheet. Do you mean backlight control = on/off or dim function? I think on/off would be enough. Can I turn on off the display while running?

The ILI9341 MSP series is indeed supported. Use the pre-built d1-mini-esp32_ili9341_full_4MB_v0.6.1.bin file and the pin configuration described in the documentation.

From what I understand, the Waveshare/Spotpear orginal design has been copied many times over and there are numerous clones of these displays. I have another clone that does not have dimming nor backlight on/off control.

Digging around, I did find that the revision C Waveshare boards added this feature later on. I confirmed this on the 4" Rpi TFT Rev (C). It has a backlight transistor which can be controlled via PWM.

I might be wrong about the ELEGOO but I don’t see a transistor… so just be forewarned if you decide to buy that display.

Well, your project sold me, my L8 arrives tomorrow, just in time for the weekend :slight_smile:

1 Like

Hi fvanroie,
Thank you a lot for your answers!
I really want to try out openHASP.
However I don’t have a esp d1 mini.
The ILI9341 is wired to a ESP 32 NodeMCU.
Is it still possible to flash the file or do I somehow have to re compile it?
I checked the manual, but to be honest didn’t really understood it.
Till now I was only using arduino IDE to flash ESPs.
Maybe you can give me a short hint :slight_smile:

Edit: the esp 32 modemcu i do have seems to have a SoC ESP32-WROOM 32 (dont know what this means…). Do you recommend the 3 different esp32 because they directly fit to the screens or is it due to the chip architecture? Because i only found the wemos d1 mini esp32 pre compiled file to download. Does this mean this file can be used by all esp32? I only have to take care about the wiring to the display?

You’re welcome! I did find your question on Github first, so I answered it there.

Basically any ESP32 with ILI9341 should work as long as you adhere to the pinout defined in the d1-mini-esp32_ili9341 binary.

Hi fvanroie,
Thank you for your detailed answer.
I managed to flash openhasp on my current esp32 and ILI9341 setup.
I will keep playing around with it.
However, is there a “smart” way to integrate it into openhab 3?
I am afraid I do have to link every single button with an openhab item bi-directional.
I was facing the same issue in my initial self-made display code.
I found a openhab thread and some code for openhab integration in the openhasp wiki but it seems to be a lot of manual work.
Or am I missing something?

I’m very much an openHAB n00b, so I’m probably not much of a reference I’m afraid…
There is a demo integration of openHASP with openHAB available here, I guess that is the one you found.

The idea behind openHASP is that most of the layout and logic is offloaded to your home automation system. We provide an MQTT interface to the LVGL objects. The UI can be as easy or complex as you want. But it also requires you to code against that UI and integrate it with the rest of your home automation system. Some basic functions, like page navigation or GPIO control can be handled on the plate too.

Maybe @digitaldan can chime in when his Lanbon has arrived :slight_smile:

I have tried to install openHASP 0.6.3 and also deployed the openHAB demo sample you have.
As I have understood the sample, most of it is the configuration of the display.
Is it correct that every event for a button / slider / … has to be processed in the rule ?
I would like some simple way of assigning a MQTT topic to a button and then a active and inactive value (eg. ON / OFF). If that is possible it would be pretty easy to map it to an item in openHAB.
Is that possible or do I need to manually decode in the rule?

The configuration of the display is optional. You can either send it from openHAB or save it locally in the pages.jsonl file. In the demo, the config is pushed using openHAB as an example.

Events (and values) are published in the state topic corresponding to the object, eg. hasp/<nodename>/state/p1b2 with a payload in JSON format eg. {"event":"up","val":1}.

The rule is used to inspect the JSON payload of these events and take an action depending on the object, event and/or value. The data is not a simple ON/OFF payload, so some logic is needed to translate the data.

Thanks for the reply.
I think it should be possible to make a generic wrapper in the rule engine, so that items is mapped to objects (eg. p1b2).
I figured out how I can dynamically change the text on a button (eg. from ‘Lights Off’ to ‘Lights Off’, can I also change the icon? I didn’t have success in that.
Another thing is if it is possible to change whole objects? Eg on my media page I would have a source selector (Radio, Spotify, TV). Then I would be able to select TV channels in when watching TV, select radio channels when listening to radio. Is that possible?

That one I figured out was not working because of an error in the sample.

You can add, modify and remove all objects on-the-fly by sending the appropriate jsonl or commands. In your case you can either change the options of the channel object, or show/hide the Radio, Spotify, TV selector depending on the selected source.

Please share the error so I can fix it in the Github demo repository. Thanks.

Cool, I also thought that this was the case. I will try, might have some questions :slight_smile:

Will do, it was an nonexisting item that was referenced in the rule. it was called something with test where it was defined with demo. I will find the item later.

1 Like