smart switch for guests
Print Profile(1)

Bill of Materials
- 2k - 10k Ohm THT resistor x 1:
- push button x 1: for 12mm thru hole
- glue x 1:
- self-adhesive rubber pads x 4: for better surface friction
- ESP32 D1-Mini x 1: ...or similar footprint
Description
All smart home enthusiasts will know the issue - you have visitors and they are helplessly looking for a light switch, instead of admiring the level of automation that you have acomplished!
Nevermind, here is my solution.
I am running Home Assistant and the easiest way to set up a custom smart device is using ESPHome.
Add the provided code below to the bare configuration code of your connected ESP32 D1-Mini and upload it.
Solder the push button between GND pin, the resistor and pin IO27 or whichever pin you decided on using. Just remember to update your code accordingly.
What I used:
For the look I have spray-painted the parts. Then, insert the pre-soldered ESP32, the switch and glue the two halves of the case together.
This switch ads a little fun to switching!
Here the code, just copy/paste:
switch:
- platform: template
name: "Toggle State"
id: toggle_state
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
binary_sensor:
- platform: gpio
pin:
number: GPIO27
mode:
input: true
pullup: true
inverted: true # gedrückt = ON
name: "Taster"
id: taster
filters:
- delayed_on: 20ms # Entprellung
on_press:
then:
- switch.toggle: toggle_state
# Optional: langer Druck als separate Aktion
on_click:
- min_length: 1000ms
max_length: 3000ms
then:
- logger.log: "Langer Druck erkannt"
Membership
Consider supporting me with a membership - this will give me the boost and motivation to upload even more designs! Every single supporter matters to me - and makes me invest even more time, sweat and filament, to bring you the designs you are waiting for. Also, as a member you are able to request changes to my models for your very own purpose and needs!
License
You may create derivative works based on this object, provided that all such derivative works are published exclusively on the MakerWorld platform and include proper attribution to the original creator. You may not share, upload, host, distribute, or publish this object—or any derivative work of this object—on any other digital platform, marketplace, or distribution channel. Commercial use of this object and any derivative works is strictly prohibited. This includes, but is not limited to, selling, renting, sublicensing, or using the object in any context in which you receive monetary compensation or other financial benefits.






Comment & Rating (0)