ESP32 with buttons to send MQTT payload

Hello,

since this is my first time on the forums i would like to - quickly - introduce myself and give a general explanation of my home assistant setup.

I’m an 18 year old who is alwys tinkering with the firmware of every device i have in my possession, Mi Mix 2s with twrp and a custom rom, custom windows phone builds on my 2 old lumia’s etc etc.

About 4 months saw some sonoffs listed on AliExpress which caught my interest, and in typical me fashion i did some research, and some research and some more research, after which i decided to order 3. When they came in the mail and had them in the desired spot i quickly found the control via the Ewelink app lacking and i had a raspberry pi 3B+ collecting dust so i think you can predict what rabbit hole i now find myself in.
Blew 1 basic r2 up after some experiments and ordered 2 r3’s and got my hands on an ESP32 with a breakout board

Now to why I made this forum post:
I have an old phablet mounted to the wall which is displaying home panel 24/7, but is not in reach of my desk.
I have some buttons, LED’s and 10k resistors, and my idea was to use the esp to assign 4 buttons, each to another topic, to when pressed switch the state of the sonoffs (which run tasmota) and have an led as state indicator.

I dont really know where i need to start, and i want to ask you guys for some help.

My excuses for the way too long introduction,
Sneeuwschuiver

Welcome to the community. This is entirely possible. I assume you already have the sonoffs in home assistant. In general terms:

  1. Use esphome to create a 4 button device, each button is a binary_sensor in home assistant.

  2. Set automations that turn on (or off) the sonoff when the binary sensor state changes.