MQTT Doorbell

My two cents on powering a sensor for a traditional doorbell:

If neither the doorbell transformer nor any other wired power source is easily accessible I would recommend to use @tlsGoud 's solution but with a battery-powered wemos d1 mini and the following modifications (to make the batteries last for at least some months):

  1. connect the wire to the RST pin of the wemos d1 mini instead of the D3 pin
  2. change the code to send the mqtt message when the wemos is started and go to deepsleep then (should look like this)

For the people who wonder whether the ESP node could be powered with the doorbell AC transformer current of a button press because the transformer itself is not accessible: With a supercap it could work but probably not reliably.
Reddit’s markus_b did some math here: https://www.reddit.com/r/esp8266/comments/4slt3a/sanity_check_for_doorbell_project/d5b69uh/

An alternative for this would be to add a 433mhz transmitter to your traditional doorbell as it needs a lot less power than a wifi module and thus could be powered with capacitors. Here is a project where someone built that and documented it quite well: http://www.maltepoeggel.de/?site=klingelerweiterung
Of course you’d also need a 433mhz receiver for HA then if you haven’t already.