# Button / PIR sensor, and MQTT to home assistant

**URL:** <https://wled.discourse.group/t/button-pir-sensor-and-mqtt-to-home-assistant/7198>\
**Category:** Questions\
**Created:** [January 21, 2023, 6:08pm UTC](https://wled.discourse.group/t/button-pir-sensor-and-mqtt-to-home-assistant/7198 "2023-01-21T18:08:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrStein99](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/drstein99/32/3994_2.png) [@DrStein99](https://wled.discourse.group/u/DrStein99)\
**Post date:** [January 21, 2023, 6:08pm UTC](https://wled.discourse.group/t/button-pir-sensor-and-mqtt-to-home-assistant/7198/1 "2023-01-21T18:08:50Z")

</div>

Hello, I am a bit of a novice with wLed and my coding is a little rusty in my age. After a few tries, I finally get wLED to compile, upload and burn to a D1-MINI in the [platform.io](http://platform.io) after a countless number of rebooting, deleting directories and starting over from scratch. My boards are linked to home assistant MQTT and work just as the tutorials I have read, without flaw.

What my goal is trying to add a simple 3-wire AM312 PIR sensor to the “button”, and have it report to home assistant MQTT independent of any onboard ESP8266 functions. I will use that as a trigger in home assistant, to decide to activate the strip LED for that board, or any other home assistant purpose.

So far it has been really frustrating. I spent hours playing with the web dialog, and getting lost reading user-mods. My firmware is stock without any user modifications, or special configured macro’s (I have yet to learn how to do). I do not see any entities in home assistant for the button, but the other 23 entities show up with useful information on the ssid, wifi strength, presets, etc… I can not tell if the button is being triggered, since I do not see anything on the wLED web dialog that says “BUTTON IS DOWN / BUTTON IS UP”. If anyone has advice how to debug that check my wiring make sure it is triggered, right pin, etc… it would be helpful.

My question is: What do I need to do, tutorial I need to read, function to learn - to report the PIR activation (or button press) to the MQTT service, and register that entity with home assistant?

---

<div class="post-metadata">

**Author:** ![srg74](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/srg74/32/3018_2.png) [@srg74](https://wled.discourse.group/u/srg74)\
**Post date:** [January 21, 2023, 6:38pm UTC](https://wled.discourse.group/t/button-pir-sensor-and-mqtt-to-home-assistant/7198/2 "2023-01-21T18:38:32Z")

</div>

Try this [WLED-wemos-shield/WLED\_0.14.0-b1\_esp8266\_PIRmod.bin at master · srg74/WLED-wemos-shield · GitHub](https://github.com/srg74/WLED-wemos-shield/blob/master/resources/Firmware/%40Aircoookie/v0.14.0-b1/WLED_0.14.0-b1_esp8266_PIRmod.bin)
