If you use the mosqitto within HA you can go into integrations - mosqitto broker and start listening to a topic. In your example homeassistant/button/doorbell/config
I think MQTT button does the opposite of what you are trying to do.
The mqtt button platform lets you send an MQTT message when the button is pressed in the frontend or the button press service is called. This can be used to expose some service of a remote device, for example reboot. MQTT button - Home Assistant
The way you want to go is from doorbell → RPI → MQTT SEND TOPIC → HA MQTT Listen to topic ?
I would assume a RPI is a little bit oversized compared to ESP32? However, this this guy uses a M5Paper with integrated buttons, maybe the example python code from his github might be helpful?
Thanks ondras, you are probably right. Reading this again it probably only works one way from HA to a device.
Yes, that’s the idea. So doorbell is just a push button connected to one of the RPI pins. Button pressed → send a message to HA → run some automation.
The intention is for RPI to be running a few other services: doorbell, irrigation system, cat feeder, garage door control, plus whatever comes in the future if it can still handle it. The ESPs are nice but each one needs a power source and I find it to be too exhausting. I still haven’t figured out the complete structure of how the RPI will run (single script, multiple scripts, it will also require MCP23017 so adds more complexity).
In any case …
I actually found a way of doing what I want by following the MQTT Device Trigger guide, which creates a device with command/triggers and a quicker path to automation, but it’s still not perfect because entities created are still decoupled from the device, so still searching around.