So user big_like_a_pickle
posted a pic on reddit of his project for creating a presence sensor that accounts for the flaws in a microwave presence and a PIR sensor. Link
I liked the idea behind it and wanted to build my own. I didn't get the EXACT same PIR sensor, but ended up being able to make what I got work. I also, instead of coding up my own Arduino, leveraged ESPHome to simplify the programming of it as well as its integration with HomeAssistant.
Since I went with the "easy" approach of ESPHome, it just means that I'll have to describe the interaction in YAML, plus integrating it with Home Assistant is as simple as pointing it at the IP Address that it gets assigned via the UI.
You'll want to pull this repo down via the git clone
command to get started.
There are two files that are of concern for this project:
- motion_common.yaml
- sample.yaml
I modeled this after a template I'd found previously that really made integrating multiple of these types of devices easily. The common
file allows you to have all of the things that can be shared written down once. In the sample.yaml
, it just has to include the motion_common.yaml
file and then you reference the unique aspects.
In the motion_common.yaml
file, you can update the SSID so that it automatically connects to your WiFi at start up. The ap
configuration allows for a fallback in case the device is unable to connect to the configured SSID.
You do you, boo boo.
To get this set up, you do not need the Arduino IDE, but you will need python:
pip install esphome
esphome upload --upload-port=<PATH_TO_USB_PORT> sample.yaml
You can leverage Home Assistant's built-in integration with ESPHome to get this up quickly. That link will tell you all you need to know.
I'm debating expanding this circuit and configuration to replace a wall switch sensor. This would require stepping down 110V to the required 5V, and I also think I'll use a different ESP8266 Board just to not have the micro USB in there.
Any suggestions are welcome.